Makefile.inc revision 217123
1# $FreeBSD: head/gnu/usr.bin/cc/Makefile.inc 217123 2011-01-07 20:26:33Z imp $
2
3.include "../Makefile.inc"
4
5# Sometimes this is .include'd several times...
6.if !defined(__CC_MAKEFILE_INC__)
7__CC_MAKEFILE_INC__= ${MFILE}
8
9GCCVER=	4.2
10GCCDIR=	${.CURDIR}/../../../../contrib/gcc
11GCCLIB=	${.CURDIR}/../../../../contrib/gcclibs
12
13.include "Makefile.tgt"
14
15# Machine description.
16MD_FILE=	${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}.md
17GCC_TARGET=	${TARGET_ARCH}-undermydesk-freebsd
18
19CFLAGS+=	-DGCCVER=\"${GCCVER}\"
20CFLAGS+=	-DIN_GCC -DHAVE_CONFIG_H
21CFLAGS+=	-DPREFIX=\"${TOOLS_PREFIX}/usr\"
22#CFLAGS+=	-DWANT_COMPILER_INVARIANTS
23CSTD?=	gnu89
24
25# If building 64-bit longs for the i386, "_LARGE_LONG" should also be defined
26# to get the proper sizes in limits.h
27.if defined(LONG_TYPE_SIZE)
28CFLAGS+=	-DLONG_TYPE_SIZE=${LONG_TYPE_SIZE}
29.endif
30
31.if ${TARGET_ARCH} != ${MACHINE_ARCH}
32CFLAGS+=	-DCROSS_COMPILE
33.endif
34
35.if ${TARGET_ARCH} == "armeb"
36CFLAGS += -DTARGET_ENDIAN_DEFAULT=MASK_BIG_END
37.endif
38
39.if ${TARGET_CPUARCH} == "mips"
40.if ${TARGET_ARCH:Mmips*el} != ""
41CFLAGS += -DTARGET_ENDIAN_DEFAULT=0
42.endif
43
44.if ${TARGET_ARCH:Mmips64*} != ""
45MIPS_ABI_DEFAULT=ABI_64
46.elif ${TARGET_ARCH:Mmipsn32*} != ""
47MIPS_ABI_DEFAULT=ABI_N32
48.else
49MIPS_ABI_DEFAULT=ABI_32
50.endif
51CFLAGS += -DMIPS_ABI_DEFAULT=${MIPS_ABI_DEFAULT}
52
53# If we are compiling for the O32 ABI, we need to default to MIPS-III rather
54# than taking the ISA from the ABI requirements, since FreeBSD is built with
55# a number of MIPS-III features/instructions and that is the minimum ISA we
56# support, not the O32 default MIPS-I.
57.if ${MIPS_ABI_DEFAULT} == "ABI_32"
58TARGET_CPUTYPE?=mips3
59.endif
60
61# GCC by default takes the ISA from the ABI's requirements.  If world is built
62# with a superior ISA, since we lack multilib, we have to set the right
63# default ISA to be able to link against what's in /usr/lib.  Terrible stuff.
64.if defined(TARGET_CPUTYPE)
65CFLAGS += -DMIPS_CPU_STRING_DEFAULT=\"${TARGET_CPUTYPE}\"
66.endif
67.endif
68
69.if defined(WANT_FORCE_OPTIMIZATION_DOWNGRADE)
70CFLAGS+= -DFORCE_OPTIMIZATION_DOWNGRADE=${WANT_FORCE_OPTIMIZATION_DOWNGRADE}
71.endif
72
73.if exists(${.OBJDIR}/../cc_tools)
74CFLAGS+=	-I${.OBJDIR}/../cc_tools
75.endif
76CFLAGS+=	-I${.CURDIR}/../cc_tools
77# This must go after the -I for cc_tools to resolve ambiguities for hash.h
78# correctly.
79CFLAGS+=	-I${GCCDIR} -I${GCCDIR}/config
80
81CFLAGS+=	-I${GCCLIB}/include
82CFLAGS+=	-I${GCCLIB}/libcpp/include
83CFLAGS+=	-I${GCCLIB}/libdecnumber
84
85.if exists(${.OBJDIR}/../cc_int)
86LIBBACKEND=	${.OBJDIR}/../cc_int/libbackend.a
87.else
88LIBBACKEND=	${.CURDIR}/../cc_int/libbackend.a
89.endif
90
91.if exists(${.OBJDIR}/../libiberty)
92LIBIBERTY=	${.OBJDIR}/../libiberty/libiberty.a
93.else
94LIBIBERTY=	${.CURDIR}/../libiberty/libiberty.a
95.endif
96
97.if exists(${.OBJDIR}/../libcpp)
98LIBCPP=		${.OBJDIR}/../libcpp/libcpp.a
99.else
100LIBCPP=		${.CURDIR}/../libcpp/libcpp.a
101.endif
102
103.if exists(${.OBJDIR}/../libdecnumber)
104LIBDECNUMBER=	${.OBJDIR}/../libdecnumber/libdecnumber.a
105.else
106LIBDECNUMBER=	${.CURDIR}/../libdecnumber/libdecnumber.a
107.endif
108
109.endif # !__CC_MAKEFILE_INC__
110