Fold patches into contrib.
[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 CONTRIBDIR=     ${GCCDIR}/gcc
7
8 BASEVER_s!=     cat ${CONTRIBDIR}/BASE-VER
9
10 version.c: ${CONTRIBDIR}/version.c Makefile BASE-VER
11         > ${.TARGET}
12         echo '#define BASEVER "${BASEVER_s}"' >> ${.TARGET}
13         echo '#define DATESTAMP ""' >> ${.TARGET}
14         echo '#define DEVPHASE ""' >> ${.TARGET}
15         echo '#define VERSUFFIX " (DragonFly)"' >> ${.TARGET}
16         sed -e '/^#define VERSUFFIX/d' < ${.ALLSRC:M*c} >> ${.TARGET}
17
18 configargs.h: Makefile
19         echo '/* Generated automatically. */'           > ${.TARGET}
20         echo 'static const char configuration_arguments[] = '   >> ${.TARGET}
21         echo '  "DragonFly/${TARGET_ARCH} system compiler";'    >> ${.TARGET}
22         echo 'static const char thread_model[] = "posix";'      >> ${.TARGET}
23         echo                                            >> ${.TARGET}
24         echo 'static const struct {'                    >> ${.TARGET}
25         echo '  const char *name, *value;'              >> ${.TARGET}
26         echo '} configure_default_options[] ='          >> ${.TARGET}
27         echo '{ { NULL, NULL} };'                       >> ${.TARGET}
28
29 bconfig.h:
30         echo '#ifndef GCC_BCONFIG_H'                    > ${.TARGET}
31         echo '#define GCC_BCONFIG_H'                    >> ${.TARGET}
32         echo '#include "dragonfly-native.h"'            >> ${.TARGET}
33 .if exists(${GCCDIR}/gcc/config/${GCC_CPU}/${GCC_CPU}-modes.def)
34         echo '#define EXTRA_MODES_FILE "${GCC_CPU}/${GCC_CPU}-modes.def"' >> ${.TARGET}
35 .endif
36         echo '#ifdef IN_GCC'                            >> ${.TARGET}
37         echo '# include "ansidecl.h"'                   >> ${.TARGET}
38         echo '#endif'                                   >> ${.TARGET}
39         echo '#endif /* GCC_BCONFIG_H */'               >> ${.TARGET}
40
41 tm.h:
42         echo '#ifndef GCC_TM_H'                         > ${.TARGET}
43         echo '#define GCC_TM_H'                         >> ${.TARGET}
44 .if defined(TARGET_CPU_DEFAULT)
45         echo "#define TARGET_CPU_DEFAULT (${TARGET_CPU_DEFAULT})" >> ${.TARGET}
46 .endif
47         echo '#ifdef IN_GCC'                            >> ${.TARGET}
48 .for H in ${TARGET_INC}
49         echo '#include "$H"'                            >> ${.TARGET}
50 .endfor
51         echo '#if !defined GENERATOR_FILE && !defined USED_FOR_TARGET' >> ${.TARGET}
52         echo '# include "insn-constants.h"'             >> ${.TARGET}
53         echo '# include "insn-flags.h"'                 >> ${.TARGET}
54         echo '#endif'                                   >> ${.TARGET}
55         echo '#endif'                                   >> ${.TARGET}
56 #.if exists(${GCCDIR}/gcc/config/${GCC_CPU}/${GCC_CPU}-modes.def)
57 #       echo '#define EXTRA_MODES_FILE "${GCC_CPU}/${GCC_CPU}-modes.def"' >> ${.TARGET}
58 #.endif
59         echo '#endif /* GCC_TM_H */'                    >> ${.TARGET}
60
61 tm_p.h:
62         echo '#include "${GCC_CPU}/${GCC_CPU}-protos.h"'        >> ${.TARGET}
63         echo '#include "tm-preds.h"'                            >> ${.TARGET}
64
65 optionlist: ${optionsfiles} Makefile
66         /usr/bin/awk -f ${GCCDIR}/gcc/opt-gather.awk ${optionsfiles} > optionlist
67
68 options.c: optionlist
69         /usr/bin/awk -f ${GCCDIR}/gcc/opt-functions.awk -f ${GCCDIR}/gcc/optc-gen.awk \
70                 -v header_name="config.h system.h coretypes.h tm.h" < optionlist > options.c
71
72 options.h: optionlist
73         /usr/bin/awk -f ${GCCDIR}/gcc/opt-functions.awk -f ${GCCDIR}/gcc/opth-gen.awk \
74                 < optionlist > options.h
75
76 CLEANFILES+=    version.c configargs.h bconfig.h tm.h tm_p.h
77 CLEANFILES+=    options.c options.h optionlist
78
79 .include <bsd.prog.mk>
80
81 # keep this order!
82 depend: version.c configargs.h bconfig.h tm.h tm_p.h options.h options.c