1 # from: @(#)sys.mk 8.2 (Berkeley) 3/21/94
4 unix ?= We run FreeBSD, not UNIX.
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).
13 # The rules below use this macro to distinguish between Posix-compliant
14 # and default behaviour.
17 .SUFFIXES: .o .c .y .l .a .sh .f
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
40 CFLAGS ?= -O2 -fno-strict-aliasing -pipe
44 CXXFLAGS ?= ${CFLAGS:N-std=*:N-Wnested-externs:N-W*-prototypes}
48 .if empty(.MAKEFLAGS:M-s)
53 .if ${.MAKEFLAGS:M-s} == "-s"
60 .if !empty(.MAKEFLAGS:M-n) && ${.MAKEFLAGS:M-n} == "-n"
85 LINTKERNFLAGS ?= ${LINTFLAGS}
86 LINTOBJFLAGS ?= -cghapbxu -i
87 LINTOBJKERNFLAGS?= ${LINTOBJFLAGS}
88 LINTLIBFLAGS ?= -cghapbxu -C ${LIB}
93 OBJCFLAGS ?= ${OBJCINCLUDES} ${CFLAGS} -Wno-import
110 # FreeBSD/i386 has traditionally been built with a version of make
111 # which knows MACHINE, but not MACHINE_ARCH. When building on other
112 # architectures, assume that the version of make being used has an
113 # explicit MACHINE_ARCH setting and treat a missing MACHINE_ARCH
114 # as an i386 architecture.
119 # Posix 1003.2 mandated rules
121 # Quoted directly from the Posix 1003.2 draft, only the macros
122 # $@, $< and $* have been replaced by ${.TARGET}, ${.IMPSRC}, and
125 # SINGLE SUFFIX RULES
127 ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
130 ${FC} ${FFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
133 cp ${.IMPSRC} ${.TARGET}
136 # DOUBLE SUFFIX RULES
139 ${CC} ${CFLAGS} -c ${.IMPSRC}
142 ${FC} ${FFLAGS} -c ${.IMPSRC}
145 ${YACC} ${YFLAGS} ${.IMPSRC}
146 ${CC} ${CFLAGS} -c y.tab.c
148 mv y.tab.o ${.TARGET}
151 ${LEX} ${LFLAGS} ${.IMPSRC}
152 ${CC} ${CFLAGS} -c lex.yy.c
154 mv lex.yy.o ${.TARGET}
157 ${YACC} ${YFLAGS} ${.IMPSRC}
158 mv y.tab.c ${.TARGET}
161 ${LEX} ${LFLAGS} ${.IMPSRC}
162 mv lex.yy.c ${.TARGET}
165 ${CC} ${CFLAGS} -c ${.IMPSRC}
166 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
170 ${FC} ${FFLAGS} -c ${.IMPSRC}
171 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
179 cp -p ${.IMPSRC} ${.TARGET}
183 ${LINT} ${LINTOBJFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC} || \
186 .cc.ln .C.ln .cpp.ln .cxx.ln:
187 ${LINT} ${LINTOBJFLAGS} ${CXXFLAGS:M-[DIU]*} ${.IMPSRC} || \
191 ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
194 ${CC} ${CFLAGS} -c ${.IMPSRC}
197 ${CXX} ${CXXFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
199 .cc.o .cpp.o .cxx.o .C.o:
200 ${CXX} ${CXXFLAGS} -c ${.IMPSRC}
203 ${OBJC} ${OBJCFLAGS} -c ${.IMPSRC}
206 ${PC} ${PFLAGS} -c ${.IMPSRC}
209 ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} \
213 ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} -c ${.IMPSRC}
216 ${CC} ${CFLAGS} -c ${.IMPSRC}
219 ${CC} -x assembler-with-cpp ${CFLAGS} -c ${.IMPSRC}
222 ${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
226 ${YACC} ${YFLAGS} ${.IMPSRC}
227 ${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET}
231 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
232 ${CC} ${CFLAGS} -c ${.PREFIX}.tmp.c -o ${.TARGET}
233 rm -f ${.PREFIX}.tmp.c
237 ${YACC} ${YFLAGS} ${.IMPSRC}
238 mv y.tab.c ${.TARGET}
241 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.TARGET}
243 .s.out .c.out .o.out:
244 ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
246 .f.out .F.out .r.out .e.out:
247 ${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} \
248 ${LDLIBS} -o ${.TARGET}
253 ${YACC} ${YFLAGS} ${.IMPSRC}
254 ${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET}
258 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
259 ${CC} ${CFLAGS} ${LDFLAGS} ${.PREFIX}.tmp.c ${LDLIBS} -ll -o ${.TARGET}
260 rm -f ${.PREFIX}.tmp.c
262 # FreeBSD build pollution. Hide it in the non-POSIX part of the ifdef.
263 __MAKE_CONF?=/etc/make.conf
264 .if exists(${__MAKE_CONF})
265 .include "${__MAKE_CONF}"
268 # Default executable format
269 # XXX hint for bsd.port.mk
277 .include <bsd.compat.mk>
278 .include <bsd.cpu.mk>