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 22AR ?= ar 23.if defined(%POSIX) 24ARFLAGS ?= -rv 25.else 26ARFLAGS ?= rl 27.endif 28RANLIB ?= ranlib 29 30AS ?= as 31AFLAGS ?= 32 33.if defined(%POSIX) 34CC ?= c89 35CFLAGS ?= -O 36.else 37CC ?= cc 38.if ${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "mips" 39CFLAGS ?= -O -pipe 40.else 41CFLAGS ?= -O2 -pipe 42.endif 43.if defined(NO_STRICT_ALIASING) 44CFLAGS += -fno-strict-aliasing 45.endif 46.endif 47 48# Turn CTF conversion off by default for now. This default could be 49# changed later if DTrace becomes popular. 50.if !defined(WITH_CTF) 51NO_CTF = 1 52.endif 53 54# C Type Format data is required for DTrace 55CTFFLAGS ?= -L VERSION 56 57.if !defined(NO_CTF) 58CTFCONVERT ?= ctfconvert 59CTFMERGE ?= ctfmerge 60.if defined(CFLAGS) && (${CFLAGS:M-g} != "") 61CTFFLAGS += -g 62.else 63CFLAGS += -g 64.endif 65.endif 66 67CXX ?= c++ 68CXXFLAGS ?= ${CFLAGS:N-std=*:N-Wnested-externs:N-W*-prototypes:N-Wno-pointer-sign} 69 70CPP ?= cpp 71 72.if empty(.MAKEFLAGS:M-s) 73ECHO ?= echo 74ECHODIR ?= echo 75.else 76ECHO ?= true 77.if ${.MAKEFLAGS:M-s} == "-s" 78ECHODIR ?= echo 79.else 80ECHODIR ?= true 81.endif 82.endif 83 84.if !empty(.MAKEFLAGS:M-n) && ${.MAKEFLAGS:M-n} == "-n" 85_+_ ?= 86.else 87_+_ ?= + 88.endif 89 90.if defined(%POSIX) 91FC ?= fort77 92FFLAGS ?= -O 1 93.else 94FC ?= f77 95FFLAGS ?= -O 96.endif 97EFLAGS ?= 98 99INSTALL ?= install 100 101LEX ?= lex 102LFLAGS ?= 103 104LD ?= ld 105LDFLAGS ?= 106 107LINT ?= lint 108LINTFLAGS ?= -cghapbx 109LINTKERNFLAGS ?= ${LINTFLAGS} 110LINTOBJFLAGS ?= -cghapbxu -i 111LINTOBJKERNFLAGS?= ${LINTOBJFLAGS} 112LINTLIBFLAGS ?= -cghapbxu -C ${LIB} 113 114MAKE ?= make 115 116OBJC ?= cc 117OBJCFLAGS ?= ${OBJCINCLUDES} ${CFLAGS} -Wno-import 118 119PC ?= pc 120PFLAGS ?= 121 122RC ?= f77 123RFLAGS ?= 124 125SHELL ?= sh 126 127YACC ?= yacc 128.if defined(%POSIX) 129YFLAGS ?= 130.else 131YFLAGS ?= -d 132.endif 133 134.if defined(%POSIX) 135 136# Posix 1003.2 mandated rules 137# 138# Quoted directly from the Posix 1003.2 draft, only the macros 139# $@, $< and $* have been replaced by ${.TARGET}, ${.IMPSRC}, and 140# ${.PREFIX}, resp. 141 142# SINGLE SUFFIX RULES 143.c: 144 ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC} 145.if defined(CTFCONVERT) 146 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 147.endif 148 149.f: 150 ${FC} ${FFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC} 151.if defined(CTFCONVERT) 152 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 153.endif 154 155.sh: 156 cp ${.IMPSRC} ${.TARGET} 157 chmod a+x ${.TARGET} 158 159# DOUBLE SUFFIX RULES 160 161.c.o: 162 ${CC} ${CFLAGS} -c ${.IMPSRC} 163.if defined(CTFCONVERT) 164 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 165.endif 166 167.f.o: 168 ${FC} ${FFLAGS} -c ${.IMPSRC} 169.if defined(CTFCONVERT) 170 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 171.endif 172 173.y.o: 174 ${YACC} ${YFLAGS} ${.IMPSRC} 175 ${CC} ${CFLAGS} -c y.tab.c 176 rm -f y.tab.c 177 mv y.tab.o ${.TARGET} 178.if defined(CTFCONVERT) 179 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 180.endif 181 182.l.o: 183 ${LEX} ${LFLAGS} ${.IMPSRC} 184 ${CC} ${CFLAGS} -c lex.yy.c 185 rm -f lex.yy.c 186 mv lex.yy.o ${.TARGET} 187.if defined(CTFCONVERT) 188 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 189.endif 190 191.y.c: 192 ${YACC} ${YFLAGS} ${.IMPSRC} 193 mv y.tab.c ${.TARGET} 194 195.l.c: 196 ${LEX} ${LFLAGS} ${.IMPSRC} 197 mv lex.yy.c ${.TARGET} 198 199.c.a: 200 ${CC} ${CFLAGS} -c ${.IMPSRC} 201 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 202 rm -f ${.PREFIX}.o 203 204.f.a: 205 ${FC} ${FFLAGS} -c ${.IMPSRC} 206 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 207 rm -f ${.PREFIX}.o 208 209.else 210 211# non-Posix rule set 212 213.sh: 214 cp -p ${.IMPSRC} ${.TARGET} 215 chmod a+x ${.TARGET} 216 217.c.ln: 218 ${LINT} ${LINTOBJFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC} || \ 219 touch ${.TARGET} 220 221.cc.ln .C.ln .cpp.ln .cxx.ln: 222 ${LINT} ${LINTOBJFLAGS} ${CXXFLAGS:M-[DIU]*} ${.IMPSRC} || \ 223 touch ${.TARGET} 224 225.c: 226 ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} 227.if defined(CTFCONVERT) 228 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 229.endif 230 231.c.o: 232 ${CC} ${CFLAGS} -c ${.IMPSRC} 233.if defined(CTFCONVERT) 234 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 235.endif 236 237.cc .cpp .cxx .C: 238 ${CXX} ${CXXFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} 239 240.cc.o .cpp.o .cxx.o .C.o: 241 ${CXX} ${CXXFLAGS} -c ${.IMPSRC} 242 243.m.o: 244 ${OBJC} ${OBJCFLAGS} -c ${.IMPSRC} 245.if defined(CTFCONVERT) 246 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 247.endif 248 249.p.o: 250 ${PC} ${PFLAGS} -c ${.IMPSRC} 251.if defined(CTFCONVERT) 252 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 253.endif 254 255.e .r .F .f: 256 ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} \ 257 -o ${.TARGET} 258 259.e.o .r.o .F.o .f.o: 260 ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} -c ${.IMPSRC} 261 262.S.o: 263 ${CC} ${CFLAGS} -c ${.IMPSRC} 264.if defined(CTFCONVERT) 265 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 266.endif 267 268.asm.o: 269 ${CC} -x assembler-with-cpp ${CFLAGS} -c ${.IMPSRC} 270.if defined(CTFCONVERT) 271 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 272.endif 273 274.s.o: 275 ${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC} 276.if defined(CTFCONVERT) 277 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 278.endif 279 280# XXX not -j safe 281.y.o: 282 ${YACC} ${YFLAGS} ${.IMPSRC} 283 ${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET} 284 rm -f y.tab.c 285.if defined(CTFCONVERT) 286 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 287.endif 288 289.l.o: 290 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c 291 ${CC} ${CFLAGS} -c ${.PREFIX}.tmp.c -o ${.TARGET} 292 rm -f ${.PREFIX}.tmp.c 293.if defined(CTFCONVERT) 294 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 295.endif 296 297# XXX not -j safe 298.y.c: 299 ${YACC} ${YFLAGS} ${.IMPSRC} 300 mv y.tab.c ${.TARGET} 301 302.l.c: 303 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.TARGET} 304 305.s.out .c.out .o.out: 306 ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} 307.if defined(CTFCONVERT) 308 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 309.endif 310 311.f.out .F.out .r.out .e.out: 312 ${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} \ 313 ${LDLIBS} -o ${.TARGET} 314 rm -f ${.PREFIX}.o 315.if defined(CTFCONVERT) 316 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 317.endif 318 319# XXX not -j safe 320.y.out: 321 ${YACC} ${YFLAGS} ${.IMPSRC} 322 ${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET} 323 rm -f y.tab.c 324.if defined(CTFCONVERT) 325 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 326.endif 327 328.l.out: 329 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c 330 ${CC} ${CFLAGS} ${LDFLAGS} ${.PREFIX}.tmp.c ${LDLIBS} -ll -o ${.TARGET} 331 rm -f ${.PREFIX}.tmp.c 332.if defined(CTFCONVERT) 333 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 334.endif 335 336# FreeBSD build pollution. Hide it in the non-POSIX part of the ifdef. 337__MAKE_CONF?=/etc/make.conf 338.if exists(${__MAKE_CONF}) 339.include "${__MAKE_CONF}" 340.endif 341 342.if defined(__MAKE_SHELL) && !empty(__MAKE_SHELL) 343SHELL= ${__MAKE_SHELL} 344.SHELL: path=${__MAKE_SHELL} 345.endif 346 347# Default executable format 348# XXX hint for bsd.port.mk 349OBJFORMAT?= elf 350 351# Toggle on warnings 352.WARN: dirsyntax 353 354.endif 355 356.include <bsd.compat.mk> 357.include <bsd.cpu.mk> 358