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