]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - gnu/usr.bin/cc/cc_tools/Makefile.hdrs
Follow-up r297842: Rework header generation to fix always rebuilding.
[FreeBSD/FreeBSD.git] / gnu / usr.bin / cc / cc_tools / Makefile.hdrs
1 # $FreeBSD$
2 #
3 # This is logic for common headers shared inside of gnu/lib.  It used to
4 # live in gnu/usr.bin/cc/cc_tools/Makefile.
5
6 .if !defined(TARGET_CPUARCH) || !defined(GCC_CPU)
7 .error ${.CURDIR}: Must include gnu/usr.bin/cc/Makefile.tgt first.
8 .endif
9
10 #
11 # The list of headers to go into tm.h
12 #
13 TARGET_INC+=    options.h
14 .if ${TARGET_CPUARCH} == "amd64"
15 TARGET_INC+=    i386/biarch64.h
16 .endif
17 .if ${TARGET_CPUARCH} != "arm"
18 TARGET_INC+=    ${GCC_CPU}/${GCC_CPU}.h
19 .endif
20 .if ${TARGET_CPUARCH} == "i386" || ${TARGET_CPUARCH} == "amd64"
21 TARGET_INC+=    ${GCC_CPU}/unix.h
22 TARGET_INC+=    ${GCC_CPU}/att.h
23 .endif
24 TARGET_INC+=    dbxelf.h
25 TARGET_INC+=    elfos-undef.h
26 TARGET_INC+=    elfos.h
27 TARGET_INC+=    freebsd-native.h
28 TARGET_INC+=    freebsd-spec.h
29 TARGET_INC+=    freebsd.h
30 .if ${TARGET_CPUARCH} != "i386" && ${TARGET_CPUARCH} != "amd64"
31 . if exists(${GCCDIR}/config/${GCC_CPU}/sysv4.h)
32 TARGET_INC+=    ${GCC_CPU}/sysv4.h
33 . endif
34 .endif
35 .if ${TARGET_CPUARCH} == "amd64"
36 TARGET_INC+=    ${GCC_CPU}/x86-64.h
37 .endif
38 .if ${TARGET_CPUARCH} == "arm" || ${TARGET_CPUARCH} == "mips"
39 TARGET_INC+=    ${GCC_CPU}/elf.h
40 .endif
41 .if ${TARGET_CPUARCH} == "arm"
42 TARGET_INC+=    ${GCC_CPU}/aout.h
43 TARGET_INC+=    ${GCC_CPU}/bpabi.h
44 .endif
45 .if ${TARGET_ARCH} == "powerpc64"
46 TARGET_INC+=    ${GCC_CPU}/biarch64.h
47 TARGET_INC+=    ${GCC_CPU}/default64.h
48 .endif
49 TARGET_INC+=    ${GCC_CPU}/freebsd.h
50 .if ${TARGET_CPUARCH} == "amd64"
51 TARGET_INC+=    ${GCC_CPU}/freebsd64.h
52 .endif
53 .if ${TARGET_CPUARCH} == "arm"
54 TARGET_INC+=    ${GCC_CPU}/arm.h
55 .endif
56 TARGET_INC+=    defaults.h
57
58 #
59 # Option files.
60 #
61 OPT_FILES=      c.opt common.opt
62
63 .if exists(${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}.opt)
64 OPT_FILES+=     ${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}.opt
65 .endif
66
67 .if exists(${.CURDIR}/${GCC_CPU}-freebsd.opt)
68 OPT_FILES+=     ${.CURDIR}/${GCC_CPU}-freebsd.opt
69 .endif
70
71 .if ${TARGET_CPUARCH} == "powerpc"
72 OPT_FILES+=     ${GCCDIR}/config/${GCC_CPU}/sysv4.opt
73 .endif
74
75 .if ${TARGET_CPUARCH} == "sparc64"
76 OPT_FILES+=     ${GCCDIR}/config/${GCC_CPU}/long-double-switch.opt
77 .endif
78
79 .if exists(${.CURDIR}/freebsd.opt)
80 OPT_FILES+=     ${.CURDIR}/freebsd.opt
81 .endif
82
83
84 # Options
85 optionlist: ${OPT_FILES}
86         LC_ALL=C awk -f ${GCCDIR}/opt-gather.awk ${.ALLSRC} > ${.TARGET}
87
88 options.h:      optionlist
89         LC_ALL=C awk -f ${GCCDIR}/opt-functions.awk \
90             -f ${GCCDIR}/opth-gen.awk \
91                 < ${.ALLSRC} > ${.TARGET}
92
93 options.c:      optionlist
94         LC_ALL=C awk -f ${GCCDIR}/opt-functions.awk \
95             -f ${GCCDIR}/optc-gen.awk \
96                 -v header_name="config.h system.h coretypes.h tm.h" \
97                 < ${.ALLSRC} > ${.TARGET}
98
99 # Target machine config
100 tm.h:
101         TARGET_CPU_DEFAULT="${TARGET_CPU_DEFAULT}" \
102         HEADERS="${TARGET_INC}" \
103         DEFINES="" \
104         /bin/sh ${GCCDIR}/mkconfig.sh ${.TARGET}
105 .if exists(${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}-modes.def)
106         echo '#define EXTRA_MODES_FILE "${GCC_CPU}/${GCC_CPU}-modes.def"' >> ${.TARGET}
107 .endif
108
109 # tconfig.h
110 tconfig.h:
111         TARGET_CPU_DEFAULT="${TARGET_CPU_DEFAULT}" \
112         HEADERS="auto-host.h ansidecl.h" \
113         DEFINES="USED_FOR_TARGET" \
114         /bin/sh ${GCCDIR}/mkconfig.sh ${.TARGET}
115
116 # Version header for gcov
117 gcov-iov.h:
118         echo "#define GCOV_VERSION ((gcov_unsigned_t)0x34303270)" >> ${.TARGET}
119
120 # Linked headers
121 gthr-default.h: ${GCCDIR}/gthr-posix.h .NOMETA
122         ln -sf ${.ALLSRC} ${.TARGET}
123
124 .if ${TARGET_CPUARCH} == "arm"
125 unwind.h: ${GCCDIR}/config/arm/unwind-arm.h
126 .else
127 unwind.h: ${GCCDIR}/unwind-generic.h
128 .endif
129
130 unwind.h: .NOMETA
131         ln -sf ${.ALLSRC} ${.TARGET}
132