sys.mk revision 28945
170583Sobrien# from: @(#)sys.mk 8.2 (Berkeley) 3/21/94 2178628Smarcel# $Id: sys.mk,v 1.23 1997/04/13 06:44:25 jkh Exp $ 370583Sobrien 470583Sobrienunix ?= We run FreeBSD, not UNIX. 570583Sobrien 670583Sobrien# If the special target .POSIX appears (without prerequisites or 770583Sobrien# commands) before the first noncomment line in the makefile, make shall 8178628Smarcel# process the makefile as specified by the Posix 1003.2 specification. 970583Sobrien# make(1) sets the special macro %POSIX in this case (to the actual 1070583Sobrien# value "1003.2", for what it's worth). 1170583Sobrien# 1270583Sobrien# The rules below use this macro to distinguish between Posix-compliant 1370583Sobrien# and default behaviour. 1470583Sobrien 15178628Smarcel.if defined(%POSIX) 16178628Smarcel.SUFFIXES: .o .c .y .l .a .sh .f 17178628Smarcel.else 18178628Smarcel.SUFFIXES: .out .a .ln .o .c .cc .cxx .C .F .f .e .r .y .l .S .s .cl .p .h .sh 19178628Smarcel.endif 20178628Smarcel 21178628Smarcel.LIBS: .a 22178628Smarcel 23178628SmarcelX11BASE ?= /usr/X11R6 24178628Smarcel 2570583SobrienAR ?= ar 2670583Sobrien.if defined(%POSIX) 27178628SmarcelARFLAGS ?= -rv 28178628Smarcel.else 29178628SmarcelARFLAGS ?= rl 3070583Sobrien.endif 3170583SobrienRANLIB ?= ranlib 32178628Smarcel 33192109SrajAS ?= as 34178628SmarcelAFLAGS ?= 35222813Sattilio 36212170Sgrehan.if defined(%POSIX) 37254025SjeffCC ?= c89 38212170Sgrehan.else 39178628SmarcelCC ?= cc 4070583Sobrien.endif 41178628SmarcelCFLAGS ?= -O 4276078Sjhb 4370583SobrienCXX ?= c++ 44194933SjeffCXXFLAGS ?= ${CXXINCLUDES} ${CFLAGS} 45194933Sjeff 46194933SjeffCPP ?= cpp 47194933Sjeff 48194933Sjeff.if ${.MAKEFLAGS:M-s} == "" 49194933SjeffECHO ?= echo 50194933SjeffECHODIR ?= echo 51178628Smarcel.else 52178628SmarcelECHO ?= true 53178628Smarcel.if ${.MAKEFLAGS:M-s} == "-s" 54220638SandreastECHODIR ?= echo 55192067Snwhitehorn.else 56192109SrajECHODIR ?= true 57260674Sjhibbits.endif 58178628Smarcel.endif 5970583Sobrien 60178628Smarcel.if defined(%POSIX) 6170583SobrienFC ?= fort77 62178628SmarcelFFLAGS ?= -O 1 6370583Sobrien.else 64178628SmarcelFC ?= f77 65192109SrajFFLAGS ?= -O 66192109Sraj.endif 67192109SrajEFLAGS ?= 68212170Sgrehan 69220638SandreastINSTALL ?= install 70260674Sjhibbits 71178628SmarcelLEX ?= lex 72178628SmarcelLFLAGS ?= 73183060Smarcel 74178628SmarcelLD ?= ld 75260674SjhibbitsLDFLAGS ?= 76198378Snwhitehorn 77192109SrajLINT ?= lint 78192109SrajLINTFLAGS ?= -chapbx 79192109Sraj 80178628SmarcelMAKE ?= make 81192109Sraj 82178628SmarcelPC ?= pc 83178628SmarcelPFLAGS ?= 84192109Sraj 85215160SnwhitehornRC ?= f77 86215160SnwhitehornRFLAGS ?= 87215160Snwhitehorn 88215160SnwhitehornSHELL ?= sh 89215160Snwhitehorn 90212453SmavYACC ?= yacc 91215160Snwhitehorn.if defined(%POSIX) 92192109SrajYFLAGS ?= 93178628Smarcel.else 94255417SnwhitehornYFLAGS ?= -d 95255417Snwhitehorn.endif 96255417Snwhitehorn 97212170Sgrehan# For tags rule. 98212170SgrehanGTAGSFLAGS= -se 99212170SgrehanHTAGSFLAGS= 100198378Snwhitehorn 101212170Sgrehan# Binary file format 102178628SmarcelBINFORMAT?= aout 103212556Smav 104212556Smav.if defined(%POSIX) 105212556Smav# Posix 1003.2 mandated rules 106198378Snwhitehorn# 107178628Smarcel# Quoted directly from the Posix 1003.2 draft, only the macros 108178628Smarcel# $@, $< and $* have been replaced by ${.TARGET}, ${.IMPSRC}, and 109178628Smarcel# ${.PREFIX}, resp. 110122947Sjhb 111122947Sjhb# SINGLE SUFFIX RULES 112122947Sjhb.c: 113178628Smarcel ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC} 114178628Smarcel 115178628Smarcel.f: 116178628Smarcel ${FC} ${FFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC} 117192067Snwhitehorn 118178628Smarcel.sh: 119178628Smarcel cp ${.IMPSRC} ${.TARGET} 120192067Snwhitehorn chmod a+x ${.TARGET} 121178628Smarcel 122178628Smarcel# DOUBLE SUFFIX RULES 123178628Smarcel 124178628Smarcel.c.o: 125178628Smarcel ${CC} ${CFLAGS} -c ${.IMPSRC} 126178628Smarcel 127178628Smarcel.f.o: 128178628Smarcel ${FC} ${FFLAGS} -c ${.IMPSRC} 129178628Smarcel 130178628Smarcel.y.o: 131122947Sjhb ${YACC} ${YFLAGS} ${.IMPSRC} 132122947Sjhb ${CC} ${CFLAGS} -c y.tab.c 13370583Sobrien rm -f y.tab.c 13476442Sjhb mv y.tab.o ${.TARGET} 13570583Sobrien 136178628Smarcel.l.o: 137178628Smarcel ${LEX} ${LFLAGS} ${.IMPSRC} 138178628Smarcel ${CC} ${CFLAGS} -c lex.yy.c 139178628Smarcel rm -f lex.yy.c 140178628Smarcel mv lex.yy.o ${.TARGET} 14170583Sobrien 14270583Sobrien.y.c: 14370583Sobrien ${YACC} ${YFLAGS} ${.IMPSRC} 14476442Sjhb mv y.tab.c ${.TARGET} 14570583Sobrien 146178628Smarcel.l.c: 147178628Smarcel ${LEX} ${LFLAGS} ${.IMPSRC} 148178628Smarcel mv lex.yy.c ${.TARGET} 149178628Smarcel 150192067Snwhitehorn.c.a: 151178628Smarcel ${CC} ${CFLAGS} -c ${.IMPSRC} 152178628Smarcel ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 153178628Smarcel rm -f ${.PREFIX}.o 154192067Snwhitehorn 155178628Smarcel.f.a: 156178628Smarcel ${FC} ${FFLAGS} -c ${.IMPSRC} 157178628Smarcel ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 158178628Smarcel rm -f ${.PREFIX}.o 159178628Smarcel 160178628Smarcel.else 161222813Sattilio 162178628Smarcel# non-Posix rule set 163178628Smarcel 164178628Smarcel.c: 165178628Smarcel ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} 166178628Smarcel 167194784Sjeff.sh: 168194784Sjeff cp -p ${.IMPSRC} ${.TARGET} 169178628Smarcel chmod a+x ${.TARGET} 170254025Sjeff 171254025Sjeff.c.o: 172178628Smarcel ${CC} ${CFLAGS} -c ${.IMPSRC} 173194784Sjeff 174178628Smarcel.cc.o .cxx.o .C.o: 175178628Smarcel ${CXX} ${CXXFLAGS} -c ${.IMPSRC} 176178628Smarcel 177178628Smarcel.p.o: 178178628Smarcel ${PC} ${PFLAGS} -c ${.IMPSRC} 179178628Smarcel 180223758Sattilio.e.o .r.o .F.o .f.o: 181192109Sraj ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} -c ${.IMPSRC} 182192067Snwhitehorn 183178628Smarcel.S.o: 18470583Sobrien ${CC} ${CFLAGS} -c ${.IMPSRC} 18570583Sobrien 18670583Sobrien.s.o: 18776442Sjhb ${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC} 18870583Sobrien 189178628Smarcel# XXX not -j safe 190178628Smarcel.y.o: 191178628Smarcel ${YACC} ${YFLAGS} ${.IMPSRC} 192178628Smarcel ${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET} 193178628Smarcel rm -f y.tab.c 194178628Smarcel 195178628Smarcel.l.o: 196209975Snwhitehorn ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c 197178628Smarcel ${CC} ${CFLAGS} -c ${.PREFIX}.tmp.c -o ${.TARGET} 198178628Smarcel rm -f ${.PREFIX}.tmp.c 199178628Smarcel 200178628Smarcel# XXX not -j safe 20170583Sobrien.y.c: 202178628Smarcel ${YACC} ${YFLAGS} ${.IMPSRC} 203178628Smarcel mv y.tab.c ${.TARGET} 204178628Smarcel 205178628Smarcel.l.c: 206178628Smarcel ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.TARGET} 207192109Sraj 208178628Smarcel.s.out .c.out .o.out: 209178628Smarcel ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} 210178628Smarcel 211178628Smarcel.f.out .F.out .r.out .e.out: 212212170Sgrehan ${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} \ 213212170Sgrehan ${LDLIBS} -o ${.TARGET} 214178628Smarcel rm -f ${.PREFIX}.o 215178628Smarcel 216222531Snwhitehorn# XXX not -j safe 217178628Smarcel.y.out: 218178628Smarcel ${YACC} ${YFLAGS} ${.IMPSRC} 219192109Sraj ${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET} 220192109Sraj rm -f y.tab.c 221209975Snwhitehorn 222192109Sraj.l.out: 223192067Snwhitehorn ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c 224192109Sraj ${CC} ${CFLAGS} ${LDFLAGS} ${.PREFIX}.tmp.c ${LDLIBS} -ll -o ${.TARGET} 225192109Sraj rm -f ${.PREFIX}.tmp.c 226192109Sraj 227192109Sraj.endif 228192109Sraj 229178628Smarcel.include <bsd.own.mk> 230192109Sraj 231178628Smarcel.if exists(/etc/make.conf) 232178628Smarcel.include </etc/make.conf> 233192109Sraj.endif 234192109Sraj