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