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 .s .asm .cl .p .h .sh
45 CXXFLAGS ?= ${CXXINCLUDES} ${CFLAGS}
49 .if ${.MAKEFLAGS:M-s} == ""
54 .if ${.MAKEFLAGS:M-s} == "-s"
80 LINTKERNFLAGS ?= ${LINTFLAGS}
81 LINTOBJFLAGS ?= -cghapbxu -i
82 LINTLIBFLAGS ?= -cghapbxu -C ${LIB}
87 OBJCFLAGS ?= ${OBJCINCLUDES} ${CFLAGS} -Wno-import
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.
116 # Posix 1003.2 mandated rules
118 # Quoted directly from the Posix 1003.2 draft, only the macros
119 # $@, $< and $* have been replaced by ${.TARGET}, ${.IMPSRC}, and
122 # SINGLE SUFFIX RULES
124 ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
127 ${FC} ${FFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
130 cp ${.IMPSRC} ${.TARGET}
133 # DOUBLE SUFFIX RULES
136 ${CC} ${CFLAGS} -c ${.IMPSRC}
139 ${FC} ${FFLAGS} -c ${.IMPSRC}
142 ${YACC} ${YFLAGS} ${.IMPSRC}
143 ${CC} ${CFLAGS} -c y.tab.c
145 mv y.tab.o ${.TARGET}
148 ${LEX} ${LFLAGS} ${.IMPSRC}
149 ${CC} ${CFLAGS} -c lex.yy.c
151 mv lex.yy.o ${.TARGET}
154 ${YACC} ${YFLAGS} ${.IMPSRC}
155 mv y.tab.c ${.TARGET}
158 ${LEX} ${LFLAGS} ${.IMPSRC}
159 mv lex.yy.c ${.TARGET}
162 ${CC} ${CFLAGS} -c ${.IMPSRC}
163 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
167 ${FC} ${FFLAGS} -c ${.IMPSRC}
168 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
176 cp -p ${.IMPSRC} ${.TARGET}
180 ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
183 ${CC} ${CFLAGS} -c ${.IMPSRC}
186 ${CXX} ${CXXFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
188 .cc.o .cpp.o .cxx.o .C.o:
189 ${CXX} ${CXXFLAGS} -c ${.IMPSRC}
192 ${OBJC} ${OBJCFLAGS} -c ${.IMPSRC}
195 ${PC} ${PFLAGS} -c ${.IMPSRC}
198 ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} \
202 ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} -c ${.IMPSRC}
205 ${CC} ${CFLAGS} -c ${.IMPSRC}
208 ${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
212 ${YACC} ${YFLAGS} ${.IMPSRC}
213 ${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET}
217 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
218 ${CC} ${CFLAGS} -c ${.PREFIX}.tmp.c -o ${.TARGET}
219 rm -f ${.PREFIX}.tmp.c
223 ${YACC} ${YFLAGS} ${.IMPSRC}
224 mv y.tab.c ${.TARGET}
227 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.TARGET}
229 .s.out .c.out .o.out:
230 ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
232 .f.out .F.out .r.out .e.out:
233 ${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} \
234 ${LDLIBS} -o ${.TARGET}
239 ${YACC} ${YFLAGS} ${.IMPSRC}
240 ${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET}
244 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
245 ${CC} ${CFLAGS} ${LDFLAGS} ${.PREFIX}.tmp.c ${LDLIBS} -ll -o ${.TARGET}
246 rm -f ${.PREFIX}.tmp.c
250 __MAKE_CONF?=/etc/make.conf
251 .if exists(${__MAKE_CONF})
252 .include "${__MAKE_CONF}"
255 .include <bsd.cpu.mk>
257 .if exists(/etc/make.conf.local)
258 .error Error, /etc/make.conf.local should be renamed to /etc/make.conf.
259 .include </etc/make.conf.local>
263 # The build tools are indirected by /usr/bin/objformat which determines the
264 # object format from the OBJFORMAT environment variable and if this is not
265 # defined, it reads /etc/objformat.
267 .if exists(/etc/objformat) && !defined(OBJFORMAT)
268 .include "/etc/objformat"
271 # Default executable format