kernel: fix sanity check
[minix.git] / share / mk / sys.mk
blobd1b4c638b7a0a041b8157985366dfad9c91ec897
1 # $NetBSD: sys.mk,v 1.110 2012/10/06 20:54:58 christos Exp $
2 # @(#)sys.mk 8.2 (Berkeley) 3/21/94
4 # This variable should be used to differentiate Minix builds in Makefiles.
5 __MINIX= yes
7 .if defined(__MINIX)
8 .if ${MKSMALL:U} == "yes"
9 DBG= -Os
10 CFLAGS+= -DNDEBUG
11 .endif
13 unix?= We run MINIX.
15 NBSD_LIBC= yes
17 DBG?= -O
18 CPP?= /usr/lib/cpp
19 .endif # defined(__MINIX)
20 unix?= We run NetBSD.
22 .SUFFIXES: .a .o .ln .s .S .c .cc .cpp .cxx .C .f .F .r .p .l .y .sh
24 .LIBS: .a
26 AR?= ar
27 ARFLAGS?= rl
28 RANLIB?= ranlib
30 AS?= as
31 AFLAGS?=
32 COMPILE.s?= ${CC} ${AFLAGS} ${AFLAGS.${<:T}} -c
33 LINK.s?= ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${LDFLAGS}
34 _ASM_TRADITIONAL_CPP= -x assembler-with-cpp
35 COMPILE.S?= ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} ${_ASM_TRADITIONAL_CPP} -c
36 LINK.S?= ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} ${LDFLAGS}
38 CC?= cc
39 .if ${MACHINE_ARCH} == "sh3el" || ${MACHINE_ARCH} == "sh3eb"
40 # -O2 is too -falign-* zealous for low-memory sh3 machines
41 DBG?= -Os -freorder-blocks
42 .elif ${MACHINE_ARCH} == "m68k" || ${MACHINE_ARCH} == "m68000"
43 # see src/doc/HACKS for details
44 DBG?= -Os
45 .elif ${MACHINE_ARCH} == "vax"
46 DBG?= -O1 -fgcse -fstrength-reduce -fgcse-after-reload
47 .else
48 DBG?= -O2
49 .endif
50 CFLAGS?= ${DBG}
51 LDFLAGS?=
52 COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
53 LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
55 # C Type Format data is required for DTrace
56 # XXX TBD VERSION is not defined
57 CTFFLAGS ?= -L VERSION
58 CTFMFLAGS ?= -t -L VERSION
60 .if defined(MKDTRACE) && ${MKDTRACE} != "no"
61 CTFCONVERT ?= ${TOOL_CTFCONVERT}
62 CTFMERGE ?= ${TOOL_CTFMERGE}
63 .if defined(CFLAGS) && (${CFLAGS:M-g} != "")
64 CTFFLAGS += -g
65 CTFMFLAGS += -g
66 .else
67 CFLAGS += -g
68 .endif
69 .endif
71 CXX?= c++
72 CXXFLAGS?= ${CFLAGS:N-Wno-traditional:N-Wstrict-prototypes:N-Wmissing-prototypes:N-Wno-pointer-sign:N-ffreestanding:N-std=gnu99:N-Wold-style-definition:N-Wno-format-zero-length}
74 __ALLSRC1= ${empty(DESTDIR):?${.ALLSRC}:${.ALLSRC:S|^${DESTDIR}|^destdir|}}
75 __ALLSRC2= ${empty(MAKEOBJDIR):?${__ALLSRC1}:${__ALLSRC1:S|^${MAKEOBJDIR}|^obj|}}
76 __ALLSRC3= ${empty(NETBSDSRCDIR):?${__ALLSRC2}:${__ALLSRC2:S|^${NETBSDSRCDIR}|^src|}}
77 __BUILDSEED= ${BUILDSEED}/${__ALLSRC3:O}/${.TARGET}
78 _CXXSEED?= ${BUILDSEED:D-frandom-seed=${__BUILDSEED:hash}}
80 COMPILE.cc?= ${CXX} ${_CXXSEED} ${CXXFLAGS} ${CPPFLAGS} -c
81 LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
83 OBJC?= ${CC}
84 OBJCFLAGS?= ${CFLAGS}
85 COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
86 LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
88 CPP?= cpp
89 CPPFLAGS?=
91 FC?= f77
92 FFLAGS?= -O
93 RFLAGS?=
94 COMPILE.f?= ${FC} ${FFLAGS} -c
95 LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS}
96 COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
97 LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
98 COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
99 LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
101 INSTALL?= install
103 LD?= ld
105 LEX?= lex
106 LFLAGS?=
107 LEX.l?= ${LEX} ${LFLAGS}
109 LINT?= lint
110 LINTFLAGS?= -chapbxzFS
112 LORDER?= lorder
114 MAKE?= make
116 NM?= nm
118 PC?= pc
119 PFLAGS?=
120 COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
121 LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
123 SHELL?= sh
125 SIZE?= size
127 TSORT?= tsort -q
129 YACC?= yacc
130 YFLAGS?=
131 YACC.y?= ${YACC} ${YFLAGS}
135 ${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
136 .if defined(CTFCONVERT)
137 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
138 .endif
139 .c.o:
140 ${COMPILE.c} ${.IMPSRC}
141 .if defined(CTFCONVERT)
142 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
143 .endif
144 .c.a:
145 ${COMPILE.c} ${.IMPSRC}
146 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
147 rm -f ${.PREFIX}.o
148 .c.ln:
149 ${LINT} ${LINTFLAGS} \
150 ${CPPFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \
151 -i ${.IMPSRC}
153 # C++
154 .cc .cpp .cxx .C:
155 ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
156 .cc.o .cpp.o .cxx.o .C.o:
157 ${COMPILE.cc} ${.IMPSRC}
158 .cc.a .cpp.a .cxx.a .C.a:
159 ${COMPILE.cc} ${.IMPSRC}
160 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
161 rm -f ${.PREFIX}.o
163 # Fortran/Ratfor
165 ${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
166 .f.o:
167 ${COMPILE.f} ${.IMPSRC}
168 .f.a:
169 ${COMPILE.f} ${.IMPSRC}
170 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
171 rm -f ${.PREFIX}.o
174 ${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
175 .if defined(CTFCONVERT)
176 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
177 .endif
178 .F.o:
179 ${COMPILE.F} ${.IMPSRC}
180 .if defined(CTFCONVERT)
181 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
182 .endif
183 .F.a:
184 ${COMPILE.F} ${.IMPSRC}
185 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
186 rm -f ${.PREFIX}.o
189 ${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
190 .r.o:
191 ${COMPILE.r} ${.IMPSRC}
192 .r.a:
193 ${COMPILE.r} ${.IMPSRC}
194 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
195 rm -f ${.PREFIX}.o
197 # Pascal
199 ${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
200 .if defined(CTFCONVERT)
201 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
202 .endif
203 .p.o:
204 ${COMPILE.p} ${.IMPSRC}
205 .if defined(CTFCONVERT)
206 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
207 .endif
208 .p.a:
209 ${COMPILE.p} ${.IMPSRC}
210 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
211 rm -f ${.PREFIX}.o
213 # Assembly
215 ${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
216 .if defined(CTFCONVERT)
217 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
218 .endif
219 .s.o:
220 ${COMPILE.s} ${.IMPSRC}
221 .if defined(CTFCONVERT)
222 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
223 .endif
224 .s.a:
225 ${COMPILE.s} ${.IMPSRC}
226 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
227 rm -f ${.PREFIX}.o
229 ${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
230 .if defined(CTFCONVERT)
231 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
232 .endif
233 .S.o:
234 ${COMPILE.S} ${.IMPSRC}
235 .if defined(CTFCONVERT)
236 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
237 .endif
238 .S.a:
239 ${COMPILE.S} ${.IMPSRC}
240 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
241 rm -f ${.PREFIX}.o
243 # Lex
245 ${LEX.l} ${.IMPSRC}
246 ${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
247 rm -f lex.yy.c
248 .l.c:
249 ${LEX.l} ${.IMPSRC}
250 mv lex.yy.c ${.TARGET}
251 .l.o:
252 ${LEX.l} ${.IMPSRC}
253 ${COMPILE.c} -o ${.TARGET} lex.yy.c
254 rm -f lex.yy.c
256 # Yacc
258 ${YACC.y} ${.IMPSRC}
259 ${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
260 rm -f y.tab.c
261 .y.c:
262 ${YACC.y} ${.IMPSRC}
263 mv y.tab.c ${.TARGET}
264 .y.o:
265 ${YACC.y} ${.IMPSRC}
266 ${COMPILE.c} -o ${.TARGET} y.tab.c
267 rm -f y.tab.c
269 # Shell
270 .sh:
271 rm -f ${.TARGET}
272 cp ${.IMPSRC} ${.TARGET}
273 chmod a+x ${.TARGET}