Update mount_cd9660.8:
[dragonfly.git] / share / mk / sys.mk
blob2cc6bd12bede2fe5317f3ef1437379aadb93323e
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 $
3 # $DragonFly: src/share/mk/sys.mk,v 1.21 2008/05/19 10:26:02 corecode Exp $
5 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.
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 .s .cl .p .h .sh .no .nx
20 .endif
22 .LIBS: .a
24 X11BASE ?= /usr/pkg
26 AR ?= ar
27 NXAR ?= ${NXENV} ${AR}
28 .if defined(%POSIX)
29 ARFLAGS ?= -rv
30 .else
31 ARFLAGS ?= rl
32 .endif
33 RANLIB ?= ranlib
34 NXRANLIB ?= ${NXENV} ${RANLIB}
36 AS ?= as
37 AFLAGS ?=
39 .if defined(%POSIX)
40 CC ?= c89
41 .else
42 CC ?= cc
43 .endif
44 CC_LINK ?= ${CC}
45 # The system cc frontend is not subject to the path, e.g. when buildworld
46 # is doing cross compiles it may still need the native compiler for things.
48 NXENV ?= CCVER=${HOST_CCVER} OBJFORMAT_PATH=/ PATH=/usr/bin:/bin:/usr/sbin:/sbin
49 NXCC ?= ${NXENV} ${CC}
50 NXCC_LINK ?= ${NXENV} ${CC_LINK}
51 CFLAGS ?= -O -pipe
53 CXX ?= c++
54 CXX_LINK ?= ${CXX}
55 NXCXX ?= ${NXENV} ${CXX}
56 NXCXX_LINK ?= ${NXENV} ${CXX_LINK}
57 CXXFLAGS ?= ${CXXINCLUDES} ${CFLAGS}
59 CPP ?= cpp
61 .if ${.MAKEFLAGS:M-s} == ""
62 ECHO ?= echo
63 ECHODIR ?= echo
64 .else
65 ECHO ?= true
66 .if ${.MAKEFLAGS:M-s} == "-s"
67 ECHODIR ?= echo
68 .else
69 ECHODIR ?= true
70 .endif
71 .endif
73 .if defined(%POSIX)
74 FC ?= fort77
75 FFLAGS ?= -O 1
76 .else
77 FC ?= f77
78 FFLAGS ?= -O
79 .endif
80 EFLAGS ?=
82 INSTALL ?= install
83 LN ?= ln
85 LEX ?= lex
86 LFLAGS ?=
88 LD ?= ld
89 NXLD ?= ${NXENV} ${LD}
90 LDFLAGS ?=
91 NXCFLAGS ?= ${CFLAGS:N-mtune*:N-mcpu*:N-march*}
92 NXCXXFLAGS ?= ${CFLAGS:N-mtune*:N-mcpu*:N-march*}
93 NXLDLIBS ?= ${LDLIBS}
94 NXLDFLAGS ?= -static ${LDFLAGS}
96 LINT ?= lint
97 LINTFLAGS ?= -chapbx
99 MAKE ?= make
101 OBJC ?= cc
102 OBJCFLAGS ?= ${OBJCINCLUDES} ${CFLAGS} -Wno-import
104 PC ?= pc
105 PFLAGS ?=
107 RC ?= f77
108 RFLAGS ?=
110 SHELL ?= sh
112 YACC ?= yacc
113 .if defined(%POSIX)
114 YFLAGS ?=
115 .else
116 YFLAGS ?= -d
117 .endif
119 # The 'make' program is expected to define the following.
121 # MACHINE_PLATFORM platform architecture (vkernel, pc32)
122 # MACHINE machine architecture (i386, etc..)
123 # MACHINE_ARCH cpu architecture (i386, amd64, etc)
125 .if !defined(MACHINE)
126 .error "MACHINE was not defined by make"
127 .endif
128 .if !defined(MACHINE_ARCH)
129 .error "MACHINE_ARCH was not defined by make"
130 .endif
132 # Backwards compatibility. There was a time during 1.7 development
133 # where we tried to rename MACHINE. This failed and was reverted,
134 # and MACHINE_PLATFORM was added to make the distinction. These shims
135 # prevent buildworld from breaking.
137 .if !defined(MACHINE_PLATFORM)
138 MACHINE_PLATFORM=pc32
139 .endif
140 .if ${MACHINE} == "pc32"
141 MACHINE=i386
142 .endif
144 .if defined(%POSIX)
145 # Posix 1003.2 mandated rules
147 # Quoted directly from the Posix 1003.2 draft, only the macros
148 # $@, $< and $* have been replaced by ${.TARGET}, ${.IMPSRC}, and
149 # ${.PREFIX}, resp.
151 # SINGLE SUFFIX RULES
153 ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
156 ${FC} ${FFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
158 .sh:
159 cp ${.IMPSRC} ${.TARGET}
160 chmod a+x ${.TARGET}
162 # DOUBLE SUFFIX RULES
164 .c.o:
165 ${CC} ${CFLAGS} -c ${.IMPSRC}
167 .f.o:
168 ${FC} ${FFLAGS} -c ${.IMPSRC}
170 .y.o:
171 ${YACC} ${YFLAGS} ${.IMPSRC}
172 ${CC} ${CFLAGS} -c y.tab.c
173 rm -f y.tab.c
174 mv y.tab.o ${.TARGET}
176 .l.o:
177 ${LEX} ${LFLAGS} ${.IMPSRC}
178 ${CC} ${CFLAGS} -c lex.yy.c
179 rm -f lex.yy.c
180 mv lex.yy.o ${.TARGET}
182 .y.c:
183 ${YACC} ${YFLAGS} ${.IMPSRC}
184 mv y.tab.c ${.TARGET}
186 .l.c:
187 ${LEX} ${LFLAGS} ${.IMPSRC}
188 mv lex.yy.c ${.TARGET}
190 .c.a:
191 ${CC} ${CFLAGS} -c ${.IMPSRC}
192 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
193 rm -f ${.PREFIX}.o
195 .f.a:
196 ${FC} ${FFLAGS} -c ${.IMPSRC}
197 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
198 rm -f ${.PREFIX}.o
200 .else
202 # non-Posix rule set
204 .sh:
205 cp -p ${.IMPSRC} ${.TARGET}
206 chmod a+x ${.TARGET}
209 ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
211 .c.o:
212 ${CC} ${CFLAGS} -c ${.IMPSRC}
214 .cc .cpp .cxx .C:
215 ${CXX} ${CXXFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
217 .cc.o .cpp.o .cxx.o .C.o:
218 ${CXX} ${CXXFLAGS} -c ${.IMPSRC}
220 .m.o:
221 ${OBJC} ${OBJCFLAGS} -c ${.IMPSRC}
223 .p.o:
224 ${PC} ${PFLAGS} -c ${.IMPSRC}
226 .e .r .F .f:
227 ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} \
228 -o ${.TARGET}
230 .e.o .r.o .F.o .f.o:
231 ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} -c ${.IMPSRC}
233 .S.o:
234 ${CC} ${CFLAGS} -c ${.IMPSRC}
236 .s.o:
237 ${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
239 # XXX not -j safe
240 .y.o:
241 ${YACC} ${YFLAGS} ${.IMPSRC}
242 ${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET}
243 rm -f y.tab.c
245 .l.o:
246 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
247 ${CC} ${CFLAGS} -c ${.PREFIX}.tmp.c -o ${.TARGET}
248 rm -f ${.PREFIX}.tmp.c
250 # .no == native object file, for helper code when cross building.
252 .c.no:
253 ${NXCC} ${NXCFLAGS} -c ${.IMPSRC} -o ${.TARGET}
255 .y.no:
256 ${YACC} ${YFLAGS} ${.IMPSRC}
257 ${NXCC} ${NXCFLAGS} -c y.tab.c -o ${.TARGET}
258 rm -f y.tab.c
260 .l.no:
261 ${LEX} ${LFLAGS} -o${.TARGET}.c ${.IMPSRC}
262 ${NXCC} ${NXCFLAGS} -c ${.TARGET}.c -o ${.TARGET}
263 rm -f ${.TARGET}.c
265 .no.nx .c.nx:
266 ${NXCC} ${NXCFLAGS} ${NXLDFLAGS} ${.IMPSRC} ${NXLDLIBS} -o ${.TARGET}
268 # XXX not -j safe
269 .y.c:
270 ${YACC} ${YFLAGS} ${.IMPSRC}
271 mv y.tab.c ${.TARGET}
273 .l.c:
274 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.TARGET}
276 .s.out .c.out .o.out:
277 ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
279 .f.out .F.out .r.out .e.out:
280 ${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} \
281 ${LDLIBS} -o ${.TARGET}
282 rm -f ${.PREFIX}.o
284 # XXX not -j safe
285 .y.out:
286 ${YACC} ${YFLAGS} ${.IMPSRC}
287 ${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET}
288 rm -f y.tab.c
290 .l.out:
291 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
292 ${CC} ${CFLAGS} ${LDFLAGS} ${.PREFIX}.tmp.c ${LDLIBS} -ll -o ${.TARGET}
293 rm -f ${.PREFIX}.tmp.c
295 .endif
297 .if exists(/etc/defaults/make.conf)
298 .include </etc/defaults/make.conf>
299 .endif
301 __MAKE_CONF?=/etc/make.conf
302 .if exists(${__MAKE_CONF})
303 .include "${__MAKE_CONF}"
304 .endif
306 .include <bsd.cpu.mk>
308 .if exists(/etc/make.conf.local)
309 .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.
310 .include </etc/make.conf.local>
311 .endif
313 # Default executable format
314 # XXX hint for bsd.port.mk
315 OBJFORMAT?= elf