Makefile.inc revision 208758
1# $FreeBSD: head/gnu/usr.bin/cc/Makefile.inc 208758 2010-06-02 21:15:00Z jmallett $
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} == "mips"
36# XXX This is backwards, MIPS should default to BE.
37.if !defined(TARGET_BIG_ENDIAN)
38CFLAGS += -DTARGET_ENDIAN_DEFAULT=0
39.endif
40
41.if defined(TARGET_ABI) && ${TARGET_ABI} != "o32"
42.if ${TARGET_ABI} == "n32"
43MIPS_ABI_DEFAULT=ABI_N32
44.elif ${TARGET_ABI} == "n64"
45MIPS_ABI_DEFAULT=ABI_64
46.endif
47.endif
48
49MIPS_ABI_DEFAULT?=ABI_32
50CFLAGS += -DMIPS_ABI_DEFAULT=${MIPS_ABI_DEFAULT}
51
52# If we are compiling for the O32 ABI, we need to default to MIPS-III rather
53# than taking the ISA from the ABI requirements, since FreeBSD is built with
54# a number of MIPS-III features/instructions and that is the minimum ISA we
55# support, not the O32 default MIPS-I.
56.if ${MIPS_ABI_DEFAULT} == "ABI_32"
57TARGET_CPUTYPE?=mips3
58.endif
59
60# GCC by default takes the ISA from the ABI's requirements.  If world is built
61# with a superior ISA, since we lack multilib, we have to set the right
62# default ISA to be able to link against what's in /usr/lib.  Terrible stuff.
63.if defined(TARGET_CPUTYPE)
64CFLAGS += -DMIPS_CPU_STRING_DEFAULT=\"${TARGET_CPUTYPE}\"
65.endif
66.endif
67
68.if defined(WANT_FORCE_OPTIMIZATION_DOWNGRADE)
69CFLAGS+= -DFORCE_OPTIMIZATION_DOWNGRADE=${WANT_FORCE_OPTIMIZATION_DOWNGRADE}
70.endif
71
72.if exists(${.OBJDIR}/../cc_tools)
73CFLAGS+=	-I${.OBJDIR}/../cc_tools
74.endif
75CFLAGS+=	-I${.CURDIR}/../cc_tools
76# This must go after the -I for cc_tools to resolve ambiguities for hash.h
77# correctly.
78CFLAGS+=	-I${GCCDIR} -I${GCCDIR}/config
79
80CFLAGS+=	-I${GCCLIB}/include
81CFLAGS+=	-I${GCCLIB}/libcpp/include
82CFLAGS+=	-I${GCCLIB}/libdecnumber
83
84.if exists(${.OBJDIR}/../cc_int)
85LIBBACKEND=	${.OBJDIR}/../cc_int/libbackend.a
86.else
87LIBBACKEND=	${.CURDIR}/../cc_int/libbackend.a
88.endif
89
90.if exists(${.OBJDIR}/../libiberty)
91LIBIBERTY=	${.OBJDIR}/../libiberty/libiberty.a
92.else
93LIBIBERTY=	${.CURDIR}/../libiberty/libiberty.a
94.endif
95
96.if exists(${.OBJDIR}/../libcpp)
97LIBCPP=		${.OBJDIR}/../libcpp/libcpp.a
98.else
99LIBCPP=		${.CURDIR}/../libcpp/libcpp.a
100.endif
101
102.if exists(${.OBJDIR}/../libdecnumber)
103LIBDECNUMBER=	${.OBJDIR}/../libdecnumber/libdecnumber.a
104.else
105LIBDECNUMBER=	${.CURDIR}/../libdecnumber/libdecnumber.a
106.endif
107
108.endif # !__CC_MAKEFILE_INC__
109