Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
[dragonfly.git] / gnu / usr.bin / cc34 / cc_prep / Makefile
1 # $DragonFly: src/gnu/usr.bin/cc34/cc_prep/Makefile,v 1.8 2005/10/01 12:40:33 corecode Exp $
2
3 .include "../Makefile.inc"
4
5 PATCHES!=       echo ${.CURDIR}/patches/*.patch
6 CONTRIBDIR=     ${GCCDIR}/gcc
7
8 version_local.c: version.c Makefile
9         sed -e 's/\(const char version.*\)";/\1 [DragonFly] (propolice, visibility)";/' < ${.ALLSRC:M*c} > ${.TARGET}
10
11 configargs.h: Makefile
12         echo '/* Generated automatically. */'           > ${.TARGET}
13         echo 'static const char configuration_arguments[] = '   >> ${.TARGET}
14         echo '  "DragonFly/${TARGET_ARCH} system compiler";'    >> ${.TARGET}
15         echo 'static const char thread_model[] = "posix";'      >> ${.TARGET}
16         echo                                            >> ${.TARGET}
17         echo 'static const struct {'                    >> ${.TARGET}
18         echo '  const char *name, *value;'              >> ${.TARGET}
19         echo '} configure_default_options[] ='          >> ${.TARGET}
20         echo '{ { NULL, NULL} };'                       >> ${.TARGET}
21
22 bconfig.h:
23         echo '#ifndef GCC_BCONFIG_H'                    > ${.TARGET}
24         echo '#define GCC_BCONFIG_H'                    >> ${.TARGET}
25         echo '#include "dragonfly-native.h"'            >> ${.TARGET}
26 .if exists(${GCCDIR}/gcc/config/${GCC_CPU}/${GCC_CPU}-modes.def)
27         echo '#define EXTRA_MODES_FILE "${GCC_CPU}/${GCC_CPU}-modes.def"' >> ${.TARGET}
28 .endif
29         echo '#ifdef IN_GCC'                            >> ${.TARGET}
30         echo '# include "ansidecl.h"'                   >> ${.TARGET}
31         echo '#endif'                                   >> ${.TARGET}
32         echo '#endif /* GCC_BCONFIG_H */'               >> ${.TARGET}
33
34 tm.h:
35         echo '#ifndef GCC_TM_H'                         > ${.TARGET}
36         echo '#define GCC_TM_H'                         >> ${.TARGET}
37 .if defined(TARGET_CPU_DEFAULT)
38         echo "#define TARGET_CPU_DEFAULT (${TARGET_CPU_DEFAULT})" >> ${.TARGET}
39 .endif
40         echo '#ifdef IN_GCC'                            >> ${.TARGET}
41 .for H in ${TARGET_INC}
42         echo '#include "$H"'                            >> ${.TARGET}
43 .endfor
44         echo '#if !defined GENERATOR_FILE && !defined USED_FOR_TARGET' >> ${.TARGET}
45         echo '# include "insn-constants.h"'             >> ${.TARGET}
46         echo '# include "insn-flags.h"'                 >> ${.TARGET}
47         echo '#endif'                                   >> ${.TARGET}
48         echo '#endif'                                   >> ${.TARGET}
49 .if exists(${GCCDIR}/gcc/config/${GCC_CPU}/${GCC_CPU}-modes.def)
50         echo '#define EXTRA_MODES_FILE "${GCC_CPU}/${GCC_CPU}-modes.def"' >> ${.TARGET}
51 .endif
52         echo '#endif /* GCC_TM_H */'                    >> ${.TARGET}
53
54 tm_p.h:
55         echo '#include "${GCC_CPU}/${GCC_CPU}-protos.h"'        >> ${.TARGET}
56         echo '#include "tm-preds.h"'                            >> ${.TARGET}
57
58
59 CLEANFILES+=    version_local.c configargs.h bconfig.h tm.h tm_p.h
60
61 .include <bsd.prog.mk>
62
63 # keep this order!
64 depend: version_local.c configargs.h bconfig.h tm.h tm_p.h
65
66 # we don't use SRCS, so we can't use the normal bsd.dep.mk code
67 .for _PSRC in ${PATCHES:M*.patch}
68 .for _PC in ${_PSRC:T:S/.patch$//:S|,|/|g}
69
70 ${_PC}: ${CONTRIBDIR}/${_PC} ${_PSRC}
71         mkdir -p ${.TARGET:H}
72         patch -o ${.TARGET} -i ${.ALLSRC:M*.patch} ${CONTRIBDIR}/${.TARGET}
73
74 CLEANFILES:=    ${CLEANFILES} ${_PC}
75
76 depend: ${_PC}
77 .endfor
78 .endfor