1415bccaaSBruce Evans# from: @(#)sys.mk 8.2 (Berkeley) 3/21/94 27f3dea24SPeter Wemm# $FreeBSD$ 3afe61c15SRodney W. Grimes 4415bccaaSBruce Evansunix ?= We run FreeBSD, not UNIX. 53f5a93f6SDavid E. O'Brien.FreeBSD ?= true 6afe61c15SRodney W. Grimes 72be2be74SSteve Price# If the special target .POSIX appears (without prerequisites or 82be2be74SSteve Price# commands) before the first noncomment line in the makefile, make shall 92be2be74SSteve Price# process the makefile as specified by the Posix 1003.2 specification. 102be2be74SSteve Price# make(1) sets the special macro %POSIX in this case (to the actual 112be2be74SSteve Price# value "1003.2", for what it's worth). 122be2be74SSteve Price# 132be2be74SSteve Price# The rules below use this macro to distinguish between Posix-compliant 142be2be74SSteve Price# and default behaviour. 152be2be74SSteve Price 162be2be74SSteve Price.if defined(%POSIX) 172be2be74SSteve Price.SUFFIXES: .o .c .y .l .a .sh .f 182be2be74SSteve Price.else 19d58e932fSRuslan Ermilov.SUFFIXES: .out .a .ln .o .c .cc .cpp .cxx .C .m .F .f .e .r .y .l .S .asm .s .cl .p .h .sh 202be2be74SSteve Price.endif 21afe61c15SRodney W. Grimes 22957c6635SPoul-Henning KampX11BASE ?= /usr/X11R6 2374a3c654SJordan K. Hubbard 24415bccaaSBruce EvansAR ?= ar 252be2be74SSteve Price.if defined(%POSIX) 262be2be74SSteve PriceARFLAGS ?= -rv 272be2be74SSteve Price.else 28415bccaaSBruce EvansARFLAGS ?= rl 292be2be74SSteve Price.endif 30415bccaaSBruce EvansRANLIB ?= ranlib 31afe61c15SRodney W. Grimes 32415bccaaSBruce EvansAS ?= as 33415bccaaSBruce EvansAFLAGS ?= 34afe61c15SRodney W. Grimes 352be2be74SSteve Price.if defined(%POSIX) 362be2be74SSteve PriceCC ?= c89 37d17387acSBruce EvansCFLAGS ?= -O 382be2be74SSteve Price.else 39415bccaaSBruce EvansCC ?= cc 4094e9e9fdSJordan K. HubbardCFLAGS ?= -O -pipe 41d17387acSBruce Evans.endif 42afe61c15SRodney W. Grimes 43443dced5SPaul RichardsCXX ?= c++ 44611b4102SDag-Erling SmørgravCXXFLAGS ?= ${CFLAGS:N-std=*:N-Wnested-externs:N-W*-prototypes} 45afe61c15SRodney W. Grimes 46415bccaaSBruce EvansCPP ?= cpp 47afe61c15SRodney W. Grimes 4865d2bdc6SRuslan Ermilov.if empty(.MAKEFLAGS:M-s) 49415bccaaSBruce EvansECHO ?= echo 50415bccaaSBruce EvansECHODIR ?= echo 51415bccaaSBruce Evans.else 52415bccaaSBruce EvansECHO ?= true 53415bccaaSBruce Evans.if ${.MAKEFLAGS:M-s} == "-s" 54415bccaaSBruce EvansECHODIR ?= echo 55415bccaaSBruce Evans.else 56415bccaaSBruce EvansECHODIR ?= true 57415bccaaSBruce Evans.endif 58415bccaaSBruce Evans.endif 59afe61c15SRodney W. Grimes 602be2be74SSteve Price.if defined(%POSIX) 612be2be74SSteve PriceFC ?= fort77 622be2be74SSteve PriceFFLAGS ?= -O 1 632be2be74SSteve Price.else 64415bccaaSBruce EvansFC ?= f77 65415bccaaSBruce EvansFFLAGS ?= -O 662be2be74SSteve Price.endif 67415bccaaSBruce EvansEFLAGS ?= 68afe61c15SRodney W. Grimes 69c7499507SAndrey A. ChernovINSTALL ?= install 70c7499507SAndrey A. Chernov 71415bccaaSBruce EvansLEX ?= lex 72415bccaaSBruce EvansLFLAGS ?= 73afe61c15SRodney W. Grimes 74415bccaaSBruce EvansLD ?= ld 75415bccaaSBruce EvansLDFLAGS ?= 76afe61c15SRodney W. Grimes 77415bccaaSBruce EvansLINT ?= lint 78bd42830fSRuslan ErmilovLINTFLAGS ?= -cghapbx 79766f7d6eSMark MurrayLINTKERNFLAGS ?= ${LINTFLAGS} 80766f7d6eSMark MurrayLINTOBJFLAGS ?= -cghapbxu -i 8134d81580SMark MurrayLINTOBJKERNFLAGS?= ${LINTOBJFLAGS} 82766f7d6eSMark MurrayLINTLIBFLAGS ?= -cghapbxu -C ${LIB} 83afe61c15SRodney W. Grimes 84415bccaaSBruce EvansMAKE ?= make 85afe61c15SRodney W. Grimes 8670a6e331SBruce EvansOBJC ?= cc 8770a6e331SBruce EvansOBJCFLAGS ?= ${OBJCINCLUDES} ${CFLAGS} -Wno-import 8870a6e331SBruce Evans 89415bccaaSBruce EvansPC ?= pc 90415bccaaSBruce EvansPFLAGS ?= 91afe61c15SRodney W. Grimes 92415bccaaSBruce EvansRC ?= f77 93415bccaaSBruce EvansRFLAGS ?= 94415bccaaSBruce Evans 95415bccaaSBruce EvansSHELL ?= sh 96415bccaaSBruce Evans 97415bccaaSBruce EvansYACC ?= yacc 982be2be74SSteve Price.if defined(%POSIX) 992be2be74SSteve PriceYFLAGS ?= 1002be2be74SSteve Price.else 101415bccaaSBruce EvansYFLAGS ?= -d 1022be2be74SSteve Price.endif 1032be2be74SSteve Price 104e926b4eeSKris Kennaway# FreeBSD/i386 has traditionally been built with a version of make 1055ec0ebbbSJohn Birrell# which knows MACHINE, but not MACHINE_ARCH. When building on other 1065ec0ebbbSJohn Birrell# architectures, assume that the version of make being used has an 1075ec0ebbbSJohn Birrell# explicit MACHINE_ARCH setting and treat a missing MACHINE_ARCH 1084183193eSKris Kennaway# as an i386 architecture. 1095ec0ebbbSJohn BirrellMACHINE_ARCH ?= i386 1105ec0ebbbSJohn Birrell 1112be2be74SSteve Price.if defined(%POSIX) 1128d962594SBruce Evans 1132be2be74SSteve Price# Posix 1003.2 mandated rules 1142be2be74SSteve Price# 1152be2be74SSteve Price# Quoted directly from the Posix 1003.2 draft, only the macros 1162be2be74SSteve Price# $@, $< and $* have been replaced by ${.TARGET}, ${.IMPSRC}, and 1172be2be74SSteve Price# ${.PREFIX}, resp. 1182be2be74SSteve Price 1192be2be74SSteve Price# SINGLE SUFFIX RULES 1202be2be74SSteve Price.c: 12132b97f0bSAlexander Langer ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC} 1222be2be74SSteve Price 1232be2be74SSteve Price.f: 12432b97f0bSAlexander Langer ${FC} ${FFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC} 1252be2be74SSteve Price 1262be2be74SSteve Price.sh: 1272be2be74SSteve Price cp ${.IMPSRC} ${.TARGET} 1282be2be74SSteve Price chmod a+x ${.TARGET} 1292be2be74SSteve Price 1302be2be74SSteve Price# DOUBLE SUFFIX RULES 1312be2be74SSteve Price 1322be2be74SSteve Price.c.o: 13332b97f0bSAlexander Langer ${CC} ${CFLAGS} -c ${.IMPSRC} 1342be2be74SSteve Price 1352be2be74SSteve Price.f.o: 13632b97f0bSAlexander Langer ${FC} ${FFLAGS} -c ${.IMPSRC} 1372be2be74SSteve Price 1382be2be74SSteve Price.y.o: 13932b97f0bSAlexander Langer ${YACC} ${YFLAGS} ${.IMPSRC} 14032b97f0bSAlexander Langer ${CC} ${CFLAGS} -c y.tab.c 141fc936cbdSDavid E. O'Brien rm -f y.tab.c 1422be2be74SSteve Price mv y.tab.o ${.TARGET} 1432be2be74SSteve Price 1442be2be74SSteve Price.l.o: 14532b97f0bSAlexander Langer ${LEX} ${LFLAGS} ${.IMPSRC} 14632b97f0bSAlexander Langer ${CC} ${CFLAGS} -c lex.yy.c 147fc936cbdSDavid E. O'Brien rm -f lex.yy.c 1482be2be74SSteve Price mv lex.yy.o ${.TARGET} 1492be2be74SSteve Price 1502be2be74SSteve Price.y.c: 15132b97f0bSAlexander Langer ${YACC} ${YFLAGS} ${.IMPSRC} 1522be2be74SSteve Price mv y.tab.c ${.TARGET} 1532be2be74SSteve Price 1542be2be74SSteve Price.l.c: 15532b97f0bSAlexander Langer ${LEX} ${LFLAGS} ${.IMPSRC} 1562be2be74SSteve Price mv lex.yy.c ${.TARGET} 1572be2be74SSteve Price 1582be2be74SSteve Price.c.a: 15932b97f0bSAlexander Langer ${CC} ${CFLAGS} -c ${.IMPSRC} 16032b97f0bSAlexander Langer ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 161fc936cbdSDavid E. O'Brien rm -f ${.PREFIX}.o 1622be2be74SSteve Price 1632be2be74SSteve Price.f.a: 16432b97f0bSAlexander Langer ${FC} ${FFLAGS} -c ${.IMPSRC} 16532b97f0bSAlexander Langer ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 166fc936cbdSDavid E. O'Brien rm -f ${.PREFIX}.o 1672be2be74SSteve Price 1682be2be74SSteve Price.else 1692be2be74SSteve Price 1702be2be74SSteve Price# non-Posix rule set 171415bccaaSBruce Evans 172a9076ea0SBruce Evans.sh: 173a9076ea0SBruce Evans cp -p ${.IMPSRC} ${.TARGET} 174a9076ea0SBruce Evans chmod a+x ${.TARGET} 175afe61c15SRodney W. Grimes 1765741a42fSMark Murray.c.ln: 1775741a42fSMark Murray ${LINT} ${LINTOBJFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC} || \ 1785741a42fSMark Murray touch ${.TARGET} 1795741a42fSMark Murray 1805741a42fSMark Murray.cc.ln .C.ln .cpp.ln .cxx.ln: 1815741a42fSMark Murray ${LINT} ${LINTOBJFLAGS} ${CXXFLAGS:M-[DIU]*} ${.IMPSRC} || \ 1825741a42fSMark Murray touch ${.TARGET} 1835741a42fSMark Murray 184eb73cacdSDavid E. O'Brien.c: 185eb73cacdSDavid E. O'Brien ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} 186eb73cacdSDavid E. O'Brien 187afe61c15SRodney W. Grimes.c.o: 188afe61c15SRodney W. Grimes ${CC} ${CFLAGS} -c ${.IMPSRC} 189afe61c15SRodney W. Grimes 190eb73cacdSDavid E. O'Brien.cc .cpp .cxx .C: 191eb73cacdSDavid E. O'Brien ${CXX} ${CXXFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} 192eb73cacdSDavid E. O'Brien 193c7cbe79eSDmitrij Tejblum.cc.o .cpp.o .cxx.o .C.o: 1943585b293SGarrett Wollman ${CXX} ${CXXFLAGS} -c ${.IMPSRC} 1953585b293SGarrett Wollman 19670a6e331SBruce Evans.m.o: 19770a6e331SBruce Evans ${OBJC} ${OBJCFLAGS} -c ${.IMPSRC} 19870a6e331SBruce Evans 199afe61c15SRodney W. Grimes.p.o: 200afe61c15SRodney W. Grimes ${PC} ${PFLAGS} -c ${.IMPSRC} 201afe61c15SRodney W. Grimes 2027b91cad9SDavid E. O'Brien.e .r .F .f: 2037b91cad9SDavid E. O'Brien ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} \ 2047b91cad9SDavid E. O'Brien -o ${.TARGET} 2057b91cad9SDavid E. O'Brien 206afe61c15SRodney W. Grimes.e.o .r.o .F.o .f.o: 207afe61c15SRodney W. Grimes ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} -c ${.IMPSRC} 208afe61c15SRodney W. Grimes 209ea569569SRodney W. Grimes.S.o: 210a51613b6SRuslan Ermilov ${CC} ${CFLAGS} -c ${.IMPSRC} 211ea569569SRodney W. Grimes 212d58e932fSRuslan Ermilov.asm.o: 213d58e932fSRuslan Ermilov ${CC} -x assembler-with-cpp ${CFLAGS} -c ${.IMPSRC} 214d58e932fSRuslan Ermilov 215d58e932fSRuslan Ermilov.s.o: 216e517d11eSDavid E. O'Brien ${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC} 217e517d11eSDavid E. O'Brien 218006f5fe0SPoul-Henning Kamp# XXX not -j safe 219afe61c15SRodney W. Grimes.y.o: 220006f5fe0SPoul-Henning Kamp ${YACC} ${YFLAGS} ${.IMPSRC} 221006f5fe0SPoul-Henning Kamp ${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET} 222fc936cbdSDavid E. O'Brien rm -f y.tab.c 223afe61c15SRodney W. Grimes 224afe61c15SRodney W. Grimes.l.o: 22550ef9020SPoul-Henning Kamp ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c 22650ef9020SPoul-Henning Kamp ${CC} ${CFLAGS} -c ${.PREFIX}.tmp.c -o ${.TARGET} 227fc936cbdSDavid E. O'Brien rm -f ${.PREFIX}.tmp.c 228afe61c15SRodney W. Grimes 229c3e3432cSSteve Price# XXX not -j safe 230afe61c15SRodney W. Grimes.y.c: 231c3e3432cSSteve Price ${YACC} ${YFLAGS} ${.IMPSRC} 232c3e3432cSSteve Price mv y.tab.c ${.TARGET} 233afe61c15SRodney W. Grimes 234afe61c15SRodney W. Grimes.l.c: 23550ef9020SPoul-Henning Kamp ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.TARGET} 236afe61c15SRodney W. Grimes 237afe61c15SRodney W. Grimes.s.out .c.out .o.out: 238a9076ea0SBruce Evans ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} 239afe61c15SRodney W. Grimes 240afe61c15SRodney W. Grimes.f.out .F.out .r.out .e.out: 241a9076ea0SBruce Evans ${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} \ 242afe61c15SRodney W. Grimes ${LDLIBS} -o ${.TARGET} 243fc936cbdSDavid E. O'Brien rm -f ${.PREFIX}.o 244afe61c15SRodney W. Grimes 245006f5fe0SPoul-Henning Kamp# XXX not -j safe 246afe61c15SRodney W. Grimes.y.out: 247006f5fe0SPoul-Henning Kamp ${YACC} ${YFLAGS} ${.IMPSRC} 248006f5fe0SPoul-Henning Kamp ${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET} 249fc936cbdSDavid E. O'Brien rm -f y.tab.c 250afe61c15SRodney W. Grimes 251afe61c15SRodney W. Grimes.l.out: 25250ef9020SPoul-Henning Kamp ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c 25350ef9020SPoul-Henning Kamp ${CC} ${CFLAGS} ${LDFLAGS} ${.PREFIX}.tmp.c ${LDLIBS} -ll -o ${.TARGET} 254fc936cbdSDavid E. O'Brien rm -f ${.PREFIX}.tmp.c 2553585b293SGarrett Wollman 2568d962594SBruce Evans# FreeBSD build pollution. Hide it in the non-POSIX part of the ifdef. 2570af93efbSWarner Losh__MAKE_CONF?=/etc/make.conf 2580af93efbSWarner Losh.if exists(${__MAKE_CONF}) 2590af93efbSWarner Losh.include "${__MAKE_CONF}" 2603585b293SGarrett Wollman.endif 261a09e15f3SJohn Birrell 2622bdaf7e8SRuslan Ermilov# Default executable format 26366422f5bSPeter Wemm# XXX hint for bsd.port.mk 2642bdaf7e8SRuslan ErmilovOBJFORMAT?= elf 2658d962594SBruce Evans 2668d962594SBruce Evans.endif 2678d962594SBruce Evans 2688d962594SBruce Evans.include <bsd.cpu.mk> 269