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