xref: /freebsd/share/mk/sys.mk (revision 37250e4856c6239c03b99cb36cd21e25a5800f08)
1415bccaaSBruce Evans#	from: @(#)sys.mk	8.2 (Berkeley) 3/21/94
27f3dea24SPeter Wemm# $FreeBSD$
3afe61c15SRodney W. Grimes
4415bccaaSBruce Evansunix		?=	We run FreeBSD, not UNIX.
53f5a93f6SDavid E. O'Brien.FreeBSD	?=	true
6afe61c15SRodney W. Grimes
76fc3ead1SWarner Losh.if !defined(%POSIX)
86fc3ead1SWarner Losh#
96fc3ead1SWarner Losh# MACHINE_CPUARCH defines a collection of MACHINE_ARCH.  Machines with
10bd4473b8SDimitry Andric# the same MACHINE_ARCH can run each other's binaries, so it necessarily
11bd4473b8SDimitry Andric# has word size and endian swizzled in.  However, support files for
12bd4473b8SDimitry Andric# these machines often are shared amongst all combinations of size
13bd4473b8SDimitry Andric# and/or endian.  This is called MACHINE_CPU in NetBSD, but that's used
14bd4473b8SDimitry Andric# for something different in FreeBSD.
156fc3ead1SWarner Losh#
16aa1434ecSIan LeporeMACHINE_CPUARCH=${MACHINE_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb|hf)?/arm/:C/powerpc64/powerpc/:C/riscv64/riscv/}
176b14aaa4SWarner Losh.endif
180815243cSMarcel Moolenaar
19ccfb9654SSimon J. Gerraty
20ccfb9654SSimon J. Gerraty# Some options we need now
21ccfb9654SSimon J. Gerraty__DEFAULT_NO_OPTIONS= \
22948f327eSSimon J. Gerraty	DIRDEPS_BUILD \
23dba62d8dSSimon J. Gerraty	DIRDEPS_CACHE
24ccfb9654SSimon J. Gerraty
25ccfb9654SSimon J. Gerraty__DEFAULT_DEPENDENT_OPTIONS= \
26948f327eSSimon J. Gerraty	AUTO_OBJ/DIRDEPS_BUILD \
27dba62d8dSSimon J. Gerraty	META_MODE/DIRDEPS_BUILD \
28948f327eSSimon J. Gerraty	STAGING/DIRDEPS_BUILD \
29948f327eSSimon J. Gerraty	SYSROOT/DIRDEPS_BUILD
30ccfb9654SSimon J. Gerraty
31da6e996dSBryan Drewery__ENV_ONLY_OPTIONS:= \
32da6e996dSBryan Drewery	${__DEFAULT_NO_OPTIONS} \
33da6e996dSBryan Drewery	${__DEFAULT_YES_OPTIONS} \
34da6e996dSBryan Drewery	${__DEFAULT_DEPENDENT_OPTIONS:H}
35da6e996dSBryan Drewery
36daf514d0SSimon J. Gerraty# early include for customization
37daf514d0SSimon J. Gerraty# see local.sys.mk below
38b9d0791fSWarner Losh# Not included when building in fmake compatibility mode (still needed
39b9d0791fSWarner Losh# for older system support)
40b9d0791fSWarner Losh.if defined(.PARSEDIR)
41b9d0791fSWarner Losh.sinclude <local.sys.env.mk>
42ccfb9654SSimon J. Gerraty
43232af795SBryan Drewery.include <bsd.mkopt.mk>
44232af795SBryan Drewery
45*37250e48SBryan Drewery# Disable MK_META_MODE with make -B
46*37250e48SBryan Drewery.if ${MK_META_MODE} == "yes" && defined(.MAKEFLAGS) && ${.MAKEFLAGS:M-B}
47*37250e48SBryan DreweryMK_META_MODE=	no
48*37250e48SBryan Drewery.endif
49*37250e48SBryan Drewery
50948f327eSSimon J. Gerraty.if ${MK_DIRDEPS_BUILD} == "yes"
51b9d0791fSWarner Losh.sinclude <meta.sys.mk>
52*37250e48SBryan Drewery.elif ${MK_META_MODE} == "yes"
5364923b11SBryan Drewery# verbose will show .MAKE.META.PREFIX for each target.
54699f93b9SBryan DreweryMETA_MODE+=	meta verbose
553681768cSBryan Drewery.if !defined(NO_META_MISSING)
563681768cSBryan DreweryMETA_MODE+=	missing-meta=yes
573681768cSBryan Drewery.endif
58b29980a6SBryan Drewery# silent will hide command output if a .meta file is created.
59b29980a6SBryan Drewery.if !defined(NO_SILENT)
60b29980a6SBryan DreweryMETA_MODE+=	silent=yes
61b29980a6SBryan Drewery.endif
62952de59dSBryan Drewery.if !exists(/dev/filemon)
63ef4ce15dSBryan Drewery.if ${UPDATE_DEPENDFILE:Uyes:tl} != "no" && !defined(NO_FILEMON) && \
64ef4ce15dSBryan Drewery    !make(showconfig)
65c89283ceSBryan Drewery.error ${.newline}ERROR: The filemon module (/dev/filemon) is not loaded.
66c89283ceSBryan Drewery.endif
6764923b11SBryan DreweryMETA_MODE+= nofilemon
68952de59dSBryan Drewery.endif
693681768cSBryan Drewery# Require filemon data with bmake
703681768cSBryan Drewery.if empty(META_MODE:Mnofilemon)
713681768cSBryan DreweryMETA_MODE+= missing-filemon=yes
723681768cSBryan Drewery.endif
73ccfb9654SSimon J. Gerraty.endif
7464923b11SBryan DreweryMETA_MODE?= normal
7564923b11SBryan Drewery.export META_MODE
7664923b11SBryan Drewery.MAKE.MODE?= ${META_MODE}
777f17cd1cSBryan Drewery.if !empty(.MAKE.MODE:Mmeta) && !defined(NO_META_IGNORE_HOST)
787f17cd1cSBryan Drewery# Ignore host file changes that will otherwise cause
797f17cd1cSBryan Drewery# buildworld -> installworld -> buildworld to rebuild everything.
807f17cd1cSBryan Drewery# Since the build is self-reliant and bootstraps everything it needs,
817f17cd1cSBryan Drewery# this should not be a real problem for incremental builds.
827f17cd1cSBryan Drewery# Note that these are prefix matching, so /lib matches /libexec.
837f17cd1cSBryan Drewery.MAKE.META.IGNORE_PATHS+= \
847f17cd1cSBryan Drewery	${__MAKE_SHELL} \
857f17cd1cSBryan Drewery	/bin \
867f17cd1cSBryan Drewery	/lib \
877f17cd1cSBryan Drewery	/rescue \
887f17cd1cSBryan Drewery	/sbin \
897f17cd1cSBryan Drewery	/usr/bin \
907f17cd1cSBryan Drewery	/usr/include \
917f17cd1cSBryan Drewery	/usr/lib \
927f17cd1cSBryan Drewery	/usr/sbin \
937f17cd1cSBryan Drewery	/usr/share \
947f17cd1cSBryan Drewery
957f17cd1cSBryan Drewery.endif
967f17cd1cSBryan Drewery
970b6ba3f2SBryan Drewery
98ccfb9654SSimon J. Gerraty.if ${MK_AUTO_OBJ} == "yes"
99ccfb9654SSimon J. Gerraty# This needs to be done early - before .PATH is computed
100bb8cd0c6SBryan Drewery# Don't do this for 'make showconfig' as it enables all options where meta mode
101bb8cd0c6SBryan Drewery# is not expected.
102bb8cd0c6SBryan Drewery.if !make(showconfig)
103b9d0791fSWarner Losh.sinclude <auto.obj.mk>
104b9d0791fSWarner Losh.endif
1058d4b8102SBryan Drewery.endif
106232af795SBryan Drewery.else # bmake
107232af795SBryan Drewery.include <bsd.mkopt.mk>
108ccfb9654SSimon J. Gerraty.endif
109ccfb9654SSimon J. Gerraty
1102be2be74SSteve Price# If the special target .POSIX appears (without prerequisites or
1112be2be74SSteve Price# commands) before the first noncomment line in the makefile, make shall
1122be2be74SSteve Price# process the makefile as specified by the Posix 1003.2 specification.
1132be2be74SSteve Price# make(1) sets the special macro %POSIX in this case (to the actual
1142be2be74SSteve Price# value "1003.2", for what it's worth).
1152be2be74SSteve Price#
1162be2be74SSteve Price# The rules below use this macro to distinguish between Posix-compliant
1172be2be74SSteve Price# and default behaviour.
11867292978SColin Percival#
11967292978SColin Percival# This functionality is currently broken, since make(1) processes sys.mk
12067292978SColin Percival# before reading any other files, and consequently has no opportunity to
12167292978SColin Percival# set the %POSIX macro before we read this point.
1222be2be74SSteve Price
1232be2be74SSteve Price.if defined(%POSIX)
1242be2be74SSteve Price.SUFFIXES:	.o .c .y .l .a .sh .f
1252be2be74SSteve Price.else
126d58e932fSRuslan Ermilov.SUFFIXES:	.out .a .ln .o .c .cc .cpp .cxx .C .m .F .f .e .r .y .l .S .asm .s .cl .p .h .sh
1272be2be74SSteve Price.endif
128afe61c15SRodney W. Grimes
129415bccaaSBruce EvansAR		?=	ar
1302be2be74SSteve Price.if defined(%POSIX)
1312be2be74SSteve PriceARFLAGS		?=	-rv
1322be2be74SSteve Price.else
133f1c8f60bSDag-Erling SmørgravARFLAGS		?=	-crD
1342be2be74SSteve Price.endif
135415bccaaSBruce EvansRANLIB		?=	ranlib
136f1c8f60bSDag-Erling Smørgrav.if !defined(%POSIX)
137f1c8f60bSDag-Erling SmørgravRANLIBFLAGS	?=	-D
138f1c8f60bSDag-Erling Smørgrav.endif
139afe61c15SRodney W. Grimes
140415bccaaSBruce EvansAS		?=	as
141415bccaaSBruce EvansAFLAGS		?=
1425ada7d99SKonstantin BelousovACFLAGS		?=
143afe61c15SRodney W. Grimes
1442be2be74SSteve Price.if defined(%POSIX)
1452be2be74SSteve PriceCC		?=	c89
146d17387acSBruce EvansCFLAGS		?=	-O
1472be2be74SSteve Price.else
148415bccaaSBruce EvansCC		?=	cc
1496fc3ead1SWarner Losh.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "mips"
15020c46652SDavid E. O'BrienCFLAGS		?=	-O -pipe
151cdc162feSOlivier Houchard.else
15220c46652SDavid E. O'BrienCFLAGS		?=	-O2 -pipe
153cfb5b325SJohn Birrell.endif
154cfb5b325SJohn Birrell.if defined(NO_STRICT_ALIASING)
155cfb5b325SJohn BirrellCFLAGS		+=	-fno-strict-aliasing
156d17387acSBruce Evans.endif
157cdc162feSOlivier Houchard.endif
158424b4e66SStephane E. PotvinPO_CFLAGS	?=	${CFLAGS}
159afe61c15SRodney W. Grimes
1600c76c8aaSMark Johnston# cp(1) is used to copy source files to ${.OBJDIR}, make sure it can handle
1610c76c8aaSMark Johnston# read-only files as non-root by passing -f.
1620c76c8aaSMark JohnstonCP		?=	cp -f
1630c76c8aaSMark Johnston
1640c76c8aaSMark JohnstonCPP		?=	cpp
1650c76c8aaSMark Johnston
166770ac3b2SJohn Birrell# C Type Format data is required for DTrace
167770ac3b2SJohn BirrellCTFFLAGS	?=	-L VERSION
168770ac3b2SJohn Birrell
169770ac3b2SJohn BirrellCTFCONVERT	?=	ctfconvert
170770ac3b2SJohn BirrellCTFMERGE	?=	ctfmerge
1717a37b5fcSWill Andrews
172770ac3b2SJohn Birrell.if defined(CFLAGS) && (${CFLAGS:M-g} != "")
173770ac3b2SJohn BirrellCTFFLAGS	+=	-g
174770ac3b2SJohn Birrell.endif
175770ac3b2SJohn Birrell
176443dced5SPaul RichardsCXX		?=	c++
17796f2d85eSMarcel MoolenaarCXXFLAGS	?=	${CFLAGS:N-std=*:N-Wnested-externs:N-W*-prototypes:N-Wno-pointer-sign:N-Wold-style-definition}
178424b4e66SStephane E. PotvinPO_CXXFLAGS	?=	${CXXFLAGS}
179afe61c15SRodney W. Grimes
1800c76c8aaSMark JohnstonDTRACE		?=	dtrace
1810c76c8aaSMark JohnstonDTRACEFLAGS	?=	-C -x nolibs
182afe61c15SRodney W. Grimes
18365d2bdc6SRuslan Ermilov.if empty(.MAKEFLAGS:M-s)
184415bccaaSBruce EvansECHO		?=	echo
185415bccaaSBruce EvansECHODIR		?=	echo
186415bccaaSBruce Evans.else
187415bccaaSBruce EvansECHO		?=	true
188415bccaaSBruce Evans.if ${.MAKEFLAGS:M-s} == "-s"
189415bccaaSBruce EvansECHODIR		?=	echo
190415bccaaSBruce Evans.else
191415bccaaSBruce EvansECHODIR		?=	true
192415bccaaSBruce Evans.endif
193415bccaaSBruce Evans.endif
194afe61c15SRodney W. Grimes
19556585ab5SBryan Drewery.if ${.MAKEFLAGS:M-N}
19656585ab5SBryan Drewery# bmake -N is supposed to skip executing anything but it does not skip
19756585ab5SBryan Drewery# exeucting '+' commands.  The '+' feature is used where .MAKE
19856585ab5SBryan Drewery# is not safe for the entire target.  -N is intended to skip building sub-makes
19956585ab5SBryan Drewery# so it executing '+' commands is not right.  Work around the bug by not
20056585ab5SBryan Drewery# setting '+' when -N is used.
201acabf29aSHartmut Brandt_+_		?=
202acabf29aSHartmut Brandt.else
203acabf29aSHartmut Brandt_+_		?=	+
204acabf29aSHartmut Brandt.endif
205acabf29aSHartmut Brandt
2062be2be74SSteve Price.if defined(%POSIX)
2072be2be74SSteve PriceFC		?=	fort77
2082be2be74SSteve PriceFFLAGS		?=	-O 1
2092be2be74SSteve Price.else
210415bccaaSBruce EvansFC		?=	f77
211415bccaaSBruce EvansFFLAGS		?=	-O
2122be2be74SSteve Price.endif
213415bccaaSBruce EvansEFLAGS		?=
214afe61c15SRodney W. Grimes
215c7499507SAndrey A. ChernovINSTALL		?=	install
216c7499507SAndrey A. Chernov
217415bccaaSBruce EvansLEX		?=	lex
218415bccaaSBruce EvansLFLAGS		?=
219afe61c15SRodney W. Grimes
220415bccaaSBruce EvansLD		?=	ld
2215b6dc2efSSimon J. GerratyLDFLAGS		?=				# LDFLAGS is for CC,
2225b6dc2efSSimon J. Gerraty_LDFLAGS	=	${LDFLAGS:S/-Wl,//g}	# strip -Wl, for LD
223afe61c15SRodney W. Grimes
224415bccaaSBruce EvansLINT		?=	lint
225bd42830fSRuslan ErmilovLINTFLAGS	?=	-cghapbx
226766f7d6eSMark MurrayLINTKERNFLAGS	?=	${LINTFLAGS}
227766f7d6eSMark MurrayLINTOBJFLAGS	?=	-cghapbxu -i
22834d81580SMark MurrayLINTOBJKERNFLAGS?=	${LINTOBJFLAGS}
229766f7d6eSMark MurrayLINTLIBFLAGS	?=	-cghapbxu -C ${LIB}
230afe61c15SRodney W. Grimes
231415bccaaSBruce EvansMAKE		?=	make
232afe61c15SRodney W. Grimes
2336f1d6967SWarner Losh.if !defined(%POSIX)
2346f1d6967SWarner LoshNM		?=	nm
23525ec8c92SRui PauloNMFLAGS		?=
2366f1d6967SWarner Losh
23770a6e331SBruce EvansOBJC		?=	cc
23870a6e331SBruce EvansOBJCFLAGS	?=	${OBJCINCLUDES} ${CFLAGS} -Wno-import
23970a6e331SBruce Evans
240e97696b5SEd MasteOBJCOPY		?=	objcopy
241e97696b5SEd Maste
242124cd641SAndrew TurnerOBJDUMP		?=	objdump
243124cd641SAndrew Turner
244415bccaaSBruce EvansPC		?=	pc
245415bccaaSBruce EvansPFLAGS		?=
246afe61c15SRodney W. Grimes
247415bccaaSBruce EvansRC		?=	f77
248415bccaaSBruce EvansRFLAGS		?=
24944383aa3SEd Maste.endif
250415bccaaSBruce Evans
251415bccaaSBruce EvansSHELL		?=	sh
252415bccaaSBruce Evans
25378abccfcSBaptiste Daroussin.if !defined(%POSIX)
25478abccfcSBaptiste DaroussinSIZE		?=	size
25578abccfcSBaptiste Daroussin.endif
25678abccfcSBaptiste Daroussin
257415bccaaSBruce EvansYACC		?=	yacc
2582be2be74SSteve Price.if defined(%POSIX)
2592be2be74SSteve PriceYFLAGS		?=
2602be2be74SSteve Price.else
261415bccaaSBruce EvansYFLAGS		?=	-d
2622be2be74SSteve Price.endif
2632be2be74SSteve Price
2642be2be74SSteve Price.if defined(%POSIX)
2658d962594SBruce Evans
2662be2be74SSteve Price# Posix 1003.2 mandated rules
2672be2be74SSteve Price#
2682be2be74SSteve Price# Quoted directly from the Posix 1003.2 draft, only the macros
2692be2be74SSteve Price# $@, $< and $* have been replaced by ${.TARGET}, ${.IMPSRC}, and
2702be2be74SSteve Price# ${.PREFIX}, resp.
2712be2be74SSteve Price
2722be2be74SSteve Price# SINGLE SUFFIX RULES
2732be2be74SSteve Price.c:
27432b97f0bSAlexander Langer	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
2752be2be74SSteve Price
2762be2be74SSteve Price.f:
27732b97f0bSAlexander Langer	${FC} ${FFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
2782be2be74SSteve Price
2792be2be74SSteve Price.sh:
2804be3feb2SWill Andrews	cp -f ${.IMPSRC} ${.TARGET}
2812be2be74SSteve Price	chmod a+x ${.TARGET}
2822be2be74SSteve Price
2832be2be74SSteve Price# DOUBLE SUFFIX RULES
2842be2be74SSteve Price
2852be2be74SSteve Price.c.o:
28632b97f0bSAlexander Langer	${CC} ${CFLAGS} -c ${.IMPSRC}
2872be2be74SSteve Price
2882be2be74SSteve Price.f.o:
28932b97f0bSAlexander Langer	${FC} ${FFLAGS} -c ${.IMPSRC}
2902be2be74SSteve Price
2912be2be74SSteve Price.y.o:
29232b97f0bSAlexander Langer	${YACC} ${YFLAGS} ${.IMPSRC}
29332b97f0bSAlexander Langer	${CC} ${CFLAGS} -c y.tab.c
294fc936cbdSDavid E. O'Brien	rm -f y.tab.c
2952be2be74SSteve Price	mv y.tab.o ${.TARGET}
2962be2be74SSteve Price
2972be2be74SSteve Price.l.o:
29832b97f0bSAlexander Langer	${LEX} ${LFLAGS} ${.IMPSRC}
29932b97f0bSAlexander Langer	${CC} ${CFLAGS} -c lex.yy.c
300fc936cbdSDavid E. O'Brien	rm -f lex.yy.c
3012be2be74SSteve Price	mv lex.yy.o ${.TARGET}
3022be2be74SSteve Price
3032be2be74SSteve Price.y.c:
30432b97f0bSAlexander Langer	${YACC} ${YFLAGS} ${.IMPSRC}
3052be2be74SSteve Price	mv y.tab.c ${.TARGET}
3062be2be74SSteve Price
3072be2be74SSteve Price.l.c:
30832b97f0bSAlexander Langer	${LEX} ${LFLAGS} ${.IMPSRC}
3092be2be74SSteve Price	mv lex.yy.c ${.TARGET}
3102be2be74SSteve Price
3112be2be74SSteve Price.c.a:
31232b97f0bSAlexander Langer	${CC} ${CFLAGS} -c ${.IMPSRC}
31332b97f0bSAlexander Langer	${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
314fc936cbdSDavid E. O'Brien	rm -f ${.PREFIX}.o
3152be2be74SSteve Price
3162be2be74SSteve Price.f.a:
31732b97f0bSAlexander Langer	${FC} ${FFLAGS} -c ${.IMPSRC}
31832b97f0bSAlexander Langer	${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
319fc936cbdSDavid E. O'Brien	rm -f ${.PREFIX}.o
3202be2be74SSteve Price
3212be2be74SSteve Price.else
3222be2be74SSteve Price
3232be2be74SSteve Price# non-Posix rule set
324415bccaaSBruce Evans
3255852ae2dSBryan Drewery.sh:
326180a8487SBryan Drewery	cp -f ${.IMPSRC} ${.TARGET}
327a9076ea0SBruce Evans	chmod a+x ${.TARGET}
328afe61c15SRodney W. Grimes
3295852ae2dSBryan Drewery.c.ln:
3305741a42fSMark Murray	${LINT} ${LINTOBJFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC} || \
3315741a42fSMark Murray	    touch ${.TARGET}
3325741a42fSMark Murray
3335852ae2dSBryan Drewery.cc.ln .C.ln .cpp.ln .cxx.ln:
3345741a42fSMark Murray	${LINT} ${LINTOBJFLAGS} ${CXXFLAGS:M-[DIU]*} ${.IMPSRC} || \
3355741a42fSMark Murray	    touch ${.TARGET}
3365741a42fSMark Murray
3375852ae2dSBryan Drewery.c:
338eb73cacdSDavid E. O'Brien	${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
33978e7e3ecSMax Khon	${CTFCONVERT_CMD}
340eb73cacdSDavid E. O'Brien
3415852ae2dSBryan Drewery.c.o:
342cee9be49SDimitry Andric	${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
34378e7e3ecSMax Khon	${CTFCONVERT_CMD}
344afe61c15SRodney W. Grimes
3455852ae2dSBryan Drewery.cc .cpp .cxx .C:
346eb73cacdSDavid E. O'Brien	${CXX} ${CXXFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
347eb73cacdSDavid E. O'Brien
3485852ae2dSBryan Drewery.cc.o .cpp.o .cxx.o .C.o:
349cee9be49SDimitry Andric	${CXX} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
3503585b293SGarrett Wollman
3515852ae2dSBryan Drewery.m.o:
352cee9be49SDimitry Andric	${OBJC} ${OBJCFLAGS} -c ${.IMPSRC} -o ${.TARGET}
35378e7e3ecSMax Khon	${CTFCONVERT_CMD}
35470a6e331SBruce Evans
3555852ae2dSBryan Drewery.p.o:
356cee9be49SDimitry Andric	${PC} ${PFLAGS} -c ${.IMPSRC} -o ${.TARGET}
35778e7e3ecSMax Khon	${CTFCONVERT_CMD}
358afe61c15SRodney W. Grimes
3595852ae2dSBryan Drewery.e .r .F .f:
3607b91cad9SDavid E. O'Brien	${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} \
3617b91cad9SDavid E. O'Brien	    -o ${.TARGET}
3627b91cad9SDavid E. O'Brien
3635852ae2dSBryan Drewery.e.o .r.o .F.o .f.o:
364cee9be49SDimitry Andric	${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} -c ${.IMPSRC} -o ${.TARGET}
365afe61c15SRodney W. Grimes
3665852ae2dSBryan Drewery.S.o:
3679160419cSBryan Drewery	${CC:N${CCACHE_BIN}} ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET}
36878e7e3ecSMax Khon	${CTFCONVERT_CMD}
369ea569569SRodney W. Grimes
3705852ae2dSBryan Drewery.asm.o:
3719160419cSBryan Drewery	${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} \
372cee9be49SDimitry Andric	    -o ${.TARGET}
37378e7e3ecSMax Khon	${CTFCONVERT_CMD}
374d58e932fSRuslan Ermilov
3755852ae2dSBryan Drewery.s.o:
376e517d11eSDavid E. O'Brien	${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
37778e7e3ecSMax Khon	${CTFCONVERT_CMD}
378e517d11eSDavid E. O'Brien
379006f5fe0SPoul-Henning Kamp# XXX not -j safe
3805852ae2dSBryan Drewery.y.o:
381006f5fe0SPoul-Henning Kamp	${YACC} ${YFLAGS} ${.IMPSRC}
382006f5fe0SPoul-Henning Kamp	${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET}
383fc936cbdSDavid E. O'Brien	rm -f y.tab.c
38478e7e3ecSMax Khon	${CTFCONVERT_CMD}
385afe61c15SRodney W. Grimes
3865852ae2dSBryan Drewery.l.o:
38750ef9020SPoul-Henning Kamp	${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
38850ef9020SPoul-Henning Kamp	${CC} ${CFLAGS} -c ${.PREFIX}.tmp.c -o ${.TARGET}
389fc936cbdSDavid E. O'Brien	rm -f ${.PREFIX}.tmp.c
39078e7e3ecSMax Khon	${CTFCONVERT_CMD}
391afe61c15SRodney W. Grimes
392c3e3432cSSteve Price# XXX not -j safe
3935852ae2dSBryan Drewery.y.c:
394c3e3432cSSteve Price	${YACC} ${YFLAGS} ${.IMPSRC}
395c3e3432cSSteve Price	mv y.tab.c ${.TARGET}
396afe61c15SRodney W. Grimes
3975852ae2dSBryan Drewery.l.c:
39850ef9020SPoul-Henning Kamp	${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.TARGET}
399afe61c15SRodney W. Grimes
4005852ae2dSBryan Drewery.s.out .c.out .o.out:
401a9076ea0SBruce Evans	${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
40278e7e3ecSMax Khon	${CTFCONVERT_CMD}
403afe61c15SRodney W. Grimes
4045852ae2dSBryan Drewery.f.out .F.out .r.out .e.out:
405a9076ea0SBruce Evans	${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} \
406afe61c15SRodney W. Grimes	    ${LDLIBS} -o ${.TARGET}
407fc936cbdSDavid E. O'Brien	rm -f ${.PREFIX}.o
40878e7e3ecSMax Khon	${CTFCONVERT_CMD}
409afe61c15SRodney W. Grimes
410006f5fe0SPoul-Henning Kamp# XXX not -j safe
4115852ae2dSBryan Drewery.y.out:
412006f5fe0SPoul-Henning Kamp	${YACC} ${YFLAGS} ${.IMPSRC}
413006f5fe0SPoul-Henning Kamp	${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET}
414fc936cbdSDavid E. O'Brien	rm -f y.tab.c
41578e7e3ecSMax Khon	${CTFCONVERT_CMD}
416afe61c15SRodney W. Grimes
4175852ae2dSBryan Drewery.l.out:
41850ef9020SPoul-Henning Kamp	${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
41950ef9020SPoul-Henning Kamp	${CC} ${CFLAGS} ${LDFLAGS} ${.PREFIX}.tmp.c ${LDLIBS} -ll -o ${.TARGET}
420fc936cbdSDavid E. O'Brien	rm -f ${.PREFIX}.tmp.c
42178e7e3ecSMax Khon	${CTFCONVERT_CMD}
4223585b293SGarrett Wollman
423daf514d0SSimon J. Gerraty# Pull in global settings.
424daf514d0SSimon J. Gerraty__MAKE_CONF?=/etc/make.conf
425daf514d0SSimon J. Gerraty.if exists(${__MAKE_CONF})
426daf514d0SSimon J. Gerraty.include "${__MAKE_CONF}"
427daf514d0SSimon J. Gerraty.endif
428daf514d0SSimon J. Gerraty
429daf514d0SSimon J. Gerraty# late include for customization
430b9d0791fSWarner Losh.sinclude <local.sys.mk>
43134bbee43SWarner Losh
432a39cea66SYaroslav Tykhiy.if defined(__MAKE_SHELL) && !empty(__MAKE_SHELL)
433a39cea66SYaroslav TykhiySHELL=	${__MAKE_SHELL}
434a39cea66SYaroslav Tykhiy.SHELL: path=${__MAKE_SHELL}
435a39cea66SYaroslav Tykhiy.endif
436a39cea66SYaroslav Tykhiy
437a0f1aa83SSimon J. Gerraty# Tell bmake to expand -V VAR by default
438a0f1aa83SSimon J. Gerraty.MAKE.EXPAND_VARIABLES= yes
439a0f1aa83SSimon J. Gerraty
440a0f1aa83SSimon J. Gerraty# Tell bmake the makefile preference
441a0f1aa83SSimon J. Gerraty.MAKE.MAKEFILE_PREFERENCE= BSDmakefile makefile Makefile
442a0f1aa83SSimon J. Gerraty
443c41b6218SBryan Drewery# Tell bmake to always pass job tokens, regardless of target depending on
444c41b6218SBryan Drewery# .MAKE or looking like ${MAKE}/${.MAKE}/$(MAKE)/$(.MAKE)/make.
445c41b6218SBryan Drewery.MAKE.ALWAYS_PASS_JOB_QUEUE= yes
446c41b6218SBryan Drewery
447a0f1aa83SSimon J. Gerraty# By default bmake does *not* use set -e
448a0f1aa83SSimon J. Gerraty# when running target scripts, this is a problem for many makefiles here.
449a0f1aa83SSimon J. Gerraty# So define a shell that will do what FreeBSD expects.
450a0f1aa83SSimon J. Gerraty.ifndef WITHOUT_SHELL_ERRCTL
451b9d0791fSWarner Losh__MAKE_SHELL?=/bin/sh
452a0f1aa83SSimon J. Gerraty.SHELL: name=sh \
453a0f1aa83SSimon J. Gerraty	quiet="set -" echo="set -v" filter="set -" \
454a0f1aa83SSimon J. Gerraty	hasErrCtl=yes check="set -e" ignore="set +e" \
455a0f1aa83SSimon J. Gerraty	echoFlag=v errFlag=e \
456b9d0791fSWarner Losh	path=${__MAKE_SHELL}
457a0f1aa83SSimon J. Gerraty.endif
458a0f1aa83SSimon J. Gerraty
4599ca54343SWarner Losh# Hack for ports compatibility. Historically, ports makefiles have
460682d8404SMarcelo Araujo# assumed they can examine MACHINE_CPU without including anything
4619ca54343SWarner Losh# because this was automatically included in sys.mk. For /usr/src,
4629ca54343SWarner Losh# this file has moved to being included from bsd.opts.mk. Until all
463682d8404SMarcelo Araujo# the ports files are modernized, and a reasonable transition
4649ca54343SWarner Losh# period has passed, include it while we're in a ports tree here
4659ca54343SWarner Losh# to preserve historic behavior.
4669ca54343SWarner Losh.if exists(${.CURDIR}/../../Mk/bsd.port.mk)
4678d962594SBruce Evans.include <bsd.cpu.mk>
4689ca54343SWarner Losh.endif
469be4646cfSWarner Losh
470be4646cfSWarner Losh.endif # ! Posix
471