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