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 ?= -O -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 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 ?= -cghapbx 79LINTKERNFLAGS ?= ${LINTFLAGS} 80LINTOBJFLAGS ?= -cghapbxu -i 81LINTOBJKERNFLAGS?= ${LINTOBJFLAGS} 82LINTLIBFLAGS ?= -cghapbxu -C ${LIB} 83 84MAKE ?= make 85 86OBJC ?= cc 87OBJCFLAGS ?= ${OBJCINCLUDES} ${CFLAGS} -Wno-import 88 89PC ?= pc 90PFLAGS ?= 91 92RC ?= f77 93RFLAGS ?= 94 95SHELL ?= sh 96 97YACC ?= yacc 98.if defined(%POSIX) 99YFLAGS ?= 100.else 101YFLAGS ?= -d 102.endif 103 104# FreeBSD/i386 has traditionally been built with a version of make 105# which knows MACHINE, but not MACHINE_ARCH. When building on other 106# architectures, assume that the version of make being used has an 107# explicit MACHINE_ARCH setting and treat a missing MACHINE_ARCH 108# as an i386 architecture. 109MACHINE_ARCH ?= i386 110 111.if defined(%POSIX) 112 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.ln: 177 ${LINT} ${LINTOBJFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC} || \ 178 touch ${.TARGET} 179 180.cc.ln .C.ln .cpp.ln .cxx.ln: 181 ${LINT} ${LINTOBJFLAGS} ${CXXFLAGS:M-[DIU]*} ${.IMPSRC} || \ 182 touch ${.TARGET} 183 184.c: 185 ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} 186 187.c.o: 188 ${CC} ${CFLAGS} -c ${.IMPSRC} 189 190.cc .cpp .cxx .C: 191 ${CXX} ${CXXFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} 192 193.cc.o .cpp.o .cxx.o .C.o: 194 ${CXX} ${CXXFLAGS} -c ${.IMPSRC} 195 196.m.o: 197 ${OBJC} ${OBJCFLAGS} -c ${.IMPSRC} 198 199.p.o: 200 ${PC} ${PFLAGS} -c ${.IMPSRC} 201 202.e .r .F .f: 203 ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} \ 204 -o ${.TARGET} 205 206.e.o .r.o .F.o .f.o: 207 ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} -c ${.IMPSRC} 208 209.S.o: 210 ${CC} ${CFLAGS} -c ${.IMPSRC} 211 212.asm.o: 213 ${CC} -x assembler-with-cpp ${CFLAGS} -c ${.IMPSRC} 214 215.s.o: 216 ${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC} 217 218# XXX not -j safe 219.y.o: 220 ${YACC} ${YFLAGS} ${.IMPSRC} 221 ${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET} 222 rm -f y.tab.c 223 224.l.o: 225 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c 226 ${CC} ${CFLAGS} -c ${.PREFIX}.tmp.c -o ${.TARGET} 227 rm -f ${.PREFIX}.tmp.c 228 229# XXX not -j safe 230.y.c: 231 ${YACC} ${YFLAGS} ${.IMPSRC} 232 mv y.tab.c ${.TARGET} 233 234.l.c: 235 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.TARGET} 236 237.s.out .c.out .o.out: 238 ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} 239 240.f.out .F.out .r.out .e.out: 241 ${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} \ 242 ${LDLIBS} -o ${.TARGET} 243 rm -f ${.PREFIX}.o 244 245# XXX not -j safe 246.y.out: 247 ${YACC} ${YFLAGS} ${.IMPSRC} 248 ${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET} 249 rm -f y.tab.c 250 251.l.out: 252 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c 253 ${CC} ${CFLAGS} ${LDFLAGS} ${.PREFIX}.tmp.c ${LDLIBS} -ll -o ${.TARGET} 254 rm -f ${.PREFIX}.tmp.c 255 256# FreeBSD build pollution. Hide it in the non-POSIX part of the ifdef. 257__MAKE_CONF?=/etc/make.conf 258.if exists(${__MAKE_CONF}) 259.include "${__MAKE_CONF}" 260.endif 261 262# Default executable format 263# XXX hint for bsd.port.mk 264OBJFORMAT?= elf 265 266.endif 267 268.include <bsd.cpu.mk> 269