sys.mk revision 36054
12340Sbde#	from: @(#)sys.mk	8.2 (Berkeley) 3/21/94
236054Sbde#	$Id: sys.mk,v 1.31 1998/05/01 11:36:59 jkh Exp $
31638Srgrimes
42340Sbdeunix		?=	We run FreeBSD, not UNIX.
51638Srgrimes
619343Ssteve# If the special target .POSIX appears (without prerequisites or
719343Ssteve# commands) before the first noncomment line in the makefile, make shall
819343Ssteve# process the makefile as specified by the Posix 1003.2 specification.
919343Ssteve# make(1) sets the special macro %POSIX in this case (to the actual
1019343Ssteve# value "1003.2", for what it's worth).
1119343Ssteve#
1219343Ssteve# The rules below use this macro to distinguish between Posix-compliant
1319343Ssteve# and default behaviour.
1419343Ssteve
1519343Ssteve.if defined(%POSIX)
1619343Ssteve.SUFFIXES:	.o .c .y .l .a .sh .f
1719343Ssteve.else
1836054Sbde.SUFFIXES:	.out .a .ln .o .c .cc .cxx .C .m .F .f .e .r .y .l .S .s .cl .p .h .sh
1919343Ssteve.endif
201638Srgrimes
211638Srgrimes.LIBS:		.a
221638Srgrimes
234224SphkX11BASE		?=	/usr/X11R6
242488Sjkh
252340SbdeAR		?=	ar
2619343Ssteve.if defined(%POSIX)
2719343SsteveARFLAGS		?=	-rv
2819343Ssteve.else
292340SbdeARFLAGS		?=	rl
3019343Ssteve.endif
312340SbdeRANLIB		?=	ranlib
321638Srgrimes
332340SbdeAS		?=	as
342340SbdeAFLAGS		?=
351638Srgrimes
3619343Ssteve.if defined(%POSIX)
3719343SsteveCC		?=	c89
3819343Ssteve.else
392340SbdeCC		?=	cc
4019343Ssteve.endif
4135578SjkhCFLAGS		?=	-O -pipe
421638Srgrimes
432419SpaulCXX		?=	c++
442340SbdeCXXFLAGS	?=	${CXXINCLUDES} ${CFLAGS}
451638Srgrimes
462340SbdeCPP		?=	cpp
471638Srgrimes
482340Sbde.if ${.MAKEFLAGS:M-s} == ""
492340SbdeECHO		?=	echo
502340SbdeECHODIR		?=	echo
512340Sbde.else
522340SbdeECHO		?=	true
532340Sbde.if ${.MAKEFLAGS:M-s} == "-s"
542340SbdeECHODIR		?=	echo
552340Sbde.else
562340SbdeECHODIR		?=	true
572340Sbde.endif
582340Sbde.endif
591638Srgrimes
6019343Ssteve.if defined(%POSIX)
6119343SsteveFC		?=	fort77
6219343SsteveFFLAGS		?=	-O 1
6319343Ssteve.else
642340SbdeFC		?=	f77
652340SbdeFFLAGS		?=	-O
6619343Ssteve.endif
672340SbdeEFLAGS		?=
681638Srgrimes
695257SacheINSTALL		?=	install
705257Sache
712340SbdeLEX		?=	lex
722340SbdeLFLAGS		?=
731638Srgrimes
742340SbdeLD		?=	ld
752340SbdeLDFLAGS		?=
761638Srgrimes
772340SbdeLINT		?=	lint
782340SbdeLINTFLAGS	?=	-chapbx
791638Srgrimes
802340SbdeMAKE		?=	make
811638Srgrimes
8236054SbdeOBJC		?=	cc
8336054SbdeOBJCFLAGS	?=	${OBJCINCLUDES} ${CFLAGS} -Wno-import
8436054Sbde
852340SbdePC		?=	pc
862340SbdePFLAGS		?=
871638Srgrimes
882340SbdeRC		?=	f77
892340SbdeRFLAGS		?=
901638Srgrimes
912340SbdeSHELL		?=	sh
922340Sbde
932340SbdeYACC		?=	yacc
9419343Ssteve.if defined(%POSIX)
9519343SsteveYFLAGS		?=
9619343Ssteve.else
972340SbdeYFLAGS		?=	-d
9819343Ssteve.endif
992340Sbde
10032661Sjb# FreeBSD/i386 as traditionally been built with a version of make
10132661Sjb# which knows MACHINE, but not MACHINE_ARCH. When building on other
10232661Sjb# architectures, assume that the version of make being used has an
10332661Sjb# explicit MACHINE_ARCH setting and treat a missing MACHINE_ARCH
10432661Sjb# as an i386 architecture.
10532661SjbMACHINE_ARCH?=	i386
10632661Sjb
10729141Speter# Default executable format
10832661Sjb.if ${MACHINE_ARCH} == "alpha"
10932495SjbBINFORMAT	?=	elf
11032495Sjb.else
11129141SpeterBINFORMAT	?=	aout
11232495Sjb.endif
11329141Speter
11424861Sjkh# For tags rule.
11534829SeivindGTAGSFLAGS=	-o
11624861SjkhHTAGSFLAGS=
11724861Sjkh
11819343Ssteve.if defined(%POSIX)
11919343Ssteve# Posix 1003.2 mandated rules
12019343Ssteve#
12119343Ssteve# Quoted directly from the Posix 1003.2 draft, only the macros
12219343Ssteve# $@, $< and $* have been replaced by ${.TARGET}, ${.IMPSRC}, and
12319343Ssteve# ${.PREFIX}, resp.
12419343Ssteve
12519343Ssteve# SINGLE SUFFIX RULES
12611613Sbde.c:
12719481Salex	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
12819343Ssteve
12919343Ssteve.f:
13019481Salex	${FC} ${FFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
13119343Ssteve
13219343Ssteve.sh:
13319343Ssteve	cp ${.IMPSRC} ${.TARGET}
13419343Ssteve	chmod a+x ${.TARGET}
13519343Ssteve
13619343Ssteve# DOUBLE SUFFIX RULES
13719343Ssteve
13819343Ssteve.c.o:
13919481Salex	${CC} ${CFLAGS} -c ${.IMPSRC}
14019343Ssteve
14119343Ssteve.f.o:
14219481Salex	${FC} ${FFLAGS} -c ${.IMPSRC}
14319343Ssteve
14419343Ssteve.y.o:
14519481Salex	${YACC} ${YFLAGS} ${.IMPSRC}
14619481Salex	${CC} ${CFLAGS} -c y.tab.c
14719343Ssteve	rm -f y.tab.c
14819343Ssteve	mv y.tab.o ${.TARGET}
14919343Ssteve
15019343Ssteve.l.o:
15119481Salex	${LEX} ${LFLAGS} ${.IMPSRC}
15219481Salex	${CC} ${CFLAGS} -c lex.yy.c
15319343Ssteve	rm -f lex.yy.c
15419343Ssteve	mv lex.yy.o ${.TARGET}
15519343Ssteve
15619343Ssteve.y.c:
15719481Salex	${YACC} ${YFLAGS} ${.IMPSRC}
15819343Ssteve	mv y.tab.c ${.TARGET}
15919343Ssteve
16019343Ssteve.l.c:
16119481Salex	${LEX} ${LFLAGS} ${.IMPSRC}
16219343Ssteve	mv lex.yy.c ${.TARGET}
16319343Ssteve
16419343Ssteve.c.a:
16519481Salex	${CC} ${CFLAGS} -c ${.IMPSRC}
16619481Salex	${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
16719343Ssteve	rm -f ${.PREFIX}.o
16819343Ssteve
16919343Ssteve.f.a:
17019481Salex	${FC} ${FFLAGS} -c ${.IMPSRC}
17119481Salex	${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
17219343Ssteve	rm -f ${.PREFIX}.o
17319343Ssteve
17419343Ssteve.else
17519343Ssteve
17619343Ssteve# non-Posix rule set
17719343Ssteve
17819343Ssteve.c:
17911613Sbde	${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
1802340Sbde
18111613Sbde.sh:
18211613Sbde	cp -p ${.IMPSRC} ${.TARGET}
18311613Sbde	chmod a+x ${.TARGET}
18411613Sbde
1851638Srgrimes.c.o:
1861638Srgrimes	${CC} ${CFLAGS} -c ${.IMPSRC}
1871638Srgrimes
1881844Swollman.cc.o .cxx.o .C.o:
1891844Swollman	${CXX} ${CXXFLAGS} -c ${.IMPSRC}
1901844Swollman
19136054Sbde.m.o:
19236054Sbde	${OBJC} ${OBJCFLAGS} -c ${.IMPSRC}
19336054Sbde
1941638Srgrimes.p.o:
1951638Srgrimes	${PC} ${PFLAGS} -c ${.IMPSRC}
1961638Srgrimes
1971638Srgrimes.e.o .r.o .F.o .f.o:
1981638Srgrimes	${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} -c ${.IMPSRC}
1991638Srgrimes
2003292Srgrimes.S.o:
2013292Srgrimes	${CC} ${CFLAGS} -c ${.IMPSRC}
2023292Srgrimes
2031638Srgrimes.s.o:
2041638Srgrimes	${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
2051638Srgrimes
20616068Sphk# XXX not -j safe
2071638Srgrimes.y.o:
20816068Sphk	${YACC} ${YFLAGS} ${.IMPSRC}
20916068Sphk	${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET}
21016068Sphk	rm -f y.tab.c
2111638Srgrimes
2121638Srgrimes.l.o:
21315959Sphk	${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
21415959Sphk	${CC} ${CFLAGS} -c ${.PREFIX}.tmp.c -o ${.TARGET}
21515959Sphk	rm -f ${.PREFIX}.tmp.c
2161638Srgrimes
21721582Ssteve# XXX not -j safe
2181638Srgrimes.y.c:
21921582Ssteve	${YACC} ${YFLAGS} ${.IMPSRC}
22021582Ssteve	mv y.tab.c ${.TARGET}
2211638Srgrimes
2221638Srgrimes.l.c:
22315959Sphk	${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.TARGET}
2241638Srgrimes
2251638Srgrimes.s.out .c.out .o.out:
22611613Sbde	${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
2271638Srgrimes
2281638Srgrimes.f.out .F.out .r.out .e.out:
22911613Sbde	${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} \
2301638Srgrimes	    ${LDLIBS} -o ${.TARGET}
2311638Srgrimes	rm -f ${.PREFIX}.o
2321638Srgrimes
23316068Sphk# XXX not -j safe
2341638Srgrimes.y.out:
23516068Sphk	${YACC} ${YFLAGS} ${.IMPSRC}
23616068Sphk	${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET}
23716068Sphk	rm -f y.tab.c
2381638Srgrimes
2391638Srgrimes.l.out:
24015959Sphk	${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
24115959Sphk	${CC} ${CFLAGS} ${LDFLAGS} ${.PREFIX}.tmp.c ${LDLIBS} -ll -o ${.TARGET}
24215959Sphk	rm -f ${.PREFIX}.tmp.c
2431844Swollman
24419343Ssteve.endif
24519343Ssteve
2461844Swollman.include <bsd.own.mk>
2471844Swollman
2481844Swollman.if exists(/etc/make.conf)
2491844Swollman.include </etc/make.conf>
2501844Swollman.endif
251