sys.mk revision 33685
11556Srgrimes# from: @(#)sys.mk 8.2 (Berkeley) 3/21/94 21556Srgrimes# $Id: sys.mk,v 1.28 1998/01/21 01:03:51 jb Exp $ 31556Srgrimes 41556Srgrimesunix ?= We run FreeBSD, not UNIX. 51556Srgrimes 61556Srgrimes# If the special target .POSIX appears (without prerequisites or 71556Srgrimes# commands) before the first noncomment line in the makefile, make shall 81556Srgrimes# process the makefile as specified by the Posix 1003.2 specification. 91556Srgrimes# make(1) sets the special macro %POSIX in this case (to the actual 101556Srgrimes# value "1003.2", for what it's worth). 111556Srgrimes# 121556Srgrimes# The rules below use this macro to distinguish between Posix-compliant 131556Srgrimes# and default behaviour. 141556Srgrimes 151556Srgrimes.if defined(%POSIX) 161556Srgrimes.SUFFIXES: .o .c .y .l .a .sh .f 171556Srgrimes.else 181556Srgrimes.SUFFIXES: .out .a .ln .o .c .cc .cxx .C .F .f .e .r .y .l .S .s .cl .p .h .sh 191556Srgrimes.endif 201556Srgrimes 211556Srgrimes.LIBS: .a 221556Srgrimes 231556SrgrimesX11BASE ?= /usr/X11R6 241556Srgrimes 251556SrgrimesAR ?= ar 261556Srgrimes.if defined(%POSIX) 271556SrgrimesARFLAGS ?= -rv 281556Srgrimes.else 291556SrgrimesARFLAGS ?= rl 301556Srgrimes.endif 311556SrgrimesRANLIB ?= ranlib 321556Srgrimes 331556SrgrimesAS ?= as 341556SrgrimesAFLAGS ?= 351556Srgrimes 361556Srgrimes.if defined(%POSIX) 371556SrgrimesCC ?= c89 3827967Ssteve.else 3927967SsteveCC ?= cc 4027967Ssteve.endif 4127958SsteveCFLAGS ?= -O 4250471Speter 4327967SsteveCXX ?= c++ 441556SrgrimesCXXFLAGS ?= ${CXXINCLUDES} ${CFLAGS} 451556Srgrimes 461556SrgrimesCPP ?= cpp 471556Srgrimes 481556Srgrimes.if ${.MAKEFLAGS:M-s} == "" 491556SrgrimesECHO ?= echo 501556SrgrimesECHODIR ?= echo 511556Srgrimes.else 521556SrgrimesECHO ?= true 531556Srgrimes.if ${.MAKEFLAGS:M-s} == "-s" 541556SrgrimesECHODIR ?= echo 551556Srgrimes.else 561556SrgrimesECHODIR ?= true 571556Srgrimes.endif 581556Srgrimes.endif 5961178Sjoe 601556Srgrimes.if defined(%POSIX) 611556SrgrimesFC ?= fort77 621556SrgrimesFFLAGS ?= -O 1 631556Srgrimes.else 641556SrgrimesFC ?= f77 651556SrgrimesFFLAGS ?= -O 661556Srgrimes.endif 671556SrgrimesEFLAGS ?= 681556Srgrimes 691556SrgrimesINSTALL ?= install 701556Srgrimes 7161178SjoeLEX ?= lex 7261178SjoeLFLAGS ?= 7361178Sjoe 7461178SjoeLD ?= ld 7561178SjoeLDFLAGS ?= 7661178Sjoe 7761178SjoeLINT ?= lint 7861178SjoeLINTFLAGS ?= -chapbx 7961178Sjoe 8061178SjoeMAKE ?= make 8161178Sjoe 8261178SjoePC ?= pc 8361178SjoePFLAGS ?= 8461178Sjoe 8561178SjoeRC ?= f77 8661178SjoeRFLAGS ?= 8761178Sjoe 8861178SjoeSHELL ?= sh 8961178Sjoe 9061178SjoeYACC ?= yacc 911556Srgrimes.if defined(%POSIX) 921556SrgrimesYFLAGS ?= 931556Srgrimes.else 941556SrgrimesYFLAGS ?= -d 951556Srgrimes.endif 961556Srgrimes 971556Srgrimes# FreeBSD/i386 as traditionally been built with a version of make 981556Srgrimes# which knows MACHINE, but not MACHINE_ARCH. When building on other 991556Srgrimes# architectures, assume that the version of make being used has an 1001556Srgrimes# explicit MACHINE_ARCH setting and treat a missing MACHINE_ARCH 1011556Srgrimes# as an i386 architecture. 1021556SrgrimesMACHINE_ARCH?= i386 1031556Srgrimes 1041556Srgrimes# Default executable format 1051556Srgrimes.if ${MACHINE_ARCH} == "alpha" 1061556SrgrimesBINFORMAT ?= elf 1071556Srgrimes.else 1081556SrgrimesBINFORMAT ?= aout 1091556Srgrimes.endif 1101556Srgrimes 1111556Srgrimes# For tags rule. 1121556SrgrimesGTAGSFLAGS= 1131556SrgrimesHTAGSFLAGS= 1141556Srgrimes 1151556Srgrimes.if defined(%POSIX) 1161556Srgrimes# Posix 1003.2 mandated rules 1171556Srgrimes# 1181556Srgrimes# Quoted directly from the Posix 1003.2 draft, only the macros 1191556Srgrimes# $@, $< and $* have been replaced by ${.TARGET}, ${.IMPSRC}, and 1201556Srgrimes# ${.PREFIX}, resp. 1211556Srgrimes 12220417Ssteve# SINGLE SUFFIX RULES 1231556Srgrimes.c: 1241556Srgrimes ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC} 1251556Srgrimes 1261556Srgrimes.f: 1271556Srgrimes ${FC} ${FFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC} 1281556Srgrimes 1291556Srgrimes.sh: 1301556Srgrimes cp ${.IMPSRC} ${.TARGET} 1311556Srgrimes chmod a+x ${.TARGET} 1321556Srgrimes 1331556Srgrimes# DOUBLE SUFFIX RULES 13455514Sbde 13513120Sjoerg.c.o: 13655514Sbde ${CC} ${CFLAGS} -c ${.IMPSRC} 13755514Sbde 13813120Sjoerg.f.o: 13913120Sjoerg ${FC} ${FFLAGS} -c ${.IMPSRC} 14013120Sjoerg 1411556Srgrimes.y.o: 1421556Srgrimes ${YACC} ${YFLAGS} ${.IMPSRC} 1431556Srgrimes ${CC} ${CFLAGS} -c y.tab.c 1441556Srgrimes rm -f y.tab.c 1451556Srgrimes mv y.tab.o ${.TARGET} 1461556Srgrimes 1471556Srgrimes.l.o: 1481556Srgrimes ${LEX} ${LFLAGS} ${.IMPSRC} 1491556Srgrimes ${CC} ${CFLAGS} -c lex.yy.c 1501556Srgrimes rm -f lex.yy.c 1511556Srgrimes mv lex.yy.o ${.TARGET} 15261178Sjoe 15361178Sjoe.y.c: 15435417Sdes ${YACC} ${YFLAGS} ${.IMPSRC} 15535373Sdes mv y.tab.c ${.TARGET} 15661178Sjoe 15761178Sjoe.l.c: 1581556Srgrimes ${LEX} ${LFLAGS} ${.IMPSRC} 1591556Srgrimes mv lex.yy.c ${.TARGET} 1601556Srgrimes 1611556Srgrimes.c.a: 1621556Srgrimes ${CC} ${CFLAGS} -c ${.IMPSRC} 1631556Srgrimes ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 1641556Srgrimes rm -f ${.PREFIX}.o 1651556Srgrimes 1661556Srgrimes.f.a: 1671556Srgrimes ${FC} ${FFLAGS} -c ${.IMPSRC} 1681556Srgrimes ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 1691556Srgrimes rm -f ${.PREFIX}.o 1701556Srgrimes 1711556Srgrimes.else 1721556Srgrimes 1731556Srgrimes# non-Posix rule set 1741556Srgrimes 1751556Srgrimes.c: 17637932Shoek ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} 1771556Srgrimes 17837932Shoek.sh: 17937932Shoek cp -p ${.IMPSRC} ${.TARGET} 18037932Shoek chmod a+x ${.TARGET} 18137932Shoek 18237932Shoek.c.o: 1831556Srgrimes ${CC} ${CFLAGS} -c ${.IMPSRC} 1841556Srgrimes 1851556Srgrimes.cc.o .cxx.o .C.o: 1861556Srgrimes ${CXX} ${CXXFLAGS} -c ${.IMPSRC} 1871556Srgrimes 1881556Srgrimes.p.o: 1891556Srgrimes ${PC} ${PFLAGS} -c ${.IMPSRC} 1901556Srgrimes 1911556Srgrimes.e.o .r.o .F.o .f.o: 1921556Srgrimes ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} -c ${.IMPSRC} 1931556Srgrimes 1941556Srgrimes.S.o: 1951556Srgrimes ${CC} ${CFLAGS} -c ${.IMPSRC} 1961556Srgrimes 1971556Srgrimes.s.o: 1981556Srgrimes ${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC} 1991556Srgrimes 2001556Srgrimes# XXX not -j safe 2011556Srgrimes.y.o: 2021556Srgrimes ${YACC} ${YFLAGS} ${.IMPSRC} 2031556Srgrimes ${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET} 2041556Srgrimes rm -f y.tab.c 2051556Srgrimes 2061556Srgrimes.l.o: 20737932Shoek ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c 2081556Srgrimes ${CC} ${CFLAGS} -c ${.PREFIX}.tmp.c -o ${.TARGET} 2091556Srgrimes rm -f ${.PREFIX}.tmp.c 2101556Srgrimes 2111556Srgrimes# XXX not -j safe 2121556Srgrimes.y.c: 2131556Srgrimes ${YACC} ${YFLAGS} ${.IMPSRC} 2141556Srgrimes mv y.tab.c ${.TARGET} 2151556Srgrimes 2161556Srgrimes.l.c: 2171556Srgrimes ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.TARGET} 2181556Srgrimes 2191556Srgrimes.s.out .c.out .o.out: 2201556Srgrimes ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} 2211556Srgrimes 2221556Srgrimes.f.out .F.out .r.out .e.out: 2231556Srgrimes ${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} \ 2241556Srgrimes ${LDLIBS} -o ${.TARGET} 2251556Srgrimes rm -f ${.PREFIX}.o 2261556Srgrimes 22761178Sjoe# XXX not -j safe 22861178Sjoe.y.out: 22961178Sjoe ${YACC} ${YFLAGS} ${.IMPSRC} 23061178Sjoe ${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET} 23161178Sjoe rm -f y.tab.c 23261178Sjoe 23361178Sjoe.l.out: 23461178Sjoe ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c 23561178Sjoe ${CC} ${CFLAGS} ${LDFLAGS} ${.PREFIX}.tmp.c ${LDLIBS} -ll -o ${.TARGET} 23661178Sjoe rm -f ${.PREFIX}.tmp.c 23737932Shoek 23837932Shoek.endif 23937932Shoek 2401556Srgrimes.include <bsd.own.mk> 2411556Srgrimes 2421556Srgrimes.if exists(/etc/make.conf) 2431556Srgrimes.include </etc/make.conf> 2441556Srgrimes.endif 2451556Srgrimes