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.
6 .if !defined(TARGET_CPUARCH) || !defined(GCC_CPU)
7 .error ${.CURDIR}: Must include gnu/usr.bin/cc/Makefile.tgt first.
11 # The list of headers to go into tm.h
13 TARGET_INC+= options.h
14 .if ${TARGET_CPUARCH} == "amd64"
15 TARGET_INC+= i386/biarch64.h
17 .if ${TARGET_CPUARCH} != "arm"
18 TARGET_INC+= ${GCC_CPU}/${GCC_CPU}.h
20 .if ${TARGET_CPUARCH} == "i386" || ${TARGET_CPUARCH} == "amd64"
21 TARGET_INC+= ${GCC_CPU}/unix.h
22 TARGET_INC+= ${GCC_CPU}/att.h
24 .if ${TARGET_CPUARCH} == "powerpc"
25 TARGET_INC+= ${GCC_CPU}/secureplt.h
28 TARGET_INC+= elfos-undef.h
30 TARGET_INC+= freebsd-native.h
31 TARGET_INC+= freebsd-spec.h
32 TARGET_INC+= freebsd.h
33 .if ${TARGET_CPUARCH} != "i386" && ${TARGET_CPUARCH} != "amd64"
34 . if exists(${GCCDIR}/config/${GCC_CPU}/sysv4.h)
35 TARGET_INC+= ${GCC_CPU}/sysv4.h
38 .if ${TARGET_CPUARCH} == "amd64"
39 TARGET_INC+= ${GCC_CPU}/x86-64.h
41 .if ${TARGET_CPUARCH} == "arm" || ${TARGET_CPUARCH} == "mips"
42 TARGET_INC+= ${GCC_CPU}/elf.h
44 .if ${TARGET_CPUARCH} == "arm"
45 TARGET_INC+= ${GCC_CPU}/aout.h
46 TARGET_INC+= ${GCC_CPU}/bpabi.h
48 .if ${TARGET_ARCH} == "powerpc64"
49 TARGET_INC+= ${GCC_CPU}/biarch64.h
50 TARGET_INC+= ${GCC_CPU}/default64.h
52 .if ${TARGET_ARCH} == "powerpcspe"
53 TARGET_INC+= ${GCC_CPU}/freebsdspe.h
54 TARGET_INC+= ${GCC_CPU}/e500-double.h
56 TARGET_INC+= ${GCC_CPU}/freebsd.h
57 .if ${TARGET_CPUARCH} == "amd64"
58 TARGET_INC+= ${GCC_CPU}/freebsd64.h
60 .if ${TARGET_CPUARCH} == "arm"
61 TARGET_INC+= ${GCC_CPU}/arm.h
63 TARGET_INC+= defaults.h
68 OPT_FILES= c.opt common.opt
70 .if exists(${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}.opt)
71 OPT_FILES+= ${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}.opt
74 .if exists(${.CURDIR}/${GCC_CPU}-freebsd.opt)
75 OPT_FILES+= ${.CURDIR}/${GCC_CPU}-freebsd.opt
78 .if ${TARGET_CPUARCH} == "powerpc"
79 OPT_FILES+= ${GCCDIR}/config/${GCC_CPU}/sysv4.opt
82 .if ${TARGET_CPUARCH} == "sparc64"
83 OPT_FILES+= ${GCCDIR}/config/${GCC_CPU}/long-double-switch.opt
86 .if exists(${.CURDIR}/freebsd.opt)
87 OPT_FILES+= ${.CURDIR}/freebsd.opt
92 optionlist: ${OPT_FILES}
93 LC_ALL=C awk -f ${GCCDIR}/opt-gather.awk ${.ALLSRC} > ${.TARGET}
96 LC_ALL=C awk -f ${GCCDIR}/opt-functions.awk \
97 -f ${GCCDIR}/opth-gen.awk \
98 < ${.ALLSRC} > ${.TARGET}
100 options.c: optionlist
101 LC_ALL=C awk -f ${GCCDIR}/opt-functions.awk \
102 -f ${GCCDIR}/optc-gen.awk \
103 -v header_name="config.h system.h coretypes.h tm.h" \
104 < ${.ALLSRC} > ${.TARGET}
106 # Target machine config
108 TARGET_CPU_DEFAULT="${TARGET_CPU_DEFAULT}" \
109 HEADERS="${TARGET_INC}" \
111 /bin/sh ${GCCDIR}/mkconfig.sh ${.TARGET}
112 .if exists(${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}-modes.def)
113 echo '#define EXTRA_MODES_FILE "${GCC_CPU}/${GCC_CPU}-modes.def"' >> ${.TARGET}
118 TARGET_CPU_DEFAULT="${TARGET_CPU_DEFAULT}" \
119 HEADERS="auto-host.h ansidecl.h" \
120 DEFINES="USED_FOR_TARGET" \
121 /bin/sh ${GCCDIR}/mkconfig.sh ${.TARGET}
123 # Version header for gcov
125 echo "#define GCOV_VERSION ((gcov_unsigned_t)0x34303270)" >> ${.TARGET}
128 gthr-default.h: ${GCCDIR}/gthr-posix.h .NOMETA
129 ln -sf ${.ALLSRC} ${.TARGET}
131 .if ${TARGET_CPUARCH} == "arm"
132 unwind.h: ${GCCDIR}/config/arm/unwind-arm.h
134 unwind.h: ${GCCDIR}/unwind-generic.h
138 ln -sf ${.ALLSRC} ${.TARGET}