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