1# from: @(#)sys.mk 8.2 (Berkeley) 3/21/94 2# $Id: sys.mk,v 1.41 1998/08/29 01:30:13 dillon Exp $ 3 4unix ?= We run FreeBSD, not UNIX. 5 6# If the special target .POSIX appears (without prerequisites or 7# commands) before the first noncomment line in the makefile, make shall 8# process the makefile as specified by the Posix 1003.2 specification. 9# make(1) sets the special macro %POSIX in this case (to the actual 10# value "1003.2", for what it's worth). 11# 12# The rules below use this macro to distinguish between Posix-compliant 13# and default behaviour. 14 15.if defined(%POSIX) 16.SUFFIXES: .o .c .y .l .a .sh .f 17.else 18.SUFFIXES: .out .a .ln .o .c .cc .cpp .cxx .C .m .F .f .e .r .y .l .S .s .cl .p .h .sh 19.endif 20 21.LIBS: .a 22 23X11BASE ?= /usr/X11R6 24 25AR ?= ar 26.if defined(%POSIX) 27ARFLAGS ?= -rv 28.else 29ARFLAGS ?= rl 30.endif 31RANLIB ?= ranlib 32 33AS ?= as 34AFLAGS ?= 35 36.if defined(%POSIX) 37CC ?= c89 38.else 39CC ?= cc 40.endif 41CFLAGS ?= -O -pipe 42 43CXX ?= c++ 44CXXFLAGS ?= ${CXXINCLUDES} ${CFLAGS} 45 46CPP ?= cpp 47 48.if ${.MAKEFLAGS:M-s} == "" 49ECHO ?= echo 50ECHODIR ?= echo 51.else 52ECHO ?= true 53.if ${.MAKEFLAGS:M-s} == "-s" 54ECHODIR ?= echo 55.else 56ECHODIR ?= true 57.endif 58.endif 59 60.if defined(%POSIX) 61FC ?= fort77 62FFLAGS ?= -O 1 63.else 64FC ?= f77 65FFLAGS ?= -O 66.endif 67EFLAGS ?= 68 69INSTALL ?= install 70 71LEX ?= lex 72LFLAGS ?= 73 74LD ?= ld 75LDFLAGS ?= 76 77LINT ?= lint 78LINTFLAGS ?= -chapbx 79 80MAKE ?= make 81 82OBJC ?= cc 83OBJCFLAGS ?= ${OBJCINCLUDES} ${CFLAGS} -Wno-import 84 85PC ?= pc 86PFLAGS ?= 87 88RC ?= f77 89RFLAGS ?= 90 91SHELL ?= sh 92 93YACC ?= yacc 94.if defined(%POSIX) 95YFLAGS ?= 96.else 97YFLAGS ?= -d 98.endif 99 100# FreeBSD/i386 as traditionally been built with a version of make 101# which knows MACHINE, but not MACHINE_ARCH. When building on other 102# architectures, assume that the version of make being used has an 103# explicit MACHINE_ARCH setting and treat a missing MACHINE_ARCH 104# as an i386 architecture. 105MACHINE_ARCH ?= i386 106 107# For tags rule. 108GTAGSFLAGS= -o 109HTAGSFLAGS= 110 111.if defined(%POSIX) 112# Posix 1003.2 mandated rules 113# 114# Quoted directly from the Posix 1003.2 draft, only the macros 115# $@, $< and $* have been replaced by ${.TARGET}, ${.IMPSRC}, and 116# ${.PREFIX}, resp. 117 118# SINGLE SUFFIX RULES 119.c: 120 ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC} 121 122.f: 123 ${FC} ${FFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC} 124 125.sh: 126 cp ${.IMPSRC} ${.TARGET} 127 chmod a+x ${.TARGET} 128 129# DOUBLE SUFFIX RULES 130 131.c.o: 132 ${CC} ${CFLAGS} -c ${.IMPSRC} 133 134.f.o: 135 ${FC} ${FFLAGS} -c ${.IMPSRC} 136 137.y.o: 138 ${YACC} ${YFLAGS} ${.IMPSRC} 139 ${CC} ${CFLAGS} -c y.tab.c 140 rm -f y.tab.c 141 mv y.tab.o ${.TARGET} 142 143.l.o: 144 ${LEX} ${LFLAGS} ${.IMPSRC} 145 ${CC} ${CFLAGS} -c lex.yy.c 146 rm -f lex.yy.c 147 mv lex.yy.o ${.TARGET} 148 149.y.c: 150 ${YACC} ${YFLAGS} ${.IMPSRC} 151 mv y.tab.c ${.TARGET} 152 153.l.c: 154 ${LEX} ${LFLAGS} ${.IMPSRC} 155 mv lex.yy.c ${.TARGET} 156 157.c.a: 158 ${CC} ${CFLAGS} -c ${.IMPSRC} 159 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 160 rm -f ${.PREFIX}.o 161 162.f.a: 163 ${FC} ${FFLAGS} -c ${.IMPSRC} 164 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 165 rm -f ${.PREFIX}.o 166 167.else 168 169# non-Posix rule set 170 171.c: 172 ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} 173 174.sh: 175 cp -p ${.IMPSRC} ${.TARGET} 176 chmod a+x ${.TARGET} 177 178.c.o: 179 ${CC} ${CFLAGS} -c ${.IMPSRC} 180 181.cc.o .cpp.o .cxx.o .C.o: 182 ${CXX} ${CXXFLAGS} -c ${.IMPSRC} 183 184.m.o: 185 ${OBJC} ${OBJCFLAGS} -c ${.IMPSRC} 186 187.p.o: 188 ${PC} ${PFLAGS} -c ${.IMPSRC} 189 190.e.o .r.o .F.o .f.o: 191 ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} -c ${.IMPSRC} 192 193.S.o: 194 ${CC} ${CFLAGS} -c ${.IMPSRC} 195 196.s.o: 197 ${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC} 198 199# XXX not -j safe 200.y.o: 201 ${YACC} ${YFLAGS} ${.IMPSRC} 202 ${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET} 203 rm -f y.tab.c 204 205.l.o: 206 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c 207 ${CC} ${CFLAGS} -c ${.PREFIX}.tmp.c -o ${.TARGET} 208 rm -f ${.PREFIX}.tmp.c 209 210# XXX not -j safe 211.y.c: 212 ${YACC} ${YFLAGS} ${.IMPSRC} 213 mv y.tab.c ${.TARGET} 214 215.l.c: 216 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.TARGET} 217 218.s.out .c.out .o.out: 219 ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} 220 221.f.out .F.out .r.out .e.out: 222 ${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} \ 223 ${LDLIBS} -o ${.TARGET} 224 rm -f ${.PREFIX}.o 225 226# XXX not -j safe 227.y.out: 228 ${YACC} ${YFLAGS} ${.IMPSRC} 229 ${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET} 230 rm -f y.tab.c 231 232.l.out: 233 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c 234 ${CC} ${CFLAGS} ${LDFLAGS} ${.PREFIX}.tmp.c ${LDLIBS} -ll -o ${.TARGET} 235 rm -f ${.PREFIX}.tmp.c 236 237.endif 238 239.if exists(/etc/make.conf) 240.include </etc/make.conf> 241.endif 242 243.if exists(/etc/make.conf.local) 244.include </etc/make.conf.local> 245.endif 246 247 248.include <bsd.own.mk> 249