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.
17 .SUFFIXES
: .o .c .y .l .a .sh .f
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
27 NXAR ?
= ${NXENV} ${AR}
34 NXRANLIB ?
= ${NXENV} ${RANLIB}
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}
55 NXCXX ?
= ${NXENV} ${CXX}
56 NXCXX_LINK ?
= ${NXENV} ${CXX_LINK}
57 CXXFLAGS ?
= ${CXXINCLUDES} ${CFLAGS}
61 .if
${.MAKEFLAGS
:M-s
} == ""
66 .if
${.MAKEFLAGS
:M-s
} == "-s"
89 NXLD ?
= ${NXENV} ${LD}
91 NXCFLAGS ?
= ${CFLAGS
:N-mtune
*:N-mcpu
*:N-march
*}
92 NXCXXFLAGS ?
= ${CFLAGS
:N-mtune
*:N-mcpu
*:N-march
*}
94 NXLDFLAGS ?
= -static
${LDFLAGS}
102 OBJCFLAGS ?
= ${OBJCINCLUDES} ${CFLAGS} -Wno-import
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"
128 .if
!defined
(MACHINE_ARCH
)
129 .error
"MACHINE_ARCH was not defined by make"
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
140 .if
${MACHINE} == "pc32"
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
151 # SINGLE SUFFIX RULES
153 ${CC} ${CFLAGS} ${LDFLAGS} -o
${.TARGET
} ${.IMPSRC
}
156 ${FC} ${FFLAGS} ${LDFLAGS} -o
${.TARGET
} ${.IMPSRC
}
159 cp
${.IMPSRC
} ${.TARGET
}
162 # DOUBLE SUFFIX RULES
165 ${CC} ${CFLAGS} -c
${.IMPSRC
}
168 ${FC} ${FFLAGS} -c
${.IMPSRC
}
171 ${YACC} ${YFLAGS} ${.IMPSRC
}
172 ${CC} ${CFLAGS} -c y.tab.c
174 mv y.tab.o
${.TARGET
}
177 ${LEX} ${LFLAGS} ${.IMPSRC
}
178 ${CC} ${CFLAGS} -c
lex.yy.c
180 mv
lex.yy.o
${.TARGET
}
183 ${YACC} ${YFLAGS} ${.IMPSRC
}
184 mv y.tab.c
${.TARGET
}
187 ${LEX} ${LFLAGS} ${.IMPSRC
}
188 mv
lex.yy.c
${.TARGET
}
191 ${CC} ${CFLAGS} -c
${.IMPSRC
}
192 ${AR} ${ARFLAGS} ${.TARGET
} ${.PREFIX
}.o
196 ${FC} ${FFLAGS} -c
${.IMPSRC
}
197 ${AR} ${ARFLAGS} ${.TARGET
} ${.PREFIX
}.o
205 cp
-p
${.IMPSRC
} ${.TARGET
}
209 ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC
} ${LDLIBS} -o
${.TARGET
}
212 ${CC} ${CFLAGS} -c
${.IMPSRC
}
215 ${CXX} ${CXXFLAGS} ${LDFLAGS} ${.IMPSRC
} ${LDLIBS} -o
${.TARGET
}
217 .
cc.o .
cpp.o .
cxx.o .C.o
:
218 ${CXX} ${CXXFLAGS} -c
${.IMPSRC
}
221 ${OBJC} ${OBJCFLAGS} -c
${.IMPSRC
}
224 ${PC} ${PFLAGS} -c
${.IMPSRC
}
227 ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC
} ${LDLIBS} \
231 ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} -c
${.IMPSRC
}
234 ${CC} ${CFLAGS} -c
${.IMPSRC
}
237 ${AS} ${AFLAGS} -o
${.TARGET
} ${.IMPSRC
}
241 ${YACC} ${YFLAGS} ${.IMPSRC
}
242 ${CC} ${CFLAGS} -c y.tab.c
-o
${.TARGET
}
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.
253 ${NXCC} ${NXCFLAGS} -c
${.IMPSRC
} -o
${.TARGET
}
256 ${YACC} ${YFLAGS} ${.IMPSRC
}
257 ${NXCC} ${NXCFLAGS} -c y.tab.c
-o
${.TARGET
}
261 ${LEX} ${LFLAGS} -o
${.TARGET
}.c
${.IMPSRC
}
262 ${NXCC} ${NXCFLAGS} -c
${.TARGET
}.c
-o
${.TARGET
}
266 ${NXCC} ${NXCFLAGS} ${NXLDFLAGS} ${.IMPSRC
} ${NXLDLIBS} -o
${.TARGET
}
270 ${YACC} ${YFLAGS} ${.IMPSRC
}
271 mv y.tab.c
${.TARGET
}
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
}
286 ${YACC} ${YFLAGS} ${.IMPSRC
}
287 ${CC} ${CFLAGS} ${LDFLAGS} y.tab.c
${LDLIBS} -ly
-o
${.TARGET
}
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
297 .if exists
(/etc
/defaults
/make.conf
)
298 .
include </etc
/defaults
/make.conf
>
301 __MAKE_CONF?
=/etc
/make.conf
302 .if exists
(${__MAKE_CONF})
303 .
include "${__MAKE_CONF}"
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
>
313 # Default executable format
314 # XXX hint for bsd.port.mk