f4f52b098754acb1120b3c5cba8d7abb2e630d29
[dragonfly.git] / gnu / usr.bin / cc41 / cc_prep / Makefile
1 # $DragonFly: src/gnu/usr.bin/cc41/cc_prep/Makefile,v 1.1 2006/09/27 12:10:33 corecode Exp $
2
3 .include "../Makefile.inc"
4 .include "../Makefile.langs"
5
6 PATCHES!=       echo ${.CURDIR}/patches/*.patch
7 CONTRIBDIR=     ${GCCDIR}/gcc
8
9 BASEVER_s!=     cat ${CONTRIBDIR}/BASE-VER
10
11 version.c: ${CONTRIBDIR}/version.c Makefile BASE-VER
12         > ${.TARGET}
13         echo '#define BASEVER "${BASEVER_s}"' >> ${.TARGET}
14         echo '#define DATESTAMP ""' >> ${.TARGET}
15         echo '#define DEVPHASE ""' >> ${.TARGET}
16         echo '#define VERSUFFIX " (DragonFly)"' >> ${.TARGET}
17         sed -e '/^#define VERSUFFIX/d' < ${.ALLSRC:M*c} >> ${.TARGET}
18
19 configargs.h: Makefile
20         echo '/* Generated automatically. */'           > ${.TARGET}
21         echo 'static const char configuration_arguments[] = '   >> ${.TARGET}
22         echo '  "DragonFly/${TARGET_ARCH} system compiler";'    >> ${.TARGET}
23         echo 'static const char thread_model[] = "posix";'      >> ${.TARGET}
24         echo                                            >> ${.TARGET}
25         echo 'static const struct {'                    >> ${.TARGET}
26         echo '  const char *name, *value;'              >> ${.TARGET}
27         echo '} configure_default_options[] ='          >> ${.TARGET}
28         echo '{ { NULL, NULL} };'                       >> ${.TARGET}
29
30 bconfig.h:
31         echo '#ifndef GCC_BCONFIG_H'                    > ${.TARGET}
32         echo '#define GCC_BCONFIG_H'                    >> ${.TARGET}
33         echo '#include "dragonfly-native.h"'            >> ${.TARGET}
34 .if exists(${GCCDIR}/gcc/config/${GCC_CPU}/${GCC_CPU}-modes.def)
35         echo '#define EXTRA_MODES_FILE "${GCC_CPU}/${GCC_CPU}-modes.def"' >> ${.TARGET}
36 .endif
37         echo '#ifdef IN_GCC'                            >> ${.TARGET}
38         echo '# include "ansidecl.h"'                   >> ${.TARGET}
39         echo '#endif'                                   >> ${.TARGET}
40         echo '#endif /* GCC_BCONFIG_H */'               >> ${.TARGET}
41
42 tm.h:
43         echo '#ifndef GCC_TM_H'                         > ${.TARGET}
44         echo '#define GCC_TM_H'                         >> ${.TARGET}
45 .if defined(TARGET_CPU_DEFAULT)
46         echo "#define TARGET_CPU_DEFAULT (${TARGET_CPU_DEFAULT})" >> ${.TARGET}
47 .endif
48         echo '#ifdef IN_GCC'                            >> ${.TARGET}
49 .for H in ${TARGET_INC}
50         echo '#include "$H"'                            >> ${.TARGET}
51 .endfor
52         echo '#if !defined GENERATOR_FILE && !defined USED_FOR_TARGET' >> ${.TARGET}
53         echo '# include "insn-constants.h"'             >> ${.TARGET}
54         echo '# include "insn-flags.h"'                 >> ${.TARGET}
55         echo '#endif'                                   >> ${.TARGET}
56         echo '#endif'                                   >> ${.TARGET}
57 #.if exists(${GCCDIR}/gcc/config/${GCC_CPU}/${GCC_CPU}-modes.def)
58 #       echo '#define EXTRA_MODES_FILE "${GCC_CPU}/${GCC_CPU}-modes.def"' >> ${.TARGET}
59 #.endif
60         echo '#endif /* GCC_TM_H */'                    >> ${.TARGET}
61
62 tm_p.h:
63         echo '#include "${GCC_CPU}/${GCC_CPU}-protos.h"'        >> ${.TARGET}
64         echo '#include "tm-preds.h"'                            >> ${.TARGET}
65
66 optionlist: ${optionsfiles} Makefile
67         /usr/bin/awk -f ${GCCDIR}/gcc/opt-gather.awk ${optionsfiles} > optionlist
68
69 options.c: optionlist
70         /usr/bin/awk -f ${GCCDIR}/gcc/opt-functions.awk -f ${GCCDIR}/gcc/optc-gen.awk \
71                 -v header_name="config.h system.h coretypes.h tm.h" < optionlist > options.c
72
73 options.h: optionlist
74         /usr/bin/awk -f ${GCCDIR}/gcc/opt-functions.awk -f ${GCCDIR}/gcc/opth-gen.awk \
75                 < optionlist > options.h
76
77 CLEANFILES+=    version.c configargs.h bconfig.h tm.h tm_p.h
78 CLEANFILES+=    options.c options.h optionlist
79
80 .include <bsd.prog.mk>
81
82 # keep this order!
83 depend: version.c configargs.h bconfig.h tm.h tm_p.h options.h options.c
84
85 # we don't use SRCS, so we can't use the normal bsd.dep.mk code
86 .for _PSRC in ${PATCHES:M*.patch}
87 .for _PC in ${_PSRC:T:S/.patch$//:S|,|/|g}
88
89 ${_PC}: ${CONTRIBDIR}/${_PC} ${_PSRC}
90         mkdir -p ${.TARGET:H}
91         patch -o ${.TARGET} -i ${.ALLSRC:M*.patch} ${CONTRIBDIR}/${.TARGET}
92
93 CLEANFILES:=    ${CLEANFILES} ${_PC}
94
95 depend: ${_PC}
96 .endfor
97 .endfor