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 .asm .s .cl .p .h .sh 20.endif 21 22X11BASE ?= /usr/X11R6 23 24AR ?= ar 25.if defined(%POSIX) 26ARFLAGS ?= -rv 27.else 28ARFLAGS ?= rl 29.endif 30RANLIB ?= ranlib 31 32AS ?= as 33AFLAGS ?= 34 35.if defined(%POSIX) 36CC ?= c89 37CFLAGS ?= -O 38.else 39CC ?= cc 40CFLAGS ?= -O2 -fno-strict-aliasing -pipe 41.endif 42 43CXX ?= c++ 44CXXFLAGS ?= ${CFLAGS:N-std=*:N-Wnested-externs:N-W*-prototypes} 45 46CPP ?= cpp 47 48.if empty(.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 !empty(.MAKEFLAGS:M-n) && ${.MAKEFLAGS:M-n} == "-n" 61_+_ ?= 62.else 63_+_ ?= + 64.endif 65 66.if defined(%POSIX) 67FC ?= fort77 68FFLAGS ?= -O 1 69.else 70FC ?= f77 71FFLAGS ?= -O 72.endif 73EFLAGS ?= 74 75INSTALL ?= install 76 77LEX ?= lex 78LFLAGS ?= 79 80LD ?= ld 81LDFLAGS ?= 82 83LINT ?= lint 84LINTFLAGS ?= -cghapbx 85LINTKERNFLAGS ?= ${LINTFLAGS} 86LINTOBJFLAGS ?= -cghapbxu -i 87LINTOBJKERNFLAGS?= ${LINTOBJFLAGS} 88LINTLIBFLAGS ?= -cghapbxu -C ${LIB} 89 90MAKE ?= make 91 92OBJC ?= cc 93OBJCFLAGS ?= ${OBJCINCLUDES} ${CFLAGS} -Wno-import 94 95PC ?= pc 96PFLAGS ?= 97 98RC ?= f77 99RFLAGS ?= 100 101SHELL ?= sh 102 103YACC ?= yacc 104.if defined(%POSIX) 105YFLAGS ?= 106.else 107YFLAGS ?= -d 108.endif 109 110.if defined(%POSIX) 111 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.sh: 172 cp -p ${.IMPSRC} ${.TARGET} 173 chmod a+x ${.TARGET} 174 175.c.ln: 176 ${LINT} ${LINTOBJFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC} || \ 177 touch ${.TARGET} 178 179.cc.ln .C.ln .cpp.ln .cxx.ln: 180 ${LINT} ${LINTOBJFLAGS} ${CXXFLAGS:M-[DIU]*} ${.IMPSRC} || \ 181 touch ${.TARGET} 182 183.c: 184 ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} 185 186.c.o: 187 ${CC} ${CFLAGS} -c ${.IMPSRC} 188 189.cc .cpp .cxx .C: 190 ${CXX} ${CXXFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} 191 192.cc.o .cpp.o .cxx.o .C.o: 193 ${CXX} ${CXXFLAGS} -c ${.IMPSRC} 194 195.m.o: 196 ${OBJC} ${OBJCFLAGS} -c ${.IMPSRC} 197 198.p.o: 199 ${PC} ${PFLAGS} -c ${.IMPSRC} 200 201.e .r .F .f: 202 ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} \ 203 -o ${.TARGET} 204 205.e.o .r.o .F.o .f.o: 206 ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} -c ${.IMPSRC} 207 208.S.o: 209 ${CC} ${CFLAGS} -c ${.IMPSRC} 210 211.asm.o: 212 ${CC} -x assembler-with-cpp ${CFLAGS} -c ${.IMPSRC} 213 214.s.o: 215 ${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC} 216 217# XXX not -j safe 218.y.o: 219 ${YACC} ${YFLAGS} ${.IMPSRC} 220 ${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET} 221 rm -f y.tab.c 222 223.l.o: 224 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c 225 ${CC} ${CFLAGS} -c ${.PREFIX}.tmp.c -o ${.TARGET} 226 rm -f ${.PREFIX}.tmp.c 227 228# XXX not -j safe 229.y.c: 230 ${YACC} ${YFLAGS} ${.IMPSRC} 231 mv y.tab.c ${.TARGET} 232 233.l.c: 234 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.TARGET} 235 236.s.out .c.out .o.out: 237 ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} 238 239.f.out .F.out .r.out .e.out: 240 ${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} \ 241 ${LDLIBS} -o ${.TARGET} 242 rm -f ${.PREFIX}.o 243 244# XXX not -j safe 245.y.out: 246 ${YACC} ${YFLAGS} ${.IMPSRC} 247 ${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET} 248 rm -f y.tab.c 249 250.l.out: 251 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c 252 ${CC} ${CFLAGS} ${LDFLAGS} ${.PREFIX}.tmp.c ${LDLIBS} -ll -o ${.TARGET} 253 rm -f ${.PREFIX}.tmp.c 254 255# FreeBSD build pollution. Hide it in the non-POSIX part of the ifdef. 256__MAKE_CONF?=/etc/make.conf 257.if exists(${__MAKE_CONF}) 258.include "${__MAKE_CONF}" 259.endif 260 261# Default executable format 262# XXX hint for bsd.port.mk 263OBJFORMAT?= elf 264 265# Toggle on warnings 266.WARN: dirsyntax 267 268.endif 269 270.include <bsd.compat.mk> 271.include <bsd.cpu.mk> 272