xref: /dragonfly/gnu/usr.bin/cc80/cc_prep/Makefile (revision dcb5d66b)
1.include "../Makefile.inc"
2.include "../Makefile.langs"
3
4CONTRIBDIR=	${GCCDIR}/gcc
5
6LANGUAGES=	c c++ LTO
7
8version.c: ${CONTRIBDIR}/version.c Makefile ../Makefile.inc
9	rm -f ${.TARGET}
10	echo '#define BASEVER "${GCCCOMPLETEVER}"' >> ${.TARGET}
11	echo '#define DATESTAMP ""' >> ${.TARGET}
12	echo '#define DEVPHASE ""' >> ${.TARGET}
13	echo '#define REVISION " [DragonFly] ${GCCRELEASE}/${GCCDATESTAMP}"' >> ${.TARGET}
14	echo '#define PKGVERSION ""' >> ${.TARGET}
15	echo '#define BUGURL "<http://bugs.dragonflybsd.org>"' >> ${.TARGET}
16	cat ${.ALLSRC:M*.c} >> ${.TARGET}
17
18bversion.h:
19	echo "#define BUILDING_GCC_MAJOR `echo $(GCCCOMPLETEVER) | sed -e 's/^\([0-9]*\).*$$/\1/'`" > ${.TARGET}
20	echo "#define BUILDING_GCC_MINOR `echo $(GCCCOMPLETEVER) | sed -e 's/^[0-9]*\.\([0-9]*\).*$$/\1/'`" >> ${.TARGET}
21	echo "#define BUILDING_GCC_PATCHLEVEL 1" >> ${.TARGET}
22	echo "#define BUILDING_GCC_VERSION (BUILDING_GCC_MAJOR * 1000 + BUILDING_GCC_MINOR)" >> ${.TARGET}
23
24plugin-version.h:
25	echo '#include "configargs.h"' > ${.TARGET}
26	echo "#define GCCPLUGIN_VERSION_MAJOR   `echo $(GCCCOMPLETEVER) | sed -e 's/^\([0-9]*\).*$$/\1/'`" >> ${.TARGET}
27	echo "#define GCCPLUGIN_VERSION_MINOR   `echo $(GCCCOMPLETEVER) | sed -e 's/^[0-9]*\.\([0-9]*\).*$$/\1/'`" >> ${.TARGET}
28	echo "#define GCCPLUGIN_VERSION_PATCHLEVEL   1" >> ${.TARGET}
29	echo "#define GCCPLUGIN_VERSION  (GCCPLUGIN_VERSION_MAJOR*1000 + GCCPLUGIN_VERSION_MINOR)" >> ${.TARGET}
30	echo 'static char basever[] = "${GCCCOMPLETEVER}";' >> ${.TARGET}
31	echo "static char datestamp[] = \"`echo ${GCCDATESTAMP} | sed -e 's/\.//g'`\";" >> ${.TARGET}
32	echo 'static char devphase[] = "release";' >> ${.TARGET}
33	echo 'static char revision[] = "";' >> ${.TARGET}
34	echo 'static struct plugin_gcc_version gcc_version = {basever,' >> ${.TARGET}
35	echo '   datestamp, devphase, revision, configuration_arguments};' >> ${.TARGET}
36
37configargs.h: Makefile
38	echo 'static const char configuration_arguments[] = '			> ${.TARGET}
39	echo '	"DragonFly/${TARGET_ARCH} system compiler (${LANGUAGES})";'	>> ${.TARGET}
40	echo 'static const char thread_model[] = "posix";'			>> ${.TARGET}
41	echo 'static const struct {'						>> ${.TARGET}
42	echo '  const char *name, *value;'					>> ${.TARGET}
43	echo '} configure_default_options[] ='					>> ${.TARGET}
44	echo '  { { "cpu", "generic" }, { "arch", "x86-64" } };'		>> ${.TARGET}
45
46bconfig.h:
47	echo '#ifndef GCC_BCONFIG_H'		>  ${.TARGET}
48	echo '#define GCC_BCONFIG_H'		>> ${.TARGET}
49	echo '#include "auto-host.h"'		>> ${.TARGET}
50	echo '#ifdef IN_GCC'			>> ${.TARGET}
51	echo '# include "ansidecl.h"'		>> ${.TARGET}
52	echo '#endif'				>> ${.TARGET}
53	echo '#endif /* GCC_BCONFIG_H */'	>> ${.TARGET}
54
55tm.h:
56	echo '#ifndef GCC_TM_H'			>  ${.TARGET}
57	echo '#define GCC_TM_H'			>> ${.TARGET}
58	echo '#ifndef LIBC_GLIBC'		>> ${.TARGET}
59	echo '# define LIBC_GLIBC 1'		>> ${.TARGET}
60	echo '#endif'				>> ${.TARGET}
61	echo '#ifndef LIBC_UCLIBC'		>> ${.TARGET}
62	echo '# define LIBC_UCLIBC 2'		>> ${.TARGET}
63	echo '#endif'				>> ${.TARGET}
64	echo '#ifndef LIBC_BIONIC'		>> ${.TARGET}
65	echo '# define LIBC_BIONIC 3'		>> ${.TARGET}
66	echo '#endif'				>> ${.TARGET}
67	echo '#ifndef LIBC_MUSL'		>> ${.TARGET}
68	echo '# define LIBC_MUSL 4'		>> ${.TARGET}
69	echo '#endif'				>> ${.TARGET}
70.if defined(REALLY_NOSHARED)
71	echo '#undef HAVE_LTO_PLUGIN'		>> ${.TARGET}
72	echo '#define HAVE_LTO_PLUGIN 0'	>> ${.TARGET}
73.endif
74	echo '#ifdef IN_GCC'			>> ${.TARGET}
75.for H in ${TARGET_INC:Ndefaults.h}
76	echo '# include "$H"'			>> ${.TARGET}
77.endfor
78	echo '#endif'				>> ${.TARGET}
79	echo '#if defined IN_GCC && !defined GENERATOR_FILE && !defined USED_FOR_TARGET' >> ${.TARGET}
80	echo '# include "insn-flags.h"'		>> ${.TARGET}
81	echo '#endif'				>> ${.TARGET}
82	echo '#if defined IN_GCC && !defined GENERATOR_FILE' >> ${.TARGET}
83	echo '# include "insn-modes.h"'		>> ${.TARGET}
84	echo '#endif'				>> ${.TARGET}
85	echo '# include "defaults.h"'		>> ${.TARGET}
86	echo '#endif /* GCC_TM_H */'		>> ${.TARGET}
87
88tm_p.h:
89	echo '#ifndef GCC_TM_P_H'			>  ${.TARGET}
90	echo '#define GCC_TM_P_H'			>> ${.TARGET}
91	echo '#ifdef IN_GCC'				>> ${.TARGET}
92	echo '# include "config/i386/i386-protos.h"'	>> ${.TARGET}
93	echo '# include "tm-preds.h"'			>> ${.TARGET}
94	echo '#endif'					>> ${.TARGET}
95	echo '#endif /* GCC_TM_P_H */'			>> ${.TARGET}
96
97specs.h:
98.for F in ${LANG_SPECS_FILES}
99	echo "#include \"${F}\"" >> ${.TARGET}
100.endfor
101
102all-tree.def:
103	echo '#include "tree.def"'		>> ${.TARGET}
104	echo 'END_OF_BASE_TREE_CODES'		>> ${.TARGET}
105	echo '#include "c-family/c-common.def"' >> ${.TARGET}
106	echo '#include "ada/gcc-interface/ada-tree.def"' >> ${.TARGET}
107	echo '#include "cp/cp-tree.def"'	>> ${.TARGET}
108	echo '#include "objc/objc-tree.def"'	>> ${.TARGET}
109
110optionlist: ${optionsfiles} Makefile
111	/usr/bin/awk -f ${GCCDIR}/gcc/opt-gather.awk \
112		${optionsfiles} > ${.TARGET}
113
114options.c: optionlist
115	/usr/bin/awk -f ${GCCDIR}/gcc/opt-functions.awk \
116		     -f ${GCCDIR}/gcc/opt-read.awk \
117		     -f ${GCCDIR}/gcc/optc-gen.awk \
118		     -v header_name="${header_name}" \
119		< optionlist > ${.TARGET}
120
121options-save.c: optionlist
122	/usr/bin/awk -f ${GCCDIR}/gcc/opt-functions.awk \
123		     -f ${GCCDIR}/gcc/opt-read.awk \
124		     -f ${GCCDIR}/gcc/optc-save-gen.awk \
125		     -v header_name="${header_name_save}" \
126		< optionlist > ${.TARGET}
127
128options.h: optionlist
129	/usr/bin/awk -f ${GCCDIR}/gcc/opt-functions.awk \
130		     -f ${GCCDIR}/gcc/opt-read.awk \
131		     -f ${GCCDIR}/gcc/opth-gen.awk \
132		< optionlist > ${.TARGET}
133
134i386-builtin-types.inc:
135	/usr/bin/awk -f ${GCCDIR}/gcc/config/i386/i386-builtin-types.awk \
136		${GCCDIR}/gcc/config/i386/i386-builtin-types.def > ${.TARGET}
137
138# head part of gengtype-lex.c
139gengtype-lex.head:
140	echo '#ifdef HOST_GENERATOR_FILE' > ${.TARGET}
141	echo '#include "config.h"'       >> ${.TARGET}
142	echo '#else'                     >> ${.TARGET}
143	echo '#include "bconfig.h"'      >> ${.TARGET}
144	echo '#endif'                    >> ${.TARGET}
145
146CLEANFILES+=	version.c configargs.h bconfig.h tm.h tm_p.h
147CLEANFILES+=	options.c options-save.c options.h optionlist
148CLEANFILES+=	specs.h all-tree.def bversion.h plugin-version.h
149
150# keep this order!
151afterdepend: version.c configargs.h bconfig.h tm.h tm_p.h options.h options.c
152afterdepend: options-save.c specs.h all-tree.def bversion.h plugin-version.h
153
154CLEANFILES+=	i386-builtin-types.inc gengtype-lex.head
155afterdepend:	i386-builtin-types.inc gengtype-lex.head
156
157.include <bsd.prog.mk>
158