unstack, sort: cleanup and improvement
[minix.git] / share / mk / sys.mk
blobe944935772d5a6fcecb60d39e29bbc8ca9f8869a
1 # $NetBSD: sys.mk,v 1.99 2008/09/07 15:54:52 kent Exp $
2 # @(#)sys.mk 8.2 (Berkeley) 3/21/94
4 unix?= We run MINIX.
6 # This variable should be used to differentiate Minix builds in Makefiles.
7 __MINIX= yes
9 .SUFFIXES: .a .o .ln .s .S .c .cc .cpp .cxx .C .f .F .r .p .l .y .sh
11 .LIBS: .a
13 ### MINIX: see at bottom
14 #AR?= aal
15 ARFLAGS?= rl
16 RANLIB?= ranlib
18 AS?= as
19 AFLAGS?=
20 COMPILE.s?= ${CC} ${AFLAGS} -c
21 LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
22 #COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
23 COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c
24 LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
26 CC?= clang
27 .if ${MACHINE_ARCH} == "alpha" || \
28 ${MACHINE_ARCH} == "arm" || \
29 ${MACHINE_ARCH} == "x86_64" || \
30 ${MACHINE_ARCH} == "armeb" || \
31 ${MACHINE_ARCH} == "hppa" || \
32 ${MACHINE_ARCH} == "i386" || \
33 ${MACHINE_ARCH} == "m68k" || \
34 ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
35 ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb" || \
36 ${MACHINE_ARCH} == "powerpc" || \
37 ${MACHINE_ARCH} == "sparc" || \
38 ${MACHINE_ARCH} == "sparc64"
39 #DBG?= -O2
40 #MINIX: use -O for now
41 DBG?= -O
42 .elif ${MACHINE_ARCH} == "sh3el" || ${MACHINE_ARCH} == "sh3eb"
43 # -O2 is too -falign-* zealous for low-memory sh3 machines
44 DBG?= -Os -freorder-blocks
45 .elif ${MACHINE_ARCH} == "vax"
46 DBG?= -O1 -fgcse -fstrength-reduce -fgcse-after-reload
47 .elif ${MACHINE_ARCH} == "m68000"
48 # see src/doc/HACKS for details
49 DBG?= -O1
50 .else
51 DBG?= -O
52 DBG?=
53 .endif
54 CFLAGS?= ${DBG}
55 LDFLAGS?=
56 COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
57 LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
59 CXX?= c++
60 CXXFLAGS?= ${CFLAGS:N-Wno-traditional:N-Wstrict-prototypes:N-Wmissing-prototypes:N-Wno-pointer-sign:N-ffreestanding:N-std=gnu99}
62 __ALLSRC1= ${empty(DESTDIR):?${.ALLSRC}:${.ALLSRC:S|^${DESTDIR}|^destdir|}}
63 __ALLSRC2= ${empty(MAKEOBJDIR):?${__ALLSRC1}:${__ALLSRC1:S|^${MAKEOBJDIR}|^obj|}}
64 __ALLSRC3= ${empty(NETBSDSRCDIR):?${__ALLSRC2}:${__ALLSRC2:S|^${NETBSDSRCDIR}|^src|}}
66 _CXXSEED?= ${BUILDSEED:D-frandom-seed=${BUILDSEED:Q}/${__ALLSRC3:O:Q}/${.TARGET:Q}}
68 COMPILE.cc?= ${CXX} ${_CXXSEED} ${CXXFLAGS} ${CPPFLAGS} -c
69 LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
71 OBJC?= ${CC}
72 OBJCFLAGS?= ${CFLAGS}
73 COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
74 LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
76 CPP?= cpp
77 CPPFLAGS?=
79 FC?= f77
80 FFLAGS?= -O
81 RFLAGS?=
82 COMPILE.f?= ${FC} ${FFLAGS} -c
83 LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS}
84 COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
85 LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
86 COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
87 LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
89 INSTALL?= install
91 LD?= ld
93 LEX?= lex
94 LFLAGS?=
95 LEX.l?= ${LEX} ${LFLAGS}
97 LINT?= lint
98 LINTFLAGS?= -chapbxzFS
100 LORDER?= lorder
102 MAKE?= make
104 NM?= nm
106 PC?= pc
107 PFLAGS?=
108 COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
109 LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
111 SHELL?= sh
113 SIZE?= size
115 TSORT?= tsort -q
117 YACC?= yacc
118 YFLAGS?=
119 YACC.y?= ${YACC} ${YFLAGS}
123 ${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
124 .c.o:
125 ${COMPILE.c} ${.IMPSRC}
126 .c.a:
127 ${COMPILE.c} ${.IMPSRC}
128 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
129 rm -f ${.PREFIX}.o
130 .c.ln:
131 ${LINT} ${LINTFLAGS} \
132 ${CPPFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \
133 -i ${.IMPSRC}
135 # C++
136 .cc .cpp .cxx .C:
137 ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
138 .cc.o .cpp.o .cxx.o .C.o:
139 ${COMPILE.cc} ${.IMPSRC}
140 .cc.a .cpp.a .cxx.a .C.a:
141 ${COMPILE.cc} ${.IMPSRC}
142 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
143 rm -f ${.PREFIX}.o
145 # Fortran/Ratfor
147 ${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
148 .f.o:
149 ${COMPILE.f} ${.IMPSRC}
150 .f.a:
151 ${COMPILE.f} ${.IMPSRC}
152 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
153 rm -f ${.PREFIX}.o
156 ${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
157 .F.o:
158 ${COMPILE.F} ${.IMPSRC}
159 .F.a:
160 ${COMPILE.F} ${.IMPSRC}
161 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
162 rm -f ${.PREFIX}.o
165 ${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
166 .r.o:
167 ${COMPILE.r} ${.IMPSRC}
168 .r.a:
169 ${COMPILE.r} ${.IMPSRC}
170 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
171 rm -f ${.PREFIX}.o
173 # Pascal
175 ${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
176 .p.o:
177 ${COMPILE.p} ${.IMPSRC}
178 .p.a:
179 ${COMPILE.p} ${.IMPSRC}
180 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
181 rm -f ${.PREFIX}.o
183 # Assembly
185 ${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
186 .s.o:
187 ${COMPILE.s} ${.IMPSRC}
188 .s.a:
189 ${COMPILE.s} ${.IMPSRC}
190 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
191 rm -f ${.PREFIX}.o
193 ${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
194 .S.o:
195 ${COMPILE.S} ${.IMPSRC}
196 .S.a:
197 ${COMPILE.S} ${.IMPSRC}
198 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
199 rm -f ${.PREFIX}.o
201 # Lex
203 ${LEX.l} ${.IMPSRC}
204 ${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
205 rm -f lex.yy.c
206 .l.c:
207 ${LEX.l} ${.IMPSRC}
208 mv lex.yy.c ${.TARGET}
209 .l.o:
210 ${LEX.l} ${.IMPSRC}
211 ${COMPILE.c} -o ${.TARGET} lex.yy.c
212 rm -f lex.yy.c
214 # Yacc
216 ${YACC.y} ${.IMPSRC}
217 ${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
218 rm -f y.tab.c
219 .y.c:
220 ${YACC.y} ${.IMPSRC}
221 mv y.tab.c ${.TARGET}
222 .y.o:
223 ${YACC.y} ${.IMPSRC}
224 ${COMPILE.c} -o ${.TARGET} y.tab.c
225 rm -f y.tab.c
227 # Shell
228 # .sh:
229 # rm -f ${.TARGET}
230 # cp ${.IMPSRC} ${.TARGET}
231 # chmod a+x ${.TARGET}
233 # MINIX
235 COMPILER_TYPE=gnu
236 AR?= ar
237 NBSD_LIBC= yes
239 .if defined(MKSMALL) && ${MKSMALL} == "yes"
240 DBG= -Os
241 CFLAGS+= -DNDEBUG
242 .endif