sys.mk revision 171049
122347Spst# from: @(#)sys.mk 8.2 (Berkeley) 3/21/94 222347Spst# $FreeBSD: head/share/mk/sys.mk 171049 2007-06-26 19:10:20Z ache $ 392906Smarkm 492906Smarkmunix ?= We run FreeBSD, not UNIX. 592906Smarkm.FreeBSD ?= true 692906Smarkm 792906Smarkm# If the special target .POSIX appears (without prerequisites or 892906Smarkm# commands) before the first noncomment line in the makefile, make shall 992906Smarkm# process the makefile as specified by the Posix 1003.2 specification. 1092906Smarkm# make(1) sets the special macro %POSIX in this case (to the actual 1122347Spst# value "1003.2", for what it's worth). 1222347Spst# 1322347Spst# The rules below use this macro to distinguish between Posix-compliant 1422347Spst# and default behaviour. 1522347Spst 1622347Spst.if defined(%POSIX) 1722347Spst.SUFFIXES: .o .c .y .l .a .sh .f 1892906Smarkm.else 1922347Spst.SUFFIXES: .out .a .ln .o .c .cc .cpp .cxx .C .m .F .f .e .r .y .l .S .asm .s .cl .p .h .sh 2022347Spst.endif 2122347Spst 2222347SpstAR ?= ar 2322347Spst.if defined(%POSIX) 2422347SpstARFLAGS ?= -rv 2522347Spst.else 2622347SpstARFLAGS ?= rl 2722347Spst.endif 2822347SpstRANLIB ?= ranlib 2922347Spst 3022347SpstAS ?= as 3122347SpstAFLAGS ?= 3222347Spst 3322347Spst.if defined(%POSIX) 3422347SpstCC ?= c89 3522347SpstCFLAGS ?= -O 3622347Spst.else 3722347SpstCC ?= cc 3822347SpstCFLAGS ?= -O2 -fno-strict-aliasing -fno-tree-vrp -pipe 3922347Spst.endif 4022347Spst 4122347SpstCXX ?= c++ 4222347SpstCXXFLAGS ?= ${CFLAGS:N-std=*:N-Wnested-externs:N-W*-prototypes} 4322347Spst 4422347SpstCPP ?= cpp 4522347Spst 4622347Spst.if empty(.MAKEFLAGS:M-s) 4722347SpstECHO ?= echo 4822347SpstECHODIR ?= echo 4922347Spst.else 5022347SpstECHO ?= true 5122347Spst.if ${.MAKEFLAGS:M-s} == "-s" 5222347SpstECHODIR ?= echo 5322347Spst.else 5422347SpstECHODIR ?= true 5522347Spst.endif 5622347Spst.endif 5722347Spst 5822347Spst.if !empty(.MAKEFLAGS:M-n) && ${.MAKEFLAGS:M-n} == "-n" 5922347Spst_+_ ?= 6022347Spst.else 6122347Spst_+_ ?= + 6222347Spst.endif 6322347Spst 6422347Spst.if defined(%POSIX) 6522347SpstFC ?= fort77 6622347SpstFFLAGS ?= -O 1 6722347Spst.else 6822347SpstFC ?= f77 6922347SpstFFLAGS ?= -O 7022347Spst.endif 7192906SmarkmEFLAGS ?= 7292906Smarkm 7322347SpstINSTALL ?= install 7422347Spst 7522347SpstLEX ?= lex 7622347SpstLFLAGS ?= 7722347Spst 7822347SpstLD ?= ld 7922347SpstLDFLAGS ?= 8022347Spst 8122347SpstLINT ?= lint 8222347SpstLINTFLAGS ?= -cghapbx 8322347SpstLINTKERNFLAGS ?= ${LINTFLAGS} 8422347SpstLINTOBJFLAGS ?= -cghapbxu -i 8522347SpstLINTOBJKERNFLAGS?= ${LINTOBJFLAGS} 8622347SpstLINTLIBFLAGS ?= -cghapbxu -C ${LIB} 8722347Spst 8822347SpstMAKE ?= make 8922347Spst 9022347SpstOBJC ?= cc 9122347SpstOBJCFLAGS ?= ${OBJCINCLUDES} ${CFLAGS} -Wno-import 9222347Spst 9322347SpstPC ?= pc 9422347SpstPFLAGS ?= 9522347Spst 9622347SpstRC ?= f77 9722347SpstRFLAGS ?= 9822347Spst 9922347SpstSHELL ?= sh 10022347Spst 10122347SpstYACC ?= yacc 10222347Spst.if defined(%POSIX) 10322347SpstYFLAGS ?= 10492906Smarkm.else 10592906SmarkmYFLAGS ?= -d 10692906Smarkm.endif 10722347Spst 10822347Spst.if defined(%POSIX) 10922347Spst 11022347Spst# Posix 1003.2 mandated rules 11122347Spst# 11222347Spst# Quoted directly from the Posix 1003.2 draft, only the macros 11322347Spst# $@, $< and $* have been replaced by ${.TARGET}, ${.IMPSRC}, and 11422347Spst# ${.PREFIX}, resp. 11522347Spst 11622347Spst# SINGLE SUFFIX RULES 11722347Spst.c: 11822347Spst ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC} 11922347Spst 12022347Spst.f: 12122347Spst ${FC} ${FFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC} 12222347Spst 12322347Spst.sh: 12422347Spst cp ${.IMPSRC} ${.TARGET} 12522347Spst chmod a+x ${.TARGET} 12622347Spst 12722347Spst# DOUBLE SUFFIX RULES 12822347Spst 12922347Spst.c.o: 13022347Spst ${CC} ${CFLAGS} -c ${.IMPSRC} 13122347Spst 13222347Spst.f.o: 13322347Spst ${FC} ${FFLAGS} -c ${.IMPSRC} 13422347Spst 13522347Spst.y.o: 13622347Spst ${YACC} ${YFLAGS} ${.IMPSRC} 13722347Spst ${CC} ${CFLAGS} -c y.tab.c 13822347Spst rm -f y.tab.c 13922347Spst mv y.tab.o ${.TARGET} 14022347Spst 14122347Spst.l.o: 14222347Spst ${LEX} ${LFLAGS} ${.IMPSRC} 14322347Spst ${CC} ${CFLAGS} -c lex.yy.c 14422347Spst rm -f lex.yy.c 14522347Spst mv lex.yy.o ${.TARGET} 14622347Spst 14722347Spst.y.c: 14822347Spst ${YACC} ${YFLAGS} ${.IMPSRC} 14922347Spst mv y.tab.c ${.TARGET} 15022347Spst 15122347Spst.l.c: 15222347Spst ${LEX} ${LFLAGS} ${.IMPSRC} 15322347Spst mv lex.yy.c ${.TARGET} 15422347Spst 15522347Spst.c.a: 15622347Spst ${CC} ${CFLAGS} -c ${.IMPSRC} 15722347Spst ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 15822347Spst rm -f ${.PREFIX}.o 15922347Spst 16022347Spst.f.a: 16122347Spst ${FC} ${FFLAGS} -c ${.IMPSRC} 16222347Spst ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 16322347Spst rm -f ${.PREFIX}.o 16422347Spst 16522347Spst.else 16622347Spst 16722347Spst# non-Posix rule set 16822347Spst 16922347Spst.sh: 17022347Spst cp -p ${.IMPSRC} ${.TARGET} 17122347Spst chmod a+x ${.TARGET} 17222347Spst 17322347Spst.c.ln: 17422347Spst ${LINT} ${LINTOBJFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC} || \ 17522347Spst touch ${.TARGET} 17622347Spst 17722347Spst.cc.ln .C.ln .cpp.ln .cxx.ln: 17822347Spst ${LINT} ${LINTOBJFLAGS} ${CXXFLAGS:M-[DIU]*} ${.IMPSRC} || \ 17922347Spst touch ${.TARGET} 18022347Spst 18122347Spst.c: 18222347Spst ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} 18322347Spst 18422347Spst.c.o: 18522347Spst ${CC} ${CFLAGS} -c ${.IMPSRC} 18622347Spst 18722347Spst.cc .cpp .cxx .C: 18822347Spst ${CXX} ${CXXFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} 18922347Spst 19022347Spst.cc.o .cpp.o .cxx.o .C.o: 19122347Spst ${CXX} ${CXXFLAGS} -c ${.IMPSRC} 19222347Spst 19322347Spst.m.o: 19422347Spst ${OBJC} ${OBJCFLAGS} -c ${.IMPSRC} 19522347Spst 19622347Spst.p.o: 19722347Spst ${PC} ${PFLAGS} -c ${.IMPSRC} 19822347Spst 19922347Spst.e .r .F .f: 20022347Spst ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} \ 20122347Spst -o ${.TARGET} 20222347Spst 20322347Spst.e.o .r.o .F.o .f.o: 20422347Spst ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} -c ${.IMPSRC} 20522347Spst 20622347Spst.S.o: 20722347Spst ${CC} ${CFLAGS} -c ${.IMPSRC} 20822347Spst 20922347Spst.asm.o: 21022347Spst ${CC} -x assembler-with-cpp ${CFLAGS} -c ${.IMPSRC} 21122347Spst 21222347Spst.s.o: 21322347Spst ${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC} 21422347Spst 21522347Spst# XXX not -j safe 21622347Spst.y.o: 21722347Spst ${YACC} ${YFLAGS} ${.IMPSRC} 21822347Spst ${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET} 21922347Spst rm -f y.tab.c 22022347Spst 22122347Spst.l.o: 22222347Spst ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c 22322347Spst ${CC} ${CFLAGS} -c ${.PREFIX}.tmp.c -o ${.TARGET} 22422347Spst rm -f ${.PREFIX}.tmp.c 22522347Spst 22622347Spst# XXX not -j safe 22722347Spst.y.c: 22822347Spst ${YACC} ${YFLAGS} ${.IMPSRC} 22922347Spst mv y.tab.c ${.TARGET} 23022347Spst 23122347Spst.l.c: 23222347Spst ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.TARGET} 23322347Spst 23422347Spst.s.out .c.out .o.out: 23522347Spst ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} 23622347Spst 23722347Spst.f.out .F.out .r.out .e.out: 23822347Spst ${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} \ 23922347Spst ${LDLIBS} -o ${.TARGET} 24022347Spst rm -f ${.PREFIX}.o 24122347Spst 24222347Spst# XXX not -j safe 24322347Spst.y.out: 24422347Spst ${YACC} ${YFLAGS} ${.IMPSRC} 24522347Spst ${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET} 24622347Spst rm -f y.tab.c 24722347Spst 24822347Spst.l.out: 24922347Spst ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c 25022347Spst ${CC} ${CFLAGS} ${LDFLAGS} ${.PREFIX}.tmp.c ${LDLIBS} -ll -o ${.TARGET} 25122347Spst rm -f ${.PREFIX}.tmp.c 25222347Spst 25322347Spst# FreeBSD build pollution. Hide it in the non-POSIX part of the ifdef. 25422347Spst__MAKE_CONF?=/etc/make.conf 25522347Spst.if exists(${__MAKE_CONF}) 25622347Spst.include "${__MAKE_CONF}" 25722347Spst.endif 25822347Spst 25922347Spst# Default executable format 26022347Spst# XXX hint for bsd.port.mk 26122347SpstOBJFORMAT?= elf 26222347Spst 26322347Spst# Toggle on warnings 26422347Spst.WARN: dirsyntax 26522347Spst 26622347Spst.endif 26722347Spst 26822347Spst.include <bsd.compat.mk> 26922347Spst.include <bsd.cpu.mk> 27022347Spst