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=	${.CURDIR}/../../../../contrib/gcc
12GCCLIB=	${.CURDIR}/../../../../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
28.endif
29
30.if ${TARGET_CPUARCH} == "arm"
31CFLAGS+=	-DTARGET_ARM_EABI
32.endif
33
34.if ${TARGET_ARCH} == "armeb" || ${TARGET_ARCH} == "armv6eb"
35CFLAGS += -DTARGET_ENDIAN_DEFAULT=MASK_BIG_END
36.endif
37.if ${TARGET_ARCH} == "armv6" || ${TARGET_ARCH} == "armv6eb"
38CFLAGS += -DFREEBSD_ARCH_armv6
39.endif
40
41.if ${TARGET_CPUARCH} == "mips"
42.if ${TARGET_ARCH:Mmips*el} != ""
43CFLAGS += -DTARGET_ENDIAN_DEFAULT=0
44.endif
45
46.if ${TARGET_ARCH:Mmips64*} != ""
47MIPS_ABI_DEFAULT=ABI_64
48.elif ${TARGET_ARCH:Mmipsn32*} != ""
49MIPS_ABI_DEFAULT=ABI_N32
50.else
51MIPS_ABI_DEFAULT=ABI_32
52.endif
53CFLAGS += -DMIPS_ABI_DEFAULT=${MIPS_ABI_DEFAULT}
54
55# If we are compiling for the O32 ABI, we need to default to MIPS-III rather
56# than taking the ISA from the ABI requirements, since FreeBSD is built with
57# a number of MIPS-III features/instructions and that is the minimum ISA we
58# support, not the O32 default MIPS-I.
59.if ${MIPS_ABI_DEFAULT} == "ABI_32"
60TARGET_CPUTYPE?=mips3
61.endif
62
63# GCC by default takes the ISA from the ABI's requirements.  If world is built
64# with a superior ISA, since we lack multilib, we have to set the right
65# default ISA to be able to link against what's in /usr/lib.  Terrible stuff.
66.if defined(TARGET_CPUTYPE)
67CFLAGS += -DMIPS_CPU_STRING_DEFAULT=\"${TARGET_CPUTYPE}\"
68.endif
69.endif
70
71.if defined(WANT_FORCE_OPTIMIZATION_DOWNGRADE)
72CFLAGS+= -DFORCE_OPTIMIZATION_DOWNGRADE=${WANT_FORCE_OPTIMIZATION_DOWNGRADE}
73.endif
74
75.if exists(${.OBJDIR}/../cc_tools)
76CFLAGS+=	-I${.OBJDIR}/../cc_tools
77.endif
78CFLAGS+=	-I${.CURDIR}/../cc_tools
79# This must go after the -I for cc_tools to resolve ambiguities for hash.h
80# correctly.
81CFLAGS+=	-I${GCCDIR} -I${GCCDIR}/config
82
83CFLAGS+=	-I${GCCLIB}/include
84CFLAGS+=	-I${GCCLIB}/libcpp/include
85CFLAGS+=	-I${GCCLIB}/libdecnumber
86
87.if exists(${.OBJDIR}/../cc_int)
88LIBBACKEND=	${.OBJDIR}/../cc_int/libbackend.a
89.else
90LIBBACKEND=	${.CURDIR}/../cc_int/libbackend.a
91.endif
92
93.if exists(${.OBJDIR}/../libiberty)
94LIBIBERTY=	${.OBJDIR}/../libiberty/libiberty.a
95.else
96LIBIBERTY=	${.CURDIR}/../libiberty/libiberty.a
97.endif
98
99.if exists(${.OBJDIR}/../libcpp)
100LIBCPP=		${.OBJDIR}/../libcpp/libcpp.a
101.else
102LIBCPP=		${.CURDIR}/../libcpp/libcpp.a
103.endif
104
105.if exists(${.OBJDIR}/../libdecnumber)
106LIBDECNUMBER=	${.OBJDIR}/../libdecnumber/libdecnumber.a
107.else
108LIBDECNUMBER=	${.CURDIR}/../libdecnumber/libdecnumber.a
109.endif
110
111.endif # !__CC_MAKEFILE_INC__
112