Makefile.inc revision 272350
11573Srgrimes# $FreeBSD: head/gnu/usr.bin/cc/Makefile.inc 272350 2014-10-01 08:26:51Z andrew $
21573Srgrimes
31573Srgrimes.include <src.opts.mk>
41573Srgrimes.include "../Makefile.inc"
51573Srgrimes
61573Srgrimes# Sometimes this is .include'd several times...
71573Srgrimes.if !defined(__CC_MAKEFILE_INC__)
81573Srgrimes__CC_MAKEFILE_INC__= ${MFILE}
91573Srgrimes
101573SrgrimesGCCVER=	4.2
111573SrgrimesGCCDIR=	${.CURDIR}/../../../../contrib/gcc
121573SrgrimesGCCLIB=	${.CURDIR}/../../../../contrib/gcclibs
131573Srgrimes
141573Srgrimes.include "Makefile.tgt"
151573Srgrimes
161573Srgrimes# Machine description.
171573SrgrimesMD_FILE=	${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}.md
181573SrgrimesGCC_TARGET=	${TARGET_ARCH}-undermydesk-freebsd
191573Srgrimes
201573SrgrimesCFLAGS+=	-DGCCVER=\"${GCCVER}\"
211573SrgrimesCFLAGS+=	-DIN_GCC -DHAVE_CONFIG_H
221573SrgrimesCFLAGS+=	-DPREFIX=\"${TOOLS_PREFIX}/usr\"
231573Srgrimes#CFLAGS+=	-DWANT_COMPILER_INVARIANTS
241573SrgrimesCSTD?=	gnu89
251573Srgrimes
261573Srgrimes.if ${TARGET_ARCH} != ${MACHINE_ARCH}
271573SrgrimesCFLAGS+=	-DCROSS_DIRECTORY_STRUCTURE
281573Srgrimes.endif
291573Srgrimes
301573Srgrimes.if ${TARGET_CPUARCH} == "arm"
311573SrgrimesCFLAGS+=	-DTARGET_ARM_EABI
321573Srgrimes.endif
331573Srgrimes
341573Srgrimes.if ${TARGET_ARCH} == "armeb" || ${TARGET_ARCH} == "armv6eb"
351573SrgrimesCFLAGS += -DTARGET_ENDIAN_DEFAULT=MASK_BIG_END
361573Srgrimes.endif
3784260Sobrien.if ${TARGET_ARCH} == "armv6" || ${TARGET_ARCH} == "armv6eb"
3884260SobrienCFLAGS += -DFREEBSD_ARCH_armv6
391573Srgrimes.endif
401573Srgrimes
411573Srgrimes.if ${TARGET_CPUARCH} == "mips"
421573Srgrimes.if ${TARGET_ARCH:Mmips*el} != ""
431573SrgrimesCFLAGS += -DTARGET_ENDIAN_DEFAULT=0
441573Srgrimes.endif
4584260Sobrien
461573Srgrimes.if ${TARGET_ARCH:Mmips64*} != ""
471573SrgrimesMIPS_ABI_DEFAULT=ABI_64
481573Srgrimes.elif ${TARGET_ARCH:Mmipsn32*} != ""
4984260SobrienMIPS_ABI_DEFAULT=ABI_N32
5084260Sobrien.else
5184260SobrienMIPS_ABI_DEFAULT=ABI_32
521573Srgrimes.endif
531573SrgrimesCFLAGS += -DMIPS_ABI_DEFAULT=${MIPS_ABI_DEFAULT}
541573Srgrimes
551573Srgrimes# If we are compiling for the O32 ABI, we need to default to MIPS-III rather
5684260Sobrien# than taking the ISA from the ABI requirements, since FreeBSD is built with
571573Srgrimes# a number of MIPS-III features/instructions and that is the minimum ISA we
5884260Sobrien# support, not the O32 default MIPS-I.
5984260Sobrien.if ${MIPS_ABI_DEFAULT} == "ABI_32"
6084260SobrienTARGET_CPUTYPE?=mips3
611573Srgrimes.endif
621573Srgrimes
631573Srgrimes# GCC by default takes the ISA from the ABI's requirements.  If world is built
641573Srgrimes# with a superior ISA, since we lack multilib, we have to set the right
651573Srgrimes# default ISA to be able to link against what's in /usr/lib.  Terrible stuff.
661573Srgrimes.if defined(TARGET_CPUTYPE)
6784260SobrienCFLAGS += -DMIPS_CPU_STRING_DEFAULT=\"${TARGET_CPUTYPE}\"
6884260Sobrien.endif
691573Srgrimes.endif
701573Srgrimes
711573Srgrimes.if defined(WANT_FORCE_OPTIMIZATION_DOWNGRADE)
7284260SobrienCFLAGS+= -DFORCE_OPTIMIZATION_DOWNGRADE=${WANT_FORCE_OPTIMIZATION_DOWNGRADE}
7384260Sobrien.endif
7484260Sobrien
7584260Sobrien.if exists(${.OBJDIR}/../cc_tools)
761573SrgrimesCFLAGS+=	-I${.OBJDIR}/../cc_tools
771573Srgrimes.endif
781573SrgrimesCFLAGS+=	-I${.CURDIR}/../cc_tools
791573Srgrimes# This must go after the -I for cc_tools to resolve ambiguities for hash.h
801573Srgrimes# correctly.
811573SrgrimesCFLAGS+=	-I${GCCDIR} -I${GCCDIR}/config
8284260Sobrien
8384260SobrienCFLAGS+=	-I${GCCLIB}/include
8484260SobrienCFLAGS+=	-I${GCCLIB}/libcpp/include
8584260SobrienCFLAGS+=	-I${GCCLIB}/libdecnumber
8684260Sobrien
871573Srgrimes.if exists(${.OBJDIR}/../cc_int)
881573SrgrimesLIBBACKEND=	${.OBJDIR}/../cc_int/libbackend.a
891573Srgrimes.else
901573SrgrimesLIBBACKEND=	${.CURDIR}/../cc_int/libbackend.a
911573Srgrimes.endif
9284260Sobrien
9384260Sobrien.if exists(${.OBJDIR}/../libiberty)
9439327SimpLIBIBERTY=	${.OBJDIR}/../libiberty/libiberty.a
9584260Sobrien.else
961573SrgrimesLIBIBERTY=	${.CURDIR}/../libiberty/libiberty.a
971573Srgrimes.endif
981573Srgrimes
991573Srgrimes.if exists(${.OBJDIR}/../libcpp)
1001573SrgrimesLIBCPP=		${.OBJDIR}/../libcpp/libcpp.a
1011573Srgrimes.else
1021573SrgrimesLIBCPP=		${.CURDIR}/../libcpp/libcpp.a
1031573Srgrimes.endif
1041573Srgrimes
1051573Srgrimes.if exists(${.OBJDIR}/../libdecnumber)
1061573SrgrimesLIBDECNUMBER=	${.OBJDIR}/../libdecnumber/libdecnumber.a
1071573Srgrimes.else
1081573SrgrimesLIBDECNUMBER=	${.CURDIR}/../libdecnumber/libdecnumber.a
1091573Srgrimes.endif
1101573Srgrimes
1111573Srgrimes.endif # !__CC_MAKEFILE_INC__
11284260Sobrien