sys.mk revision 245269
10SN/A# from: @(#)sys.mk 8.2 (Berkeley) 3/21/94 22362SN/A# $FreeBSD: head/share/mk/sys.mk 245269 2013-01-10 22:44:19Z des $ 30SN/A 40SN/Aunix ?= We run FreeBSD, not UNIX. 50SN/A.FreeBSD ?= true 60SN/A 72362SN/A.if !defined(%POSIX) 80SN/A# 92362SN/A# MACHINE_CPUARCH defines a collection of MACHINE_ARCH. Machines with 100SN/A# the same MACHINE_ARCH can run each other's binaries, so it necessarily 110SN/A# has word size and endian swizzled in. However, support files for 120SN/A# these machines often are shared amongst all combinations of size 130SN/A# and/or endian. This is called MACHINE_CPU in NetBSD, but that's used 140SN/A# for something different in FreeBSD. 150SN/A# 160SN/AMACHINE_CPUARCH=${MACHINE_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/} 170SN/A.endif 180SN/A 190SN/A# Set any local definitions first. Place this early, but it needs 200SN/A# MACHINE_CPUARCH to be defined. 212362SN/A.sinclude <local.sys.mk> 222362SN/A 232362SN/A# If the special target .POSIX appears (without prerequisites or 240SN/A# commands) before the first noncomment line in the makefile, make shall 250SN/A# process the makefile as specified by the Posix 1003.2 specification. 260SN/A# make(1) sets the special macro %POSIX in this case (to the actual 270SN/A# value "1003.2", for what it's worth). 280SN/A# 290SN/A# The rules below use this macro to distinguish between Posix-compliant 300SN/A# and default behaviour. 310SN/A 320SN/A.if defined(%POSIX) 330SN/A.SUFFIXES: .o .c .y .l .a .sh .f 340SN/A.else 350SN/A.SUFFIXES: .out .a .ln .o .c .cc .cpp .cxx .C .m .F .f .e .r .y .l .S .asm .s .cl .p .h .sh 360SN/A.endif 370SN/A 380SN/AAR ?= ar 390SN/A.if defined(%POSIX) 400SN/AARFLAGS ?= -rv 410SN/A.else 420SN/AARFLAGS ?= cru 430SN/A.endif 440SN/ARANLIB ?= ranlib 450SN/A 460SN/AAS ?= as 470SN/AAFLAGS ?= 480SN/AACFLAGS ?= 490SN/A 500SN/A.if defined(%POSIX) 510SN/ACC ?= c89 520SN/ACFLAGS ?= -O 530SN/A.else 540SN/ACC ?= cc 550SN/A.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "mips" 560SN/ACFLAGS ?= -O -pipe 570SN/A.else 580SN/ACFLAGS ?= -O2 -pipe 590SN/A.endif 600SN/A.if defined(NO_STRICT_ALIASING) 610SN/ACFLAGS += -fno-strict-aliasing 620SN/A.endif 630SN/A.endif 640SN/APO_CFLAGS ?= ${CFLAGS} 650SN/A 660SN/A# C Type Format data is required for DTrace 670SN/ACTFFLAGS ?= -L VERSION 680SN/A 690SN/ACTFCONVERT ?= ctfconvert 700SN/ACTFMERGE ?= ctfmerge 710SN/ADTRACE ?= dtrace 720SN/A.if defined(CFLAGS) && (${CFLAGS:M-g} != "") 730SN/ACTFFLAGS += -g 740SN/A.else 750SN/A# XXX: What to do here? Is removing the CFLAGS part completely ok here? 760SN/A# For now comment it out to not compile with -g unconditionally. 770SN/A#CFLAGS += -g 780SN/A.endif 790SN/A 800SN/ACXX ?= c++ 810SN/ACXXFLAGS ?= ${CFLAGS:N-std=*:N-Wnested-externs:N-W*-prototypes:N-Wno-pointer-sign:N-Wold-style-definition} 820SN/APO_CXXFLAGS ?= ${CXXFLAGS} 830SN/A 840SN/ACPP ?= cpp 850SN/A 860SN/A.if empty(.MAKEFLAGS:M-s) 870SN/AECHO ?= echo 880SN/AECHODIR ?= echo 890SN/A.else 900SN/AECHO ?= true 910SN/A.if ${.MAKEFLAGS:M-s} == "-s" 920SN/AECHODIR ?= echo 930SN/A.else 940SN/AECHODIR ?= true 950SN/A.endif 960SN/A.endif 970SN/A 980SN/A.if !empty(.MAKEFLAGS:M-n) && ${.MAKEFLAGS:M-n} == "-n" 990SN/A_+_ ?= 1000SN/A.else 1010SN/A_+_ ?= + 1020SN/A.endif 1030SN/A 1040SN/A.if defined(%POSIX) 1050SN/AFC ?= fort77 1060SN/AFFLAGS ?= -O 1 1070SN/A.else 1080SN/AFC ?= f77 1090SN/AFFLAGS ?= -O 1100SN/A.endif 1110SN/AEFLAGS ?= 1120SN/A 1130SN/AINSTALL ?= install 1140SN/A 1150SN/ALEX ?= lex 1160SN/ALFLAGS ?= 1170SN/A 1180SN/ALD ?= ld 1190SN/ALDFLAGS ?= 1200SN/A 1210SN/ALINT ?= lint 1220SN/ALINTFLAGS ?= -cghapbx 1230SN/ALINTKERNFLAGS ?= ${LINTFLAGS} 1240SN/ALINTOBJFLAGS ?= -cghapbxu -i 1250SN/ALINTOBJKERNFLAGS?= ${LINTOBJFLAGS} 1260SN/ALINTLIBFLAGS ?= -cghapbxu -C ${LIB} 1270SN/A 1280SN/AMAKE ?= make 1290SN/A 1300SN/A.if !defined(%POSIX) 1310SN/ANM ?= nm 1320SN/A 1330SN/AOBJC ?= cc 1340SN/AOBJCFLAGS ?= ${OBJCINCLUDES} ${CFLAGS} -Wno-import 1350SN/A 1360SN/AOBJCOPY ?= objcopy 1370SN/A 1380SN/APC ?= pc 1390SN/APFLAGS ?= 1400SN/A 1410SN/ARC ?= f77 1420SN/ARFLAGS ?= 1430SN/A.endif 1440SN/A 1450SN/ASHELL ?= sh 1460SN/A 1470SN/AYACC ?= yacc 1480SN/A.if defined(%POSIX) 1490SN/AYFLAGS ?= 1500SN/A.else 1510SN/AYFLAGS ?= -d 1520SN/A.endif 1530SN/A 1540SN/A.if defined(%POSIX) 1550SN/A 1560SN/A# Posix 1003.2 mandated rules 1570SN/A# 1580SN/A# Quoted directly from the Posix 1003.2 draft, only the macros 1590SN/A# $@, $< and $* have been replaced by ${.TARGET}, ${.IMPSRC}, and 1600SN/A# ${.PREFIX}, resp. 1610SN/A 1620SN/A# SINGLE SUFFIX RULES 1630SN/A.c: 1640SN/A ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC} 1650SN/A ${CTFCONVERT_CMD} 1660SN/A 1670SN/A.f: 1680SN/A ${FC} ${FFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC} 1690SN/A ${CTFCONVERT_CMD} 1700SN/A 1710SN/A.sh: 1720SN/A cp -f ${.IMPSRC} ${.TARGET} 1730SN/A chmod a+x ${.TARGET} 1740SN/A 1750SN/A# DOUBLE SUFFIX RULES 1760SN/A 1770SN/A.c.o: 1780SN/A ${CC} ${CFLAGS} -c ${.IMPSRC} 1790SN/A ${CTFCONVERT_CMD} 1800SN/A 1810SN/A.f.o: 1820SN/A ${FC} ${FFLAGS} -c ${.IMPSRC} 1830SN/A ${CTFCONVERT_CMD} 1840SN/A 1850SN/A.y.o: 1860SN/A ${YACC} ${YFLAGS} ${.IMPSRC} 1870SN/A ${CC} ${CFLAGS} -c y.tab.c 1880SN/A rm -f y.tab.c 1890SN/A mv y.tab.o ${.TARGET} 1900SN/A ${CTFCONVERT_CMD} 1910SN/A 1920SN/A.l.o: 1930SN/A ${LEX} ${LFLAGS} ${.IMPSRC} 1940SN/A ${CC} ${CFLAGS} -c lex.yy.c 1950SN/A rm -f lex.yy.c 1960SN/A mv lex.yy.o ${.TARGET} 1970SN/A ${CTFCONVERT_CMD} 1980SN/A 1990SN/A.y.c: 2000SN/A ${YACC} ${YFLAGS} ${.IMPSRC} 2010SN/A mv y.tab.c ${.TARGET} 2020SN/A 2030SN/A.l.c: 2040SN/A ${LEX} ${LFLAGS} ${.IMPSRC} 2050SN/A mv lex.yy.c ${.TARGET} 2060SN/A 2070SN/A.c.a: 2080SN/A ${CC} ${CFLAGS} -c ${.IMPSRC} 2090SN/A ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 2100SN/A rm -f ${.PREFIX}.o 2110SN/A 2120SN/A.f.a: 2130SN/A ${FC} ${FFLAGS} -c ${.IMPSRC} 2140SN/A ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 2150SN/A rm -f ${.PREFIX}.o 2160SN/A 2170SN/A.else 2180SN/A 2190SN/A# non-Posix rule set 2200SN/A 2210SN/A.sh: 2220SN/A cp -fp ${.IMPSRC} ${.TARGET} 2230SN/A chmod a+x ${.TARGET} 2240SN/A 2250SN/A.c.ln: 2260SN/A ${LINT} ${LINTOBJFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC} || \ 2270SN/A touch ${.TARGET} 2280SN/A 2290SN/A.cc.ln .C.ln .cpp.ln .cxx.ln: 2300SN/A ${LINT} ${LINTOBJFLAGS} ${CXXFLAGS:M-[DIU]*} ${.IMPSRC} || \ 2310SN/A touch ${.TARGET} 2320SN/A 2330SN/A.c: 2340SN/A ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} 2350SN/A ${CTFCONVERT_CMD} 2360SN/A 2370SN/A.c.o: 2380SN/A ${CC} ${CFLAGS} -c ${.IMPSRC} 2390SN/A ${CTFCONVERT_CMD} 2400SN/A 2410SN/A.cc .cpp .cxx .C: 2420SN/A ${CXX} ${CXXFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} 2430SN/A 2440SN/A.cc.o .cpp.o .cxx.o .C.o: 2450SN/A ${CXX} ${CXXFLAGS} -c ${.IMPSRC} 2460SN/A 2470SN/A.m.o: 2480SN/A ${OBJC} ${OBJCFLAGS} -c ${.IMPSRC} 2490SN/A ${CTFCONVERT_CMD} 2500SN/A 2510SN/A.p.o: 2520SN/A ${PC} ${PFLAGS} -c ${.IMPSRC} 2530SN/A ${CTFCONVERT_CMD} 2540SN/A 2550SN/A.e .r .F .f: 2560SN/A ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} \ 2570SN/A -o ${.TARGET} 2580SN/A 2590SN/A.e.o .r.o .F.o .f.o: 2600SN/A ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} -c ${.IMPSRC} 2610SN/A 2620SN/A.S.o: 2630SN/A ${CC} ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} 2640SN/A ${CTFCONVERT_CMD} 2650SN/A 2660SN/A.asm.o: 2670SN/A ${CC} -x assembler-with-cpp ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} 2680SN/A ${CTFCONVERT_CMD} 2690SN/A 2700SN/A.s.o: 2710SN/A ${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC} 2720SN/A ${CTFCONVERT_CMD} 2730SN/A 2740SN/A# XXX not -j safe 2750SN/A.y.o: 2760SN/A ${YACC} ${YFLAGS} ${.IMPSRC} 2770SN/A ${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET} 2780SN/A rm -f y.tab.c 2790SN/A ${CTFCONVERT_CMD} 2800SN/A 2810SN/A.l.o: 2820SN/A ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c 2830SN/A ${CC} ${CFLAGS} -c ${.PREFIX}.tmp.c -o ${.TARGET} 2840SN/A rm -f ${.PREFIX}.tmp.c 2850SN/A ${CTFCONVERT_CMD} 2860SN/A 2870SN/A# XXX not -j safe 2880SN/A.y.c: 2890SN/A ${YACC} ${YFLAGS} ${.IMPSRC} 2900SN/A mv y.tab.c ${.TARGET} 2910SN/A 2920SN/A.l.c: 2930SN/A ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.TARGET} 2940SN/A 2950SN/A.s.out .c.out .o.out: 2960SN/A ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} 2970SN/A ${CTFCONVERT_CMD} 2980SN/A 2990SN/A.f.out .F.out .r.out .e.out: 3000SN/A ${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} \ 3010SN/A ${LDLIBS} -o ${.TARGET} 3020SN/A rm -f ${.PREFIX}.o 3030SN/A ${CTFCONVERT_CMD} 3040SN/A 3050SN/A# XXX not -j safe 3060SN/A.y.out: 3070SN/A ${YACC} ${YFLAGS} ${.IMPSRC} 3080SN/A ${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET} 3090SN/A rm -f y.tab.c 3100SN/A ${CTFCONVERT_CMD} 3110SN/A 3120SN/A.l.out: 3130SN/A ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c 3140SN/A ${CC} ${CFLAGS} ${LDFLAGS} ${.PREFIX}.tmp.c ${LDLIBS} -ll -o ${.TARGET} 3150SN/A rm -f ${.PREFIX}.tmp.c 3160SN/A ${CTFCONVERT_CMD} 3170SN/A 3180SN/A# FreeBSD build pollution. Hide it in the non-POSIX part of the ifdef. 3190SN/A__MAKE_CONF?=/etc/make.conf 3200SN/A.if exists(${__MAKE_CONF}) 3210SN/A.include "${__MAKE_CONF}" 3220SN/A.endif 3230SN/A 3240SN/A.if defined(__MAKE_SHELL) && !empty(__MAKE_SHELL) 3250SN/ASHELL= ${__MAKE_SHELL} 3260SN/A.SHELL: path=${__MAKE_SHELL} 3270SN/A.endif 3280SN/A 3290SN/A# Default executable format 3300SN/A# XXX hint for bsd.port.mk 3310SN/AOBJFORMAT?= elf 3320SN/A 3330SN/A# Tell bmake to expand -V VAR by default 3340SN/A.MAKE.EXPAND_VARIABLES= yes 3350SN/A 3360SN/A.if !defined(.PARSEDIR) 3370SN/A# We are not bmake, which is more aggressive about searching .PATH 3380SN/A# It is sometime necessary to curb its enthusiasm with .NOPATH 3390SN/A# The following allows us to quietly ignore .NOPATH when not using bmake. 3400SN/A.NOTMAIN: .NOPATH 3410SN/A.NOPATH: 3420SN/A 3430SN/A# Toggle on warnings 3440SN/A.WARN: dirsyntax 3450SN/A.endif 3460SN/A 3470SN/A.endif 3480SN/A 3490SN/A.include <bsd.cpu.mk> 3500SN/A