turns printfs back on
[freebsd-src/fkvm-freebsd.git] / share / mk / sys.mk
blobc469a0354cec28fbbd8b85e3cfb722721031c5d5
1 # from: @(#)sys.mk 8.2 (Berkeley) 3/21/94
2 # $FreeBSD$
4 unix ?= We run FreeBSD, not UNIX.
5 .FreeBSD ?= true
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.
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
22 AR ?= ar
23 .if defined(%POSIX)
24 ARFLAGS ?= -rv
25 .else
26 ARFLAGS ?= rl
27 .endif
28 RANLIB ?= ranlib
30 AS ?= as
31 AFLAGS ?=
33 .if defined(%POSIX)
34 CC ?= c89
35 CFLAGS ?= -O
36 .else
37 CC ?= cc
38 .if ${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "mips"
39 CFLAGS ?= -O -pipe
40 .else
41 CFLAGS ?= -O2 -pipe
42 .endif
43 .if defined(NO_STRICT_ALIASING)
44 CFLAGS += -fno-strict-aliasing
45 .endif
46 .endif
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)
51 NO_CTF = 1
52 .endif
54 # C Type Format data is required for DTrace
55 CTFFLAGS ?= -L VERSION
57 .if !defined(NO_CTF)
58 CTFCONVERT ?= ctfconvert
59 CTFMERGE ?= ctfmerge
60 .if defined(CFLAGS) && (${CFLAGS:M-g} != "")
61 CTFFLAGS += -g
62 .else
63 CFLAGS += -g
64 .endif
65 .endif
67 CXX ?= c++
68 CXXFLAGS ?= ${CFLAGS:N-std=*:N-Wnested-externs:N-W*-prototypes:N-Wno-pointer-sign}
70 CPP ?= cpp
72 .if empty(.MAKEFLAGS:M-s)
73 ECHO ?= echo
74 ECHODIR ?= echo
75 .else
76 ECHO ?= true
77 .if ${.MAKEFLAGS:M-s} == "-s"
78 ECHODIR ?= echo
79 .else
80 ECHODIR ?= true
81 .endif
82 .endif
84 .if !empty(.MAKEFLAGS:M-n) && ${.MAKEFLAGS:M-n} == "-n"
85 _+_ ?=
86 .else
87 _+_ ?= +
88 .endif
90 .if defined(%POSIX)
91 FC ?= fort77
92 FFLAGS ?= -O 1
93 .else
94 FC ?= f77
95 FFLAGS ?= -O
96 .endif
97 EFLAGS ?=
99 INSTALL ?= install
101 LEX ?= lex
102 LFLAGS ?=
104 LD ?= ld
105 LDFLAGS ?=
107 LINT ?= lint
108 LINTFLAGS ?= -cghapbx
109 LINTKERNFLAGS ?= ${LINTFLAGS}
110 LINTOBJFLAGS ?= -cghapbxu -i
111 LINTOBJKERNFLAGS?= ${LINTOBJFLAGS}
112 LINTLIBFLAGS ?= -cghapbxu -C ${LIB}
114 MAKE ?= make
116 OBJC ?= cc
117 OBJCFLAGS ?= ${OBJCINCLUDES} ${CFLAGS} -Wno-import
119 PC ?= pc
120 PFLAGS ?=
122 RC ?= f77
123 RFLAGS ?=
125 SHELL ?= sh
127 YACC ?= yacc
128 .if defined(%POSIX)
129 YFLAGS ?=
130 .else
131 YFLAGS ?= -d
132 .endif
134 .if defined(%POSIX)
136 # Posix 1003.2 mandated rules
138 # Quoted directly from the Posix 1003.2 draft, only the macros
139 # $@, $< and $* have been replaced by ${.TARGET}, ${.IMPSRC}, and
140 # ${.PREFIX}, resp.
142 # SINGLE SUFFIX RULES
144 ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
145 .if defined(CTFCONVERT)
146 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
147 .endif
150 ${FC} ${FFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
151 .if defined(CTFCONVERT)
152 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
153 .endif
155 .sh:
156 cp ${.IMPSRC} ${.TARGET}
157 chmod a+x ${.TARGET}
159 # DOUBLE SUFFIX RULES
161 .c.o:
162 ${CC} ${CFLAGS} -c ${.IMPSRC}
163 .if defined(CTFCONVERT)
164 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
165 .endif
167 .f.o:
168 ${FC} ${FFLAGS} -c ${.IMPSRC}
169 .if defined(CTFCONVERT)
170 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
171 .endif
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
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
191 .y.c:
192 ${YACC} ${YFLAGS} ${.IMPSRC}
193 mv y.tab.c ${.TARGET}
195 .l.c:
196 ${LEX} ${LFLAGS} ${.IMPSRC}
197 mv lex.yy.c ${.TARGET}
199 .c.a:
200 ${CC} ${CFLAGS} -c ${.IMPSRC}
201 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
202 rm -f ${.PREFIX}.o
204 .f.a:
205 ${FC} ${FFLAGS} -c ${.IMPSRC}
206 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
207 rm -f ${.PREFIX}.o
209 .else
211 # non-Posix rule set
213 .sh:
214 cp -p ${.IMPSRC} ${.TARGET}
215 chmod a+x ${.TARGET}
217 .c.ln:
218 ${LINT} ${LINTOBJFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC} || \
219 touch ${.TARGET}
221 .cc.ln .C.ln .cpp.ln .cxx.ln:
222 ${LINT} ${LINTOBJFLAGS} ${CXXFLAGS:M-[DIU]*} ${.IMPSRC} || \
223 touch ${.TARGET}
226 ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
227 .if defined(CTFCONVERT)
228 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
229 .endif
231 .c.o:
232 ${CC} ${CFLAGS} -c ${.IMPSRC}
233 .if defined(CTFCONVERT)
234 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
235 .endif
237 .cc .cpp .cxx .C:
238 ${CXX} ${CXXFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
240 .cc.o .cpp.o .cxx.o .C.o:
241 ${CXX} ${CXXFLAGS} -c ${.IMPSRC}
243 .m.o:
244 ${OBJC} ${OBJCFLAGS} -c ${.IMPSRC}
245 .if defined(CTFCONVERT)
246 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
247 .endif
249 .p.o:
250 ${PC} ${PFLAGS} -c ${.IMPSRC}
251 .if defined(CTFCONVERT)
252 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
253 .endif
255 .e .r .F .f:
256 ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} \
257 -o ${.TARGET}
259 .e.o .r.o .F.o .f.o:
260 ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} -c ${.IMPSRC}
262 .S.o:
263 ${CC} ${CFLAGS} -c ${.IMPSRC}
264 .if defined(CTFCONVERT)
265 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
266 .endif
268 .asm.o:
269 ${CC} -x assembler-with-cpp ${CFLAGS} -c ${.IMPSRC}
270 .if defined(CTFCONVERT)
271 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
272 .endif
274 .s.o:
275 ${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
276 .if defined(CTFCONVERT)
277 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
278 .endif
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
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
297 # XXX not -j safe
298 .y.c:
299 ${YACC} ${YFLAGS} ${.IMPSRC}
300 mv y.tab.c ${.TARGET}
302 .l.c:
303 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.TARGET}
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
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
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
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
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
342 .if defined(__MAKE_SHELL) && !empty(__MAKE_SHELL)
343 SHELL= ${__MAKE_SHELL}
344 .SHELL: path=${__MAKE_SHELL}
345 .endif
347 # Default executable format
348 # XXX hint for bsd.port.mk
349 OBJFORMAT?= elf
351 # Toggle on warnings
352 .WARN: dirsyntax
354 .endif
356 .include <bsd.compat.mk>
357 .include <bsd.cpu.mk>