sys.mk revision 19343
12340Sbde#	from: @(#)sys.mk	8.2 (Berkeley) 3/21/94
219343Ssteve#	$Id: sys.mk,v 1.16 1996/06/02 17:04:08 phk 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
1811613Sbde.SUFFIXES:	.out .a .ln .o .c .cc .cxx .C .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
4110028SdgCFLAGS		?=	-O
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
822340SbdePC		?=	pc
832340SbdePFLAGS		?=
841638Srgrimes
852340SbdeRC		?=	f77
862340SbdeRFLAGS		?=
871638Srgrimes
882340SbdeSHELL		?=	sh
892340Sbde
902340SbdeYACC		?=	yacc
9119343Ssteve.if defined(%POSIX)
9219343SsteveYFLAGS		?=
9319343Ssteve.else
942340SbdeYFLAGS		?=	-d
9519343Ssteve.endif
962340Sbde
9719343Ssteve.if defined(%POSIX)
9819343Ssteve# Posix 1003.2 mandated rules
9919343Ssteve#
10019343Ssteve# Quoted directly from the Posix 1003.2 draft, only the macros
10119343Ssteve# $@, $< and $* have been replaced by ${.TARGET}, ${.IMPSRC}, and
10219343Ssteve# ${.PREFIX}, resp.
10319343Ssteve
10419343Ssteve# SINGLE SUFFIX RULES
10511613Sbde.c:
10619343Ssteve	$(CC) $(CFLAGS) $(LDFLAGS) -o ${.TARGET} ${.IMPSRC}
10719343Ssteve
10819343Ssteve.f:
10919343Ssteve	$(FC) $(FFLAGS) $(LDFLAGS) -o ${.TARGET} ${.IMPSRC}
11019343Ssteve
11119343Ssteve.sh:
11219343Ssteve	cp ${.IMPSRC} ${.TARGET}
11319343Ssteve	chmod a+x ${.TARGET}
11419343Ssteve
11519343Ssteve# DOUBLE SUFFIX RULES
11619343Ssteve
11719343Ssteve.c.o:
11819343Ssteve	$(CC) $(CFLAGS) -c ${.IMPSRC}
11919343Ssteve
12019343Ssteve.f.o:
12119343Ssteve	$(FC) $(FFLAGS) -c ${.IMPSRC}
12219343Ssteve
12319343Ssteve.y.o:
12419343Ssteve	$(YACC) $(YFLAGS) ${.IMPSRC}
12519343Ssteve	$(CC) $(CFLAGS) -c y.tab.c
12619343Ssteve	rm -f y.tab.c
12719343Ssteve	mv y.tab.o ${.TARGET}
12819343Ssteve
12919343Ssteve.l.o:
13019343Ssteve	$(LEX) $(LFLAGS) ${.IMPSRC}
13119343Ssteve	$(CC) $(CFLAGS) -c lex.yy.c
13219343Ssteve	rm -f lex.yy.c
13319343Ssteve	mv lex.yy.o ${.TARGET}
13419343Ssteve
13519343Ssteve.y.c:
13619343Ssteve	$(YACC) $(YFLAGS) ${.IMPSRC}
13719343Ssteve	mv y.tab.c ${.TARGET}
13819343Ssteve
13919343Ssteve.l.c:
14019343Ssteve	$(LEX) $(LFLAGS) ${.IMPSRC}
14119343Ssteve	mv lex.yy.c ${.TARGET}
14219343Ssteve
14319343Ssteve.c.a:
14419343Ssteve	$(CC) -c $(CFLAGS) ${.IMPSRC}
14519343Ssteve	$(AR) $(ARFLAGS) ${.TARGET} ${.PREFIX}.o
14619343Ssteve	rm -f ${.PREFIX}.o
14719343Ssteve
14819343Ssteve.f.a:
14919343Ssteve	$(FC) -c $(FFLAGS) ${.IMPSRC}
15019343Ssteve	$(AR) $(ARFLAGS) ${.TARGET} ${.PREFIX}.o
15119343Ssteve	rm -f ${.PREFIX}.o
15219343Ssteve
15319343Ssteve.else
15419343Ssteve
15519343Ssteve# non-Posix rule set
15619343Ssteve
15719343Ssteve.c:
15811613Sbde	${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
1592340Sbde
16011613Sbde.sh:
16111613Sbde	cp -p ${.IMPSRC} ${.TARGET}
16211613Sbde	chmod a+x ${.TARGET}
16311613Sbde
1641638Srgrimes.c.o:
1651638Srgrimes	${CC} ${CFLAGS} -c ${.IMPSRC}
1661638Srgrimes
1671844Swollman.cc.o .cxx.o .C.o:
1681844Swollman	${CXX} ${CXXFLAGS} -c ${.IMPSRC}
1691844Swollman
1701638Srgrimes.p.o:
1711638Srgrimes	${PC} ${PFLAGS} -c ${.IMPSRC}
1721638Srgrimes
1731638Srgrimes.e.o .r.o .F.o .f.o:
1741638Srgrimes	${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} -c ${.IMPSRC}
1751638Srgrimes
1763292Srgrimes.S.o:
1773292Srgrimes	${CC} ${CFLAGS} -c ${.IMPSRC}
1783292Srgrimes
1791638Srgrimes.s.o:
1801638Srgrimes	${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
1811638Srgrimes
18216068Sphk# XXX not -j safe
1831638Srgrimes.y.o:
18416068Sphk	${YACC} ${YFLAGS} ${.IMPSRC}
18516068Sphk	${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET}
18616068Sphk	rm -f y.tab.c
1871638Srgrimes
1881638Srgrimes.l.o:
18915959Sphk	${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
19015959Sphk	${CC} ${CFLAGS} -c ${.PREFIX}.tmp.c -o ${.TARGET}
19115959Sphk	rm -f ${.PREFIX}.tmp.c
1921638Srgrimes
19316068Sphk# XXX not -j safe
1941638Srgrimes.y.c:
19516068Sphk	${YACC} ${YFLAGS} ${.IMPSRC}
19616068Sphk	mv y.tab.c ${.TARGET}
1971638Srgrimes
1981638Srgrimes.l.c:
19915959Sphk	${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.TARGET}
2001638Srgrimes
2011638Srgrimes.s.out .c.out .o.out:
20211613Sbde	${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
2031638Srgrimes
2041638Srgrimes.f.out .F.out .r.out .e.out:
20511613Sbde	${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} \
2061638Srgrimes	    ${LDLIBS} -o ${.TARGET}
2071638Srgrimes	rm -f ${.PREFIX}.o
2081638Srgrimes
20916068Sphk# XXX not -j safe
2101638Srgrimes.y.out:
21116068Sphk	${YACC} ${YFLAGS} ${.IMPSRC}
21216068Sphk	${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET}
21316068Sphk	rm -f y.tab.c
2141638Srgrimes
2151638Srgrimes.l.out:
21615959Sphk	${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
21715959Sphk	${CC} ${CFLAGS} ${LDFLAGS} ${.PREFIX}.tmp.c ${LDLIBS} -ll -o ${.TARGET}
21815959Sphk	rm -f ${.PREFIX}.tmp.c
2191844Swollman
22019343Ssteve.endif
22119343Ssteve
2221844Swollman.include <bsd.own.mk>
2231844Swollman
2241844Swollman.if exists(/etc/make.conf)
2251844Swollman.include </etc/make.conf>
2261844Swollman.endif
227