libarchive - Ensure futimens() operation is consistent with utimes()
[dragonfly.git] / share / mk / sys.mk
blob39968792e7980620d4e053a948d2c1ecefb38484
1 # from: @(#)sys.mk 8.2 (Berkeley) 3/21/94
2 # $FreeBSD: src/share/mk/sys.mk,v 1.45.2.6 2002/12/23 16:33:37 ru Exp $
4 unix ?= We run FreeBSD, not UNIX.
6 # Set any local definitions first. Place this early, it needs
7 # MACHINE_CPUARCH to be defined
8 .if defined(.PARSEDIR)
9 .sinclude <local.sys.mk>
10 .endif
12 # If the special target .POSIX appears (without prerequisites or
13 # commands) before the first noncomment line in the makefile, make shall
14 # process the makefile as specified by the Posix 1003.2 specification.
15 # make(1) sets the special macro %POSIX in this case (to the actual
16 # value "1003.2", for what it's worth).
18 # The rules below use this macro to distinguish between Posix-compliant
19 # and default behaviour.
21 .if defined(%POSIX)
22 .SUFFIXES: .o .c .y .l .a .sh .f
23 .else
24 .SUFFIXES: .out .a .ln .o .c .cc .cpp .cxx .C .m .F .f .e .r .y .l .S .s .cl .p .h .sh .no .nx
25 .endif
27 .LIBS: .a
29 AR ?= ar
30 NXAR ?= ${NXENV} ${AR}
31 .if defined(%POSIX)
32 ARFLAGS ?= -rv
33 .else
34 ARFLAGS ?= rl
35 .endif
36 RANLIB ?= ranlib
37 NXRANLIB ?= ${NXENV} ${RANLIB}
39 AS ?= as
40 AFLAGS ?=
42 AWK ?= awk
44 .if defined(%POSIX)
45 CC ?= c89
46 .else
47 CC ?= cc
48 .endif
49 CC_LINK ?= ${CC}
50 # The system cc frontend is not subject to the path, e.g. when buildworld
51 # is doing cross compiles it may still need the native compiler for things.
53 NXENV ?= CCVER=${HOST_CCVER} BINUTILSVER=${HOST_BINUTILSVER} OBJFORMAT_PATH=/ PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/pkg/bin
54 NXCC ?= ${NXENV} ${CC}
55 NXCC_LINK ?= ${NXENV} ${CC_LINK}
56 CFLAGS ?= -O -pipe
58 CXX ?= c++
59 CXX_LINK ?= ${CXX}
60 NXCXX ?= ${NXENV} ${CXX}
61 NXCXX_LINK ?= ${NXENV} ${CXX_LINK}
62 CXXFLAGS ?= ${CXXINCLUDES} ${CFLAGS:N-std=*:N-Wnested-externs:N-W*-prototypes:N-Wno-pointer-sign:N-Wold-style-definition}
63 .if !defined(SYSBUILD) && defined(.MAKE.BUILT.BY) && ${.MAKE.BUILT.BY:Mgcc47}
64 CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0
65 .endif
67 CPP ?= cpp
69 .if ${.MAKEFLAGS:M-s} == ""
70 ECHO ?= echo
71 ECHODIR ?= echo
72 .else
73 ECHO ?= true
74 .if ${.MAKEFLAGS:M-s} == "-s"
75 ECHODIR ?= echo
76 .else
77 ECHODIR ?= true
78 .endif
79 .endif
81 .if defined(%POSIX)
82 FC ?= fort77
83 FFLAGS ?= -O 1
84 .else
85 FC ?= f77
86 FFLAGS ?= -O
87 .endif
88 EFLAGS ?=
90 INSTALL ?= install
91 LN ?= ln
93 LEX ?= lex
94 LFLAGS ?=
96 LD ?= ld
97 NXLD ?= ${NXENV} ${LD}
98 LDFLAGS ?=
99 NXCFLAGS ?= ${CFLAGS:N-mtune*:N-mcpu*:N-march*}
100 NXCXXFLAGS ?= ${CFLAGS:N-mtune*:N-mcpu*:N-march*}
101 NXLDLIBS ?= ${LDLIBS}
102 NXLDFLAGS ?= -static ${LDFLAGS}
104 LINT ?= lint
105 LINTFLAGS ?= -chapbx
107 MAKE ?= make
109 OBJC ?= cc
110 OBJCFLAGS ?= ${OBJCINCLUDES} ${CFLAGS} -Wno-import
112 PC ?= pc
113 PFLAGS ?=
115 RC ?= f77
116 RFLAGS ?=
118 SHELL ?= sh
120 YACC ?= yacc
121 .if defined(%POSIX)
122 YFLAGS ?=
123 .else
124 YFLAGS ?= -d
125 .endif
127 # The 'make' program is expected to define the following.
129 # MACHINE_PLATFORM platform architecture (vkernel, pc32)
130 # MACHINE machine architecture (i386, etc..)
131 # MACHINE_ARCH cpu architecture (i386, x86_64, etc)
133 .if !defined(MACHINE)
134 .error "MACHINE was not defined by make"
135 .endif
136 .if !defined(MACHINE_ARCH)
137 .error "MACHINE_ARCH was not defined by make"
138 .endif
140 # Backwards compatibility. There was a time during 1.7 development
141 # where we tried to rename MACHINE. This failed and was reverted,
142 # and MACHINE_PLATFORM was added to make the distinction. These shims
143 # prevent buildworld from breaking.
145 .if !defined(MACHINE_PLATFORM)
146 MACHINE_PLATFORM!=sysctl -n hw.platform
147 .endif
148 .if ${MACHINE} == "pc32"
149 MACHINE=i386
150 .endif
152 .if defined(%POSIX)
153 # Posix 1003.2 mandated rules
155 # Quoted directly from the Posix 1003.2 draft, only the macros
156 # $@, $< and $* have been replaced by ${.TARGET}, ${.IMPSRC}, and
157 # ${.PREFIX}, resp.
159 # SINGLE SUFFIX RULES
161 ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
164 ${FC} ${FFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
166 .sh:
167 cp ${.IMPSRC} ${.TARGET}
168 chmod a+x ${.TARGET}
170 # DOUBLE SUFFIX RULES
172 .c.o:
173 ${CC} ${CFLAGS} -c ${.IMPSRC}
175 .f.o:
176 ${FC} ${FFLAGS} -c ${.IMPSRC}
178 .y.o:
179 ${YACC} ${YFLAGS} ${.IMPSRC}
180 ${CC} ${CFLAGS} -c y.tab.c
181 rm -f y.tab.c
182 mv y.tab.o ${.TARGET}
184 .l.o:
185 ${LEX} ${LFLAGS} ${.IMPSRC}
186 ${CC} ${CFLAGS} -c lex.yy.c
187 rm -f lex.yy.c
188 mv lex.yy.o ${.TARGET}
190 .y.c:
191 ${YACC} ${YFLAGS} ${.IMPSRC}
192 mv y.tab.c ${.TARGET}
194 .l.c:
195 ${LEX} ${LFLAGS} ${.IMPSRC}
196 mv lex.yy.c ${.TARGET}
198 .c.a:
199 ${CC} ${CFLAGS} -c ${.IMPSRC}
200 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
201 rm -f ${.PREFIX}.o
203 .f.a:
204 ${FC} ${FFLAGS} -c ${.IMPSRC}
205 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
206 rm -f ${.PREFIX}.o
208 .else
210 # non-Posix rule set
212 .sh:
213 cp -p ${.IMPSRC} ${.TARGET}
214 chmod a+x ${.TARGET}
217 ${CC} ${_${.IMPSRC:T}_FLAGS} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
219 .c.o:
220 ${CC} ${_${.IMPSRC:T}_FLAGS} ${CFLAGS} -c ${.IMPSRC}
222 .cc .cpp .cxx .C:
223 ${CXX} ${_${.IMPSRC:T}_FLAGS} ${CXXFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
225 .cc.o .cpp.o .cxx.o .C.o:
226 ${CXX} ${_${.IMPSRC:T}_FLAGS} ${CXXFLAGS} -c ${.IMPSRC}
228 .m.o:
229 ${OBJC} ${_${.IMPSRC:T}_FLAGS} ${OBJCFLAGS} -c ${.IMPSRC}
231 .p.o:
232 ${PC} ${_${.IMPSRC:T}_FLAGS} ${PFLAGS} -c ${.IMPSRC}
234 .e .r .F .f:
235 ${FC} ${_${.IMPSRC:T}_FLAGS} ${RFLAGS} ${EFLAGS} ${FFLAGS} ${LDFLAGS} \
236 ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
238 .e.o .r.o .F.o .f.o:
239 ${FC} ${_${.IMPSRC:T}_FLAGS} ${RFLAGS} ${EFLAGS} ${FFLAGS} -c ${.IMPSRC}
241 .S.o:
242 ${CC} ${_${.IMPSRC:T}_FLAGS} ${CFLAGS} -c ${.IMPSRC}
244 .s.o:
245 ${AS} ${_${.IMPSRC:T}_FLAGS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
247 # XXX not -j safe
248 .y.o:
249 ${YACC} ${YFLAGS} ${.IMPSRC}
250 ${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET}
251 rm -f y.tab.c
253 .l.o:
254 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
255 ${CC} ${CFLAGS} -c ${.PREFIX}.tmp.c -o ${.TARGET}
256 rm -f ${.PREFIX}.tmp.c
258 # .no == native object file, for helper code when cross building.
260 .c.no:
261 ${NXCC} ${_${.IMPSRC:T}_FLAGS} ${NXCFLAGS} -c ${.IMPSRC} -o ${.TARGET}
263 .y.no:
264 ${YACC} ${YFLAGS} ${.IMPSRC}
265 ${NXCC} ${NXCFLAGS} -c y.tab.c -o ${.TARGET}
266 rm -f y.tab.c
268 .l.no:
269 ${LEX} ${LFLAGS} -o${.TARGET}.c ${.IMPSRC}
270 ${NXCC} ${NXCFLAGS} -c ${.TARGET}.c -o ${.TARGET}
271 rm -f ${.TARGET}.c
273 .no.nx .c.nx:
274 ${NXCC} ${_${.IMPSRC:T}_FLAGS} ${NXCFLAGS} ${NXLDFLAGS} ${.IMPSRC} \
275 ${NXLDLIBS} -o ${.TARGET}
277 # XXX not -j safe
278 .y.c:
279 ${YACC} ${YFLAGS} ${.IMPSRC}
280 mv y.tab.c ${.TARGET}
282 .l.c:
283 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.TARGET}
285 .s.out .c.out .o.out:
286 ${CC} ${_${.IMPSRC:T}_FLAGS} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
288 .f.out .F.out .r.out .e.out:
289 ${FC} ${_${.IMPSRC:T}_FLAGS} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${LDFLAGS} \
290 ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
291 rm -f ${.PREFIX}.o
293 # XXX not -j safe
294 .y.out:
295 ${YACC} ${YFLAGS} ${.IMPSRC}
296 ${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET}
297 rm -f y.tab.c
299 .l.out:
300 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
301 ${CC} ${CFLAGS} ${LDFLAGS} ${.PREFIX}.tmp.c ${LDLIBS} -ll -o ${.TARGET}
302 rm -f ${.PREFIX}.tmp.c
304 .endif
306 .if exists(/etc/defaults/make.conf)
307 .include </etc/defaults/make.conf>
308 .endif
310 __MAKE_CONF?=/etc/make.conf
311 .if exists(${__MAKE_CONF})
312 .include "${__MAKE_CONF}"
313 .endif
315 .include <bsd.cpu.mk>
317 .if exists(/etc/make.conf.local)
318 .error Error, original /etc/make.conf should be moved to the /etc/defaults/ directory and /etc/make.conf.local should be renamed to /etc/make.conf.
319 .include </etc/make.conf.local>
320 .endif
322 # Default executable format
323 # XXX hint for bsd.port.mk
324 OBJFORMAT?= elf
326 # Tell bmake to expand -V VAR be default
327 .MAKE.EXPAND_VARIABLES= yes
329 .if !defined(.PARSEDIR)
330 # Not using bmake, which is aggressive about search .PATH
331 # It is sometimes necessary to curb its enthusiam with .NOPATH
332 # The following allows us to quietly ignore .NOPATH when no using bmake.
333 .NOTMAIN: .NOPATH
334 .NOPATH:
336 .endif