gcc50: Bring in makefiles but leave them unhooked
[dragonfly.git] / gnu / usr.bin / cc50 / cc_prep / Makefile
1 .include "../Makefile.inc"
2 .include "../Makefile.langs"
3
4 CONTRIBDIR=     ${GCCDIR}/gcc
5
6 LANGUAGES=      c c++ objc LTO
7
8 version.c: ${CONTRIBDIR}/version.c Makefile ../Makefile.inc
9         > ${.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
18 bversion.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 `echo $(GCCCOMPLETEVER) | sed -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\)$$/\1/'`" >> ${.TARGET}
22         echo "#define BUILDING_GCC_VERSION (BUILDING_GCC_MAJOR * 1000 + BUILDING_GCC_MINOR)" >> ${.TARGET}
23
24 plugin-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   `echo $(GCCCOMPLETEVER) | sed -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\)$$/\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
37 configargs.h: Makefile
38         echo 'static const char configuration_arguments[] = '   >> ${.TARGET}
39         echo '  "DragonFly/${TARGET_ARCH} system compiler (${LANGUAGES}${LANG3}${LANG4})";'     >> ${.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" } };'              >> ${.TARGET}
45
46 bconfig.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'                   >> ${.TARGET}
54
55 tm.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 '#ifdef IN_GCC'            >> ${.TARGET}
68 .for H in ${TARGET_INC}
69         echo '# include "$H"'           >> ${.TARGET}
70 .endfor
71         echo '#endif'                   >> ${.TARGET}
72         echo '#if defined IN_GCC && !defined GENERATOR_FILE && !defined USED_FOR_TARGET' >> ${.TARGET}
73         echo '# include "insn-flags.h"' >> ${.TARGET}
74         echo '#endif'                   >> ${.TARGET}
75         echo '#if defined IN_GCC && !defined GENERATOR_FILE' >> ${.TARGET}
76         echo '# include "insn-modes.h"' >> ${.TARGET}
77         echo '#endif'                   >> ${.TARGET}
78         echo '#if defined IN_GCC && defined GENERATOR_FILE && !defined BITS_PER_UNIT' >> ${.TARGET}
79         echo '#include "machmode.h"'    >> ${.TARGET}
80         echo '#endif'                   >> ${.TARGET}
81         echo '# include "defaults.h"'   >> ${.TARGET}
82         echo '#endif'                   >> ${.TARGET}
83
84 tm_p.h:
85         echo '#ifndef GCC_TM_P_H'                       >  ${.TARGET}
86         echo '#define GCC_TM_P_H'                       >> ${.TARGET}
87         echo '#ifdef IN_GCC'                            >> ${.TARGET}
88         echo '# include "config/i386/i386-protos.h"'    >> ${.TARGET}
89         echo '# include "tm-preds.h"'                   >> ${.TARGET}
90         echo '#endif'                                   >> ${.TARGET}
91         echo '#endif'                                   >> ${.TARGET}
92
93 specs.h:
94 .for F in ${LANG_SPECS_FILES}
95         echo "#include \"${F}\"" >> ${.TARGET}
96 .endfor
97
98 all-tree.def:
99         echo '#include "tree.def"'              >> ${.TARGET}
100         echo 'END_OF_BASE_TREE_CODES'           >> ${.TARGET}
101         echo '#include "c-family/c-common.def"' >> ${.TARGET}
102         echo '#include "cp/cp-tree.def"'        >> ${.TARGET}
103         echo '#include "objc/objc-tree.def"'    >> ${.TARGET}
104
105 optionlist: ${optionsfiles} Makefile
106         /usr/bin/awk -f ${GCCDIR}/gcc/opt-gather.awk \
107                 ${optionsfiles} > ${.TARGET}
108
109 options.c: optionlist
110         /usr/bin/awk -f ${GCCDIR}/gcc/opt-functions.awk \
111                      -f ${GCCDIR}/gcc/opt-read.awk \
112                      -f ${GCCDIR}/gcc/optc-gen.awk \
113                      -v header_name="${header_name_save}" \
114                 < optionlist > ${.TARGET}
115
116 options-save.c: optionlist
117         /usr/bin/awk -f ${GCCDIR}/gcc/opt-functions.awk \
118                      -f ${GCCDIR}/gcc/opt-read.awk \
119                      -f ${GCCDIR}/gcc/optc-save-gen.awk \
120                      -v header_name="${header_name}" \
121                 < optionlist > ${.TARGET}
122
123 options.h: optionlist
124         /usr/bin/awk -f ${GCCDIR}/gcc/opt-functions.awk \
125                      -f ${GCCDIR}/gcc/opt-read.awk \
126                      -f ${GCCDIR}/gcc/opth-gen.awk \
127                 < optionlist > ${.TARGET}
128
129 i386-builtin-types.inc:
130         /usr/bin/awk -f ${GCCDIR}/gcc/config/i386/i386-builtin-types.awk \
131                 ${GCCDIR}/gcc/config/i386/i386-builtin-types.def > ${.TARGET}
132
133 CLEANFILES+=    version.c configargs.h bconfig.h tm.h tm_p.h
134 CLEANFILES+=    options.c options-save.c options.h optionlist
135 CLEANFILES+=    specs.h all-tree.def bversion.h plugin-version.h
136
137 # keep this order!
138 afterdepend: version.c configargs.h bconfig.h tm.h tm_p.h options.h options.c
139 afterdepend: options-save.c specs.h all-tree.def bversion.h plugin-version.h
140
141 CLEANFILES+=    i386-builtin-types.inc
142 afterdepend:    i386-builtin-types.inc
143
144 .include <bsd.prog.mk>