The NXCC (native C compiler) misnamed OBJFORMATPATH, it neesd to be
[dragonfly.git] / share / mk / sys.mk
CommitLineData
984263bc
MD
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 $
0f1d8edc 3# $DragonFly: src/share/mk/sys.mk,v 1.7 2004/03/26 21:57:23 dillon Exp $
984263bc
MD
4
5unix ?= We run FreeBSD, not UNIX.
6
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).
12#
13# The rules below use this macro to distinguish between Posix-compliant
14# and default behaviour.
15
16.if defined(%POSIX)
17.SUFFIXES: .o .c .y .l .a .sh .f
18.else
1397f94a 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
984263bc
MD
20.endif
21
22.LIBS: .a
23
24X11BASE ?= /usr/X11R6
25
26AR ?= ar
27.if defined(%POSIX)
28ARFLAGS ?= -rv
29.else
30ARFLAGS ?= rl
31.endif
32RANLIB ?= ranlib
33
34AS ?= as
35AFLAGS ?=
36
37.if defined(%POSIX)
38CC ?= c89
39.else
40CC ?= cc
41.endif
1397f94a
MD
42# The system cc frontend is not subject to the path, e.g. when buildworld
43# is doing cross compiles it may still need the native compiler for things.
44#
0f1d8edc 45NXCC ?= OBJFORMAT_PATH=/ ${CC}
984263bc
MD
46CFLAGS ?= -O -pipe
47
48CXX ?= c++
49CXXFLAGS ?= ${CXXINCLUDES} ${CFLAGS}
50
51CPP ?= cpp
52
53.if ${.MAKEFLAGS:M-s} == ""
54ECHO ?= echo
55ECHODIR ?= echo
56.else
57ECHO ?= true
58.if ${.MAKEFLAGS:M-s} == "-s"
59ECHODIR ?= echo
60.else
61ECHODIR ?= true
62.endif
63.endif
64
65.if defined(%POSIX)
66FC ?= fort77
67FFLAGS ?= -O 1
68.else
69FC ?= f77
70FFLAGS ?= -O
71.endif
72EFLAGS ?=
73
74INSTALL ?= install
75
76LEX ?= lex
77LFLAGS ?=
78
79LD ?= ld
80LDFLAGS ?=
1397f94a
MD
81NXCFLAGS ?= ${CFLAGS}
82NXLDLIBS ?= ${LDLIBS}
83NXLDFLAGS ?= -static ${LDFLAGS}
984263bc
MD
84
85LINT ?= lint
86LINTFLAGS ?= -chapbx
87
88MAKE ?= make
89
90OBJC ?= cc
91OBJCFLAGS ?= ${OBJCINCLUDES} ${CFLAGS} -Wno-import
92
93PC ?= pc
94PFLAGS ?=
95
96RC ?= f77
97RFLAGS ?=
98
99SHELL ?= sh
100
101YACC ?= yacc
102.if defined(%POSIX)
103YFLAGS ?=
104.else
105YFLAGS ?= -d
106.endif
107
108# FreeBSD/i386 has traditionally been built with a version of make
109# which knows MACHINE, but not MACHINE_ARCH. When building on other
110# architectures, assume that the version of make being used has an
111# explicit MACHINE_ARCH setting and treat a missing MACHINE_ARCH
112# as an i386 architecture.
113MACHINE_ARCH ?= i386
114
115.if defined(%POSIX)
116# Posix 1003.2 mandated rules
117#
118# Quoted directly from the Posix 1003.2 draft, only the macros
119# $@, $< and $* have been replaced by ${.TARGET}, ${.IMPSRC}, and
120# ${.PREFIX}, resp.
121
122# SINGLE SUFFIX RULES
123.c:
124 ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
125
126.f:
127 ${FC} ${FFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
128
129.sh:
130 cp ${.IMPSRC} ${.TARGET}
131 chmod a+x ${.TARGET}
132
133# DOUBLE SUFFIX RULES
134
135.c.o:
136 ${CC} ${CFLAGS} -c ${.IMPSRC}
137
138.f.o:
139 ${FC} ${FFLAGS} -c ${.IMPSRC}
140
141.y.o:
142 ${YACC} ${YFLAGS} ${.IMPSRC}
143 ${CC} ${CFLAGS} -c y.tab.c
144 rm -f y.tab.c
145 mv y.tab.o ${.TARGET}
146
147.l.o:
148 ${LEX} ${LFLAGS} ${.IMPSRC}
149 ${CC} ${CFLAGS} -c lex.yy.c
150 rm -f lex.yy.c
151 mv lex.yy.o ${.TARGET}
152
153.y.c:
154 ${YACC} ${YFLAGS} ${.IMPSRC}
155 mv y.tab.c ${.TARGET}
156
157.l.c:
158 ${LEX} ${LFLAGS} ${.IMPSRC}
159 mv lex.yy.c ${.TARGET}
160
161.c.a:
162 ${CC} ${CFLAGS} -c ${.IMPSRC}
163 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
164 rm -f ${.PREFIX}.o
165
166.f.a:
167 ${FC} ${FFLAGS} -c ${.IMPSRC}
168 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
169 rm -f ${.PREFIX}.o
170
171.else
172
173# non-Posix rule set
174
175.sh:
176 cp -p ${.IMPSRC} ${.TARGET}
177 chmod a+x ${.TARGET}
178
179.c:
180 ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
181
182.c.o:
183 ${CC} ${CFLAGS} -c ${.IMPSRC}
184
185.cc .cpp .cxx .C:
186 ${CXX} ${CXXFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
187
188.cc.o .cpp.o .cxx.o .C.o:
189 ${CXX} ${CXXFLAGS} -c ${.IMPSRC}
190
191.m.o:
192 ${OBJC} ${OBJCFLAGS} -c ${.IMPSRC}
193
194.p.o:
195 ${PC} ${PFLAGS} -c ${.IMPSRC}
196
197.e .r .F .f:
198 ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} \
199 -o ${.TARGET}
200
201.e.o .r.o .F.o .f.o:
202 ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} -c ${.IMPSRC}
203
204.S.o:
205 ${CC} ${CFLAGS} -c ${.IMPSRC}
206
207.s.o:
208 ${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
209
210# XXX not -j safe
211.y.o:
212 ${YACC} ${YFLAGS} ${.IMPSRC}
213 ${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET}
214 rm -f y.tab.c
215
216.l.o:
217 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
218 ${CC} ${CFLAGS} -c ${.PREFIX}.tmp.c -o ${.TARGET}
219 rm -f ${.PREFIX}.tmp.c
220
1397f94a
MD
221# .no == native object file, for helper code when cross building.
222#
223.c.no:
224 ${NXCC} ${NXCFLAGS} -c ${.IMPSRC} -o ${.TARGET}
225
226.y.no:
227 ${YACC} ${YFLAGS} ${.IMPSRC}
228 ${NXCC} ${CFLAGS} -c y.tab.c -o ${.TARGET}
229 rm -f y.tab.c
230
231.l.no:
232 ${LEX} ${LFLAGS} -o${.TARGET}.c ${.IMPSRC}
233 ${NXCC} ${CFLAGS} -c ${.TARGET}.c -o ${.TARGET}
234 rm -f ${.TARGET}.c
235
236.no.nx .c.nx:
237 ${NXCC} ${NXCFLAGS} ${NXLDFLAGS} ${.IMPSRC} ${NXLDLIBS} -o ${.TARGET}
238
984263bc
MD
239# XXX not -j safe
240.y.c:
241 ${YACC} ${YFLAGS} ${.IMPSRC}
242 mv y.tab.c ${.TARGET}
243
244.l.c:
245 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.TARGET}
246
247.s.out .c.out .o.out:
248 ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
249
250.f.out .F.out .r.out .e.out:
251 ${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} \
252 ${LDLIBS} -o ${.TARGET}
253 rm -f ${.PREFIX}.o
254
255# XXX not -j safe
256.y.out:
257 ${YACC} ${YFLAGS} ${.IMPSRC}
258 ${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET}
259 rm -f y.tab.c
260
261.l.out:
262 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
263 ${CC} ${CFLAGS} ${LDFLAGS} ${.PREFIX}.tmp.c ${LDLIBS} -ll -o ${.TARGET}
264 rm -f ${.PREFIX}.tmp.c
265
266.endif
267
268.if exists(/etc/defaults/make.conf)
269.include </etc/defaults/make.conf>
270.endif
271
272__MAKE_CONF?=/etc/make.conf
273.if exists(${__MAKE_CONF})
274.include "${__MAKE_CONF}"
275.endif
276
277.include <bsd.cpu.mk>
278
279.if exists(/etc/make.conf.local)
280.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.
281.include </etc/make.conf.local>
282.endif
283
984263bc 284# Default executable format
aa8d5dcb 285# XXX hint for bsd.port.mk
984263bc 286OBJFORMAT?= elf
1397f94a 287