Merge branch 'vendor/FILE'
[dragonfly.git] / gnu / usr.bin / cc80 / cc_prep / Makefile
1 .include "../Makefile.inc"
2 .include "../Makefile.langs"
3
4 CONTRIBDIR=     ${GCCDIR}/gcc
5
6 LANGUAGES=      c c++ LTO
7
8 version.c: ${CONTRIBDIR}/version.c Makefile ../Makefile.inc
9         rm -f ${.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 # NOTE: BUILDING_GCC_PATCHLEVEL is hardcoded to 1. Should not be used.
19 # Check gcc/cppbuiltin.c for GCC_VERSION and BUILDING_GCC_VERSION.
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 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 "#define GCCPLUGIN_VERSION_MAJOR   `echo $(GCCCOMPLETEVER) | sed -e 's/^\([0-9]*\).*$$/\1/'`" >> ${.TARGET}
30         echo "#define GCCPLUGIN_VERSION_MINOR   `echo $(GCCCOMPLETEVER) | sed -e 's/^[0-9]*\.\([0-9]*\).*$$/\1/'`" >> ${.TARGET}
31         echo "#define GCCPLUGIN_VERSION_PATCHLEVEL   1" >> ${.TARGET}
32         echo "#define GCCPLUGIN_VERSION  (GCCPLUGIN_VERSION_MAJOR*1000 + GCCPLUGIN_VERSION_MINOR)" >> ${.TARGET}
33         echo 'static char basever[] = "${GCCCOMPLETEVER}";' >> ${.TARGET}
34         echo "static char datestamp[] = \"`echo ${GCCDATESTAMP} | sed -e 's/\.//g'`\";" >> ${.TARGET}
35         echo 'static char devphase[] = "release";' >> ${.TARGET}
36         echo 'static char revision[] = "";' >> ${.TARGET}
37         echo 'static struct plugin_gcc_version gcc_version = {basever,' >> ${.TARGET}
38         echo '   datestamp, devphase, revision, configuration_arguments};' >> ${.TARGET}
39
40 configargs.h: Makefile
41         echo 'static const char configuration_arguments[] = '                   > ${.TARGET}
42         echo '  "DragonFly/${TARGET_ARCH} system compiler (${LANGUAGES})";'     >> ${.TARGET}
43         echo 'static const char thread_model[] = "posix";'                      >> ${.TARGET}
44         echo 'static const struct {'                                            >> ${.TARGET}
45         echo '  const char *name, *value;'                                      >> ${.TARGET}
46         echo '} configure_default_options[] ='                                  >> ${.TARGET}
47         echo '  { { "cpu", "generic" }, { "arch", "x86-64" } };'                >> ${.TARGET}
48
49 bconfig.h:
50         echo '#ifndef GCC_BCONFIG_H'            >  ${.TARGET}
51         echo '#define GCC_BCONFIG_H'            >> ${.TARGET}
52         echo '#include "auto-host.h"'           >> ${.TARGET}
53         echo '#ifdef IN_GCC'                    >> ${.TARGET}
54         echo '# include "ansidecl.h"'           >> ${.TARGET}
55         echo '#endif'                           >> ${.TARGET}
56         echo '#endif /* GCC_BCONFIG_H */'       >> ${.TARGET}
57
58 tm.h:
59         echo '#ifndef GCC_TM_H'                 >  ${.TARGET}
60         echo '#define GCC_TM_H'                 >> ${.TARGET}
61         echo '#ifndef LIBC_GLIBC'               >> ${.TARGET}
62         echo '# define LIBC_GLIBC 1'            >> ${.TARGET}
63         echo '#endif'                           >> ${.TARGET}
64         echo '#ifndef LIBC_UCLIBC'              >> ${.TARGET}
65         echo '# define LIBC_UCLIBC 2'           >> ${.TARGET}
66         echo '#endif'                           >> ${.TARGET}
67         echo '#ifndef LIBC_BIONIC'              >> ${.TARGET}
68         echo '# define LIBC_BIONIC 3'           >> ${.TARGET}
69         echo '#endif'                           >> ${.TARGET}
70         echo '#ifndef LIBC_MUSL'                >> ${.TARGET}
71         echo '# define LIBC_MUSL 4'             >> ${.TARGET}
72         echo '#endif'                           >> ${.TARGET}
73 .if defined(REALLY_NOSHARED)
74         echo '#undef HAVE_LTO_PLUGIN'           >> ${.TARGET}
75         echo '#define HAVE_LTO_PLUGIN 0'        >> ${.TARGET}
76 .endif
77         echo '#ifdef IN_GCC'                    >> ${.TARGET}
78 .for H in ${TARGET_INC:Ndefaults.h}
79         echo '# include "$H"'                   >> ${.TARGET}
80 .endfor
81         echo '#endif'                           >> ${.TARGET}
82         echo '#if defined IN_GCC && !defined GENERATOR_FILE && !defined USED_FOR_TARGET' >> ${.TARGET}
83         echo '# include "insn-flags.h"'         >> ${.TARGET}
84         echo '#endif'                           >> ${.TARGET}
85         echo '#if defined IN_GCC && !defined GENERATOR_FILE' >> ${.TARGET}
86         echo '# include "insn-modes.h"'         >> ${.TARGET}
87         echo '#endif'                           >> ${.TARGET}
88         echo '# include "defaults.h"'           >> ${.TARGET}
89         echo '#endif /* GCC_TM_H */'            >> ${.TARGET}
90
91 tm_p.h:
92         echo '#ifndef GCC_TM_P_H'                       >  ${.TARGET}
93         echo '#define GCC_TM_P_H'                       >> ${.TARGET}
94         echo '#ifdef IN_GCC'                            >> ${.TARGET}
95         echo '# include "config/i386/i386-protos.h"'    >> ${.TARGET}
96         echo '# include "tm-preds.h"'                   >> ${.TARGET}
97         echo '#endif'                                   >> ${.TARGET}
98         echo '#endif /* GCC_TM_P_H */'                  >> ${.TARGET}
99
100 specs.h:
101 .for F in ${LANG_SPECS_FILES}
102         echo "#include \"${F}\"" >> ${.TARGET}
103 .endfor
104
105 all-tree.def:
106         echo '#include "tree.def"'              >> ${.TARGET}
107         echo 'END_OF_BASE_TREE_CODES'           >> ${.TARGET}
108         echo '#include "c-family/c-common.def"' >> ${.TARGET}
109         echo '#include "ada/gcc-interface/ada-tree.def"' >> ${.TARGET}
110         echo '#include "cp/cp-tree.def"'        >> ${.TARGET}
111         echo '#include "objc/objc-tree.def"'    >> ${.TARGET}
112
113 optionlist: ${optionsfiles} Makefile
114         /usr/bin/awk -f ${GCCDIR}/gcc/opt-gather.awk \
115                 ${optionsfiles} > ${.TARGET}
116
117 options.c: optionlist
118         /usr/bin/awk -f ${GCCDIR}/gcc/opt-functions.awk \
119                      -f ${GCCDIR}/gcc/opt-read.awk \
120                      -f ${GCCDIR}/gcc/optc-gen.awk \
121                      -v header_name="${header_name}" \
122                 < optionlist > ${.TARGET}
123
124 options-save.c: optionlist
125         /usr/bin/awk -f ${GCCDIR}/gcc/opt-functions.awk \
126                      -f ${GCCDIR}/gcc/opt-read.awk \
127                      -f ${GCCDIR}/gcc/optc-save-gen.awk \
128                      -v header_name="${header_name_save}" \
129                 < optionlist > ${.TARGET}
130
131 options.h: optionlist
132         /usr/bin/awk -f ${GCCDIR}/gcc/opt-functions.awk \
133                      -f ${GCCDIR}/gcc/opt-read.awk \
134                      -f ${GCCDIR}/gcc/opth-gen.awk \
135                 < optionlist > ${.TARGET}
136
137 i386-builtin-types.inc:
138         /usr/bin/awk -f ${GCCDIR}/gcc/config/i386/i386-builtin-types.awk \
139                 ${GCCDIR}/gcc/config/i386/i386-builtin-types.def > ${.TARGET}
140
141 # head part of gengtype-lex.c
142 gengtype-lex.head:
143         echo '#ifdef HOST_GENERATOR_FILE' > ${.TARGET}
144         echo '#include "config.h"'       >> ${.TARGET}
145         echo '#else'                     >> ${.TARGET}
146         echo '#include "bconfig.h"'      >> ${.TARGET}
147         echo '#endif'                    >> ${.TARGET}
148
149 CLEANFILES+=    version.c configargs.h bconfig.h tm.h tm_p.h
150 CLEANFILES+=    options.c options-save.c options.h optionlist
151 CLEANFILES+=    specs.h all-tree.def bversion.h plugin-version.h
152
153 # keep this order!
154 afterdepend: version.c configargs.h bconfig.h tm.h tm_p.h options.h options.c
155 afterdepend: options-save.c specs.h all-tree.def bversion.h plugin-version.h
156
157 CLEANFILES+=    i386-builtin-types.inc gengtype-lex.head
158 afterdepend:    i386-builtin-types.inc gengtype-lex.head
159
160 .include <bsd.prog.mk>