Hook gcc 5.0 (pre-release) in build, unhook gcc 4.4
[dragonfly.git] / gnu / usr.bin / cc47 / cc_prep / Makefile
1 .include "../Makefile.inc"
2 .include "../Makefile.langs"
3
4 CONTRIBDIR=     ${GCCDIR}/gcc
5
6 LANG1=c
7 LANG2=, c++
8 LANG3=, objc
9 LANG4=, LTO
10
11 version.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
21 bversion.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
27 plugin-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
43 configargs.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
54 bconfig.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
63 tm.h:
64         echo '#ifndef GCC_TM_H'                         > ${.TARGET}
65         echo '#define GCC_TM_H'                         >> ${.TARGET}
66         echo '#ifdef IN_GCC'                            >> ${.TARGET}
67 .for H in ${TARGET_INC}
68         echo '# include "$H"'                           >> ${.TARGET}
69 .endfor
70         echo '#if !defined GENERATOR_FILE && !defined USED_FOR_TARGET' >> ${.TARGET}
71         echo '# include "insn-constants.h"'             >> ${.TARGET}
72         echo '# include "insn-flags.h"'                 >> ${.TARGET}
73         echo '#endif'                                   >> ${.TARGET}
74         echo '#endif'                                   >> ${.TARGET}
75         echo '# include "defaults.h"'                   >> ${.TARGET}
76         echo '#endif /* GCC_TM_H */'                    >> ${.TARGET}
77
78 tm_p.h:
79         echo '#ifndef GCC_TM_P_H'                       > ${.TARGET}
80         echo '#define GCC_TM_P_H'                       >> ${.TARGET}
81         echo '#ifdef IN_GCC'                            >> ${.TARGET}
82         echo '# include "config/${GCC_CPU}/${GCC_CPU}-protos.h"'        >> ${.TARGET}
83         echo '# include "tm-preds.h"'                   >> ${.TARGET}
84         echo '#endif'                                   >> ${.TARGET}
85         echo '#endif /* GCC_TM_P_H */'                  >> ${.TARGET}
86
87 optionlist: ${optionsfiles} Makefile
88         /usr/bin/awk -f ${GCCDIR}/gcc/opt-gather.awk \
89                 ${optionsfiles} > optionlist
90
91 options.c: optionlist
92         /usr/bin/awk -f ${GCCDIR}/gcc/opt-functions.awk \
93                      -f ${GCCDIR}/gcc/opt-read.awk \
94                      -f ${GCCDIR}/gcc/optc-gen.awk \
95                      -v header_name="config.h system.h coretypes.h tm.h" \
96                 < optionlist > ${.TARGET}
97
98 options-save.c: optionlist
99         /usr/bin/awk -f ${GCCDIR}/gcc/opt-functions.awk \
100                      -f ${GCCDIR}/gcc/opt-read.awk \
101                      -f ${GCCDIR}/gcc/optc-save-gen.awk \
102                      -v header_name="config.h system.h coretypes.h tm.h" \
103                 < optionlist > ${.TARGET}
104
105 options.h: optionlist
106         /usr/bin/awk -f ${GCCDIR}/gcc/opt-functions.awk \
107                      -f ${GCCDIR}/gcc/opt-read.awk \
108                      -f ${GCCDIR}/gcc/opth-gen.awk \
109                 < optionlist > ${.TARGET}
110
111 i386-builtin-types.inc:
112         /usr/bin/awk -f ${GCCDIR}/gcc/config/i386/i386-builtin-types.awk \
113                         ${GCCDIR}/gcc/config/i386/i386-builtin-types.def \
114                 > ${.TARGET}
115
116 specs.h:
117         rm -f ${.TARGET}
118         touch ${.TARGET}
119 .for F in ${LANG_SPECS_FILES}
120         echo "#include \"${F}\"" >> ${.TARGET}
121 .endfor
122
123 all-tree.def:
124         rm -f ${.TARGET}
125         echo '#include "tree.def"' >> ${.TARGET}
126         echo 'END_OF_BASE_TREE_CODES' >> ${.TARGET}
127         echo '#include "c-family/c-common.def"' >> ${.TARGET}
128 .for F in ${lang_tree_files}
129         echo '#include "$F"' >> ${.TARGET}
130 .endfor
131
132 CLEANFILES+=    version.c configargs.h bconfig.h tm.h tm_p.h
133 CLEANFILES+=    options.c options-save.c options.h optionlist
134 CLEANFILES+=    specs.h all-tree.def bversion.h plugin-version.h
135
136 # keep this order!
137 afterdepend: version.c configargs.h bconfig.h tm.h tm_p.h options.h options.c
138 afterdepend: options-save.c specs.h all-tree.def bversion.h plugin-version.h
139
140 .if ${TARGET_ARCH} == "i386" || ${TARGET_ARCH} == "x86_64"
141 CLEANFILES+=    i386-builtin-types.inc
142 afterdepend:    i386-builtin-types.inc
143 .endif
144
145 .include <bsd.prog.mk>