xref: /dragonfly/gnu/usr.bin/cc47/cc_prep/Makefile (revision d4ef6694)
1.include "../Makefile.inc"
2.include "../Makefile.langs"
3
4CONTRIBDIR=	${GCCDIR}/gcc
5
6LANG1=c
7.if !defined(NO_CXX)
8LANG2=, c++
9.endif
10.if !defined(NO_OBJC)
11LANG3=, objc
12.endif
13LANG4=, LTO
14
15version.c: ${CONTRIBDIR}/version.c Makefile ../Makefile.inc
16	> ${.TARGET}
17	echo '#define BASEVER "${GCCCOMPLETEVER}"' >> ${.TARGET}
18	echo '#define DATESTAMP ""' >> ${.TARGET}
19	echo '#define DEVPHASE ""' >> ${.TARGET}
20	echo '#define REVISION " [DragonFly] Release/${GCCDATESTAMP}"' >> ${.TARGET}
21	echo '#define PKGVERSION ""' >> ${.TARGET}
22	echo '#define BUGURL "<http://bugs.dragonflybsd.org>"' >> ${.TARGET}
23	cat ${.ALLSRC:M*.c} >> ${.TARGET}
24
25bversion.h:
26	echo "#define BUILDING_GCC_MAJOR `echo $(GCCCOMPLETEVER) | sed -e 's/^\([0-9]*\).*$$/\1/'`" > ${.TARGET}
27	echo "#define BUILDING_GCC_MINOR `echo $(GCCCOMPLETEVER) | sed -e 's/^[0-9]*\.\([0-9]*\).*$$/\1/'`" >> ${.TARGET}
28	echo "#define BUILDING_GCC_PATCHLEVEL `echo $(GCCCOMPLETEVER) | sed -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\)$$/\1/'`" >> ${.TARGET}
29	echo "#define BUILDING_GCC_VERSION (BUILDING_GCC_MAJOR * 1000 + BUILDING_GCC_MINOR)" >> ${.TARGET}
30
31plugin-version.h:
32	echo '#include "configargs.h"' > ${.TARGET}
33	echo >> ${.TARGET}
34	echo "#define GCCPLUGIN_VERSION_MAJOR   `echo $(GCCCOMPLETEVER) | sed -e 's/^\([0-9]*\).*$$/\1/'`" >> ${.TARGET}
35	echo "#define GCCPLUGIN_VERSION_MINOR   `echo $(GCCCOMPLETEVER) | sed -e 's/^[0-9]*\.\([0-9]*\).*$$/\1/'`" >> ${.TARGET}
36	echo "#define GCCPLUGIN_VERSION_PATCHLEVEL   `echo $(GCCCOMPLETEVER) | sed -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\)$$/\1/'`" >> ${.TARGET}
37	echo "#define GCCPLUGIN_VERSION  (GCCPLUGIN_VERSION_MAJOR*1000 + GCCPLUGIN_VERSION_MINOR)" >> ${.TARGET}
38	echo >> ${.TARGET}
39	echo 'static char basever[] = "${GCCCOMPLETEVER}";' >> ${.TARGET}
40	echo "static char datestamp[] = \"`echo ${GCCDATESTAMP} | sed -e 's/\.//g'`\";" >> ${.TARGET}
41	echo 'static char devphase[] = "release";' >> ${.TARGET}
42	echo 'static char revision[] = "";' >> ${.TARGET}
43	echo >> ${.TARGET}
44	echo 'static struct plugin_gcc_version gcc_version = {basever, datestamp,' >> ${.TARGET}
45	echo '  devphase, revision, configuration_arguments};' >> ${.TARGET}
46
47configargs.h: Makefile
48	echo '/* Generated automatically. */'		> ${.TARGET}
49	echo 'static const char configuration_arguments[] = '	>> ${.TARGET}
50	echo '	"DragonFly/${TARGET_ARCH} system compiler (${LANG1}${LANG2}${LANG3}${LANG4})";'	>> ${.TARGET}
51	echo 'static const char thread_model[] = "posix";'	>> ${.TARGET}
52	echo						>> ${.TARGET}
53	echo 'static const struct {'			>> ${.TARGET}
54	echo '  const char *name, *value;'		>> ${.TARGET}
55	echo '} configure_default_options[] ='		>> ${.TARGET}
56	echo '{ { NULL, NULL} };'			>> ${.TARGET}
57
58bconfig.h:
59	echo '#ifndef GCC_BCONFIG_H'			> ${.TARGET}
60	echo '#define GCC_BCONFIG_H'			>> ${.TARGET}
61	echo '#include "auto-host.h"'			>> ${.TARGET}
62	echo '#ifdef IN_GCC'				>> ${.TARGET}
63	echo '# include "ansidecl.h"'			>> ${.TARGET}
64	echo '#endif'					>> ${.TARGET}
65	echo '#endif /* GCC_BCONFIG_H */'		>> ${.TARGET}
66
67tm.h:
68	echo '#ifndef GCC_TM_H'				> ${.TARGET}
69	echo '#define GCC_TM_H'				>> ${.TARGET}
70	echo '#ifdef IN_GCC'				>> ${.TARGET}
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