aboutsummaryrefslogtreecommitdiff
path: root/gnu/usr.bin/cc/cc_tools/Makefile.hdrs
blob: dc5bcb7a2d9478177f8fd4d901ffeb534503216c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# $FreeBSD$
#
# This is logic for common headers shared inside of gnu/lib.  It used to
# live in gnu/usr.bin/cc/cc_tools/Makefile.

.if !defined(TARGET_CPUARCH) || !defined(GCC_CPU)
.error ${.CURDIR}: Must include gnu/usr.bin/cc/Makefile.tgt first.
.endif

#
# The list of headers to go into tm.h
#
TARGET_INC+=	options.h
.if ${TARGET_CPUARCH} == "amd64"
TARGET_INC+=	i386/biarch64.h
.endif
.if ${TARGET_CPUARCH} != "arm"
TARGET_INC+=	${GCC_CPU}/${GCC_CPU}.h
.endif
.if ${TARGET_CPUARCH} == "i386" || ${TARGET_CPUARCH} == "amd64"
TARGET_INC+=	${GCC_CPU}/unix.h
TARGET_INC+=	${GCC_CPU}/att.h
.endif
.if ${TARGET_CPUARCH} == "powerpc"
TARGET_INC+=	${GCC_CPU}/secureplt.h
.endif
TARGET_INC+=	dbxelf.h
TARGET_INC+=	elfos-undef.h
TARGET_INC+=	elfos.h
TARGET_INC+=	freebsd-native.h
TARGET_INC+=	freebsd-spec.h
TARGET_INC+=	freebsd.h
.if ${TARGET_CPUARCH} != "i386" && ${TARGET_CPUARCH} != "amd64"
. if exists(${GCCDIR}/config/${GCC_CPU}/sysv4.h)
TARGET_INC+=	${GCC_CPU}/sysv4.h
. endif
.endif
.if ${TARGET_CPUARCH} == "amd64"
TARGET_INC+=	${GCC_CPU}/x86-64.h
.endif
.if ${TARGET_CPUARCH} == "arm" || ${TARGET_CPUARCH} == "mips"
TARGET_INC+=	${GCC_CPU}/elf.h
.endif
.if ${TARGET_CPUARCH} == "arm"
TARGET_INC+=	${GCC_CPU}/aout.h
TARGET_INC+=	${GCC_CPU}/bpabi.h
.endif
.if ${TARGET_ARCH} == "powerpc64"
TARGET_INC+=	${GCC_CPU}/biarch64.h
TARGET_INC+=    ${GCC_CPU}/default64.h
.endif
.if ${TARGET_ARCH} == "powerpcspe" 	 
TARGET_INC+=    ${GCC_CPU}/freebsdspe.h 	 
TARGET_INC+=    ${GCC_CPU}/e500-double.h 	 
.endif
TARGET_INC+=	${GCC_CPU}/freebsd.h
.if ${TARGET_CPUARCH} == "amd64"
TARGET_INC+=	${GCC_CPU}/freebsd64.h
.endif
.if ${TARGET_CPUARCH} == "arm"
TARGET_INC+=	${GCC_CPU}/arm.h
.endif
TARGET_INC+=	defaults.h

#
# Option files.
#
OPT_FILES=	c.opt common.opt

.if exists(${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}.opt)
OPT_FILES+=	${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}.opt
.endif

.if exists(${.CURDIR}/${GCC_CPU}-freebsd.opt)
OPT_FILES+=	${.CURDIR}/${GCC_CPU}-freebsd.opt
.endif

.if ${TARGET_CPUARCH} == "powerpc"
OPT_FILES+=	${GCCDIR}/config/${GCC_CPU}/sysv4.opt
.endif

.if ${TARGET_CPUARCH} == "sparc64"
OPT_FILES+=	${GCCDIR}/config/${GCC_CPU}/long-double-switch.opt
.endif

.if exists(${.CURDIR}/freebsd.opt)
OPT_FILES+=	${.CURDIR}/freebsd.opt
.endif


# Options
optionlist: ${OPT_FILES}
	LC_ALL=C awk -f ${GCCDIR}/opt-gather.awk ${.ALLSRC} > ${.TARGET}

options.h:	optionlist
	LC_ALL=C awk -f ${GCCDIR}/opt-functions.awk \
	    -f ${GCCDIR}/opth-gen.awk \
		< ${.ALLSRC} > ${.TARGET}

options.c:	optionlist
	LC_ALL=C awk -f ${GCCDIR}/opt-functions.awk \
	    -f ${GCCDIR}/optc-gen.awk \
		-v header_name="config.h system.h coretypes.h tm.h" \
		< ${.ALLSRC} > ${.TARGET}

# Target machine config
tm.h:
	TARGET_CPU_DEFAULT="${TARGET_CPU_DEFAULT}" \
	HEADERS="${TARGET_INC}" \
	DEFINES="" \
	/bin/sh ${GCCDIR}/mkconfig.sh ${.TARGET}
.if exists(${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}-modes.def)
	echo '#define EXTRA_MODES_FILE "${GCC_CPU}/${GCC_CPU}-modes.def"' >> ${.TARGET}
.endif

# tconfig.h
tconfig.h:
	TARGET_CPU_DEFAULT="${TARGET_CPU_DEFAULT}" \
	HEADERS="auto-host.h ansidecl.h" \
	DEFINES="USED_FOR_TARGET" \
	/bin/sh ${GCCDIR}/mkconfig.sh ${.TARGET}

# Version header for gcov
gcov-iov.h:
	echo "#define GCOV_VERSION ((gcov_unsigned_t)0x34303270)" >> ${.TARGET}

# Linked headers
gthr-default.h: ${GCCDIR}/gthr-posix.h .NOMETA
	ln -sf ${.ALLSRC} ${.TARGET}

.if ${TARGET_CPUARCH} == "arm"
unwind.h: ${GCCDIR}/config/arm/unwind-arm.h
.else
unwind.h: ${GCCDIR}/unwind-generic.h
.endif

unwind.h: .NOMETA
	ln -sf ${.ALLSRC} ${.TARGET}