sys.mk revision 19481
11556Srgrimes#	from: @(#)sys.mk	8.2 (Berkeley) 3/21/94
21556Srgrimes#	$Id: sys.mk,v 1.17 1996/11/03 03:25:50 steve Exp $
31556Srgrimes
41556Srgrimesunix		?=	We run FreeBSD, not UNIX.
51556Srgrimes
61556Srgrimes# If the special target .POSIX appears (without prerequisites or
71556Srgrimes# commands) before the first noncomment line in the makefile, make shall
81556Srgrimes# process the makefile as specified by the Posix 1003.2 specification.
91556Srgrimes# make(1) sets the special macro %POSIX in this case (to the actual
101556Srgrimes# value "1003.2", for what it's worth).
111556Srgrimes#
121556Srgrimes# The rules below use this macro to distinguish between Posix-compliant
131556Srgrimes# and default behaviour.
141556Srgrimes
151556Srgrimes.if defined(%POSIX)
161556Srgrimes.SUFFIXES:	.o .c .y .l .a .sh .f
171556Srgrimes.else
181556Srgrimes.SUFFIXES:	.out .a .ln .o .c .cc .cxx .C .F .f .e .r .y .l .S .s .cl .p .h .sh
191556Srgrimes.endif
201556Srgrimes
211556Srgrimes.LIBS:		.a
221556Srgrimes
231556SrgrimesX11BASE		?=	/usr/X11R6
241556Srgrimes
251556SrgrimesAR		?=	ar
261556Srgrimes.if defined(%POSIX)
271556SrgrimesARFLAGS		?=	-rv
281556Srgrimes.else
291556SrgrimesARFLAGS		?=	rl
301556Srgrimes.endif
311556SrgrimesRANLIB		?=	ranlib
321556Srgrimes
331556SrgrimesAS		?=	as
341556SrgrimesAFLAGS		?=
351556Srgrimes
363044Sdg.if defined(%POSIX)
3719720SphkCC		?=	c89
381556Srgrimes.else
391556SrgrimesCC		?=	cc
401556Srgrimes.endif
411556SrgrimesCFLAGS		?=	-O
421556Srgrimes
431556SrgrimesCXX		?=	c++
441556SrgrimesCXXFLAGS	?=	${CXXINCLUDES} ${CFLAGS}
451556Srgrimes
461556SrgrimesCPP		?=	cpp
471556Srgrimes
481556Srgrimes.if ${.MAKEFLAGS:M-s} == ""
491556SrgrimesECHO		?=	echo
501556SrgrimesECHODIR		?=	echo
511556Srgrimes.else
521556SrgrimesECHO		?=	true
531556Srgrimes.if ${.MAKEFLAGS:M-s} == "-s"
541556SrgrimesECHODIR		?=	echo
551556Srgrimes.else
561556SrgrimesECHODIR		?=	true
571556Srgrimes.endif
581556Srgrimes.endif
591556Srgrimes
601556Srgrimes.if defined(%POSIX)
611556SrgrimesFC		?=	fort77
621556SrgrimesFFLAGS		?=	-O 1
631556Srgrimes.else
641556SrgrimesFC		?=	f77
651556SrgrimesFFLAGS		?=	-O
661556Srgrimes.endif
671556SrgrimesEFLAGS		?=
681556Srgrimes
691556SrgrimesINSTALL		?=	install
701556Srgrimes
711556SrgrimesLEX		?=	lex
721556SrgrimesLFLAGS		?=
731556Srgrimes
741556SrgrimesLD		?=	ld
751556SrgrimesLDFLAGS		?=
761556Srgrimes
771556SrgrimesLINT		?=	lint
781556SrgrimesLINTFLAGS	?=	-chapbx
791556Srgrimes
801556SrgrimesMAKE		?=	make
811556Srgrimes
821556SrgrimesPC		?=	pc
831556SrgrimesPFLAGS		?=
841556Srgrimes
851556SrgrimesRC		?=	f77
861556SrgrimesRFLAGS		?=
871556Srgrimes
881556SrgrimesSHELL		?=	sh
891556Srgrimes
901556SrgrimesYACC		?=	yacc
911556Srgrimes.if defined(%POSIX)
921556SrgrimesYFLAGS		?=
931556Srgrimes.else
941556SrgrimesYFLAGS		?=	-d
951556Srgrimes.endif
961556Srgrimes
971556Srgrimes.if defined(%POSIX)
981556Srgrimes# Posix 1003.2 mandated rules
991556Srgrimes#
1001556Srgrimes# Quoted directly from the Posix 1003.2 draft, only the macros
1011556Srgrimes# $@, $< and $* have been replaced by ${.TARGET}, ${.IMPSRC}, and
1021556Srgrimes# ${.PREFIX}, resp.
10319720Sphk
1041556Srgrimes# SINGLE SUFFIX RULES
1051556Srgrimes.c:
1061556Srgrimes	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
1071556Srgrimes
1081556Srgrimes.f:
1091556Srgrimes	${FC} ${FFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
1101556Srgrimes
1111556Srgrimes.sh:
1121556Srgrimes	cp ${.IMPSRC} ${.TARGET}
1131556Srgrimes	chmod a+x ${.TARGET}
1141556Srgrimes
1151556Srgrimes# DOUBLE SUFFIX RULES
1161556Srgrimes
1171556Srgrimes.c.o:
1181556Srgrimes	${CC} ${CFLAGS} -c ${.IMPSRC}
1191556Srgrimes
1201556Srgrimes.f.o:
1211556Srgrimes	${FC} ${FFLAGS} -c ${.IMPSRC}
1221556Srgrimes
1231556Srgrimes.y.o:
1241556Srgrimes	${YACC} ${YFLAGS} ${.IMPSRC}
1251556Srgrimes	${CC} ${CFLAGS} -c y.tab.c
1261556Srgrimes	rm -f y.tab.c
1271556Srgrimes	mv y.tab.o ${.TARGET}
1281556Srgrimes
1291556Srgrimes.l.o:
1301556Srgrimes	${LEX} ${LFLAGS} ${.IMPSRC}
1311556Srgrimes	${CC} ${CFLAGS} -c lex.yy.c
1321556Srgrimes	rm -f lex.yy.c
1331556Srgrimes	mv lex.yy.o ${.TARGET}
1341556Srgrimes
1351556Srgrimes.y.c:
1361556Srgrimes	${YACC} ${YFLAGS} ${.IMPSRC}
1371556Srgrimes	mv y.tab.c ${.TARGET}
1381556Srgrimes
1391556Srgrimes.l.c:
1401556Srgrimes	${LEX} ${LFLAGS} ${.IMPSRC}
1411556Srgrimes	mv lex.yy.c ${.TARGET}
1421556Srgrimes
1431556Srgrimes.c.a:
1441556Srgrimes	${CC} ${CFLAGS} -c ${.IMPSRC}
1451556Srgrimes	${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
1461556Srgrimes	rm -f ${.PREFIX}.o
1471556Srgrimes
1481556Srgrimes.f.a:
1491556Srgrimes	${FC} ${FFLAGS} -c ${.IMPSRC}
1501556Srgrimes	${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
1511556Srgrimes	rm -f ${.PREFIX}.o
1521556Srgrimes
1531556Srgrimes.else
1541556Srgrimes
1551556Srgrimes# non-Posix rule set
1561556Srgrimes
1571556Srgrimes.c:
1581556Srgrimes	${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
1591556Srgrimes
1601556Srgrimes.sh:
1611556Srgrimes	cp -p ${.IMPSRC} ${.TARGET}
1621556Srgrimes	chmod a+x ${.TARGET}
1631556Srgrimes
1641556Srgrimes.c.o:
1651556Srgrimes	${CC} ${CFLAGS} -c ${.IMPSRC}
1661556Srgrimes
1671556Srgrimes.cc.o .cxx.o .C.o:
1681556Srgrimes	${CXX} ${CXXFLAGS} -c ${.IMPSRC}
1691556Srgrimes
1701556Srgrimes.p.o:
1711556Srgrimes	${PC} ${PFLAGS} -c ${.IMPSRC}
1721556Srgrimes
1731556Srgrimes.e.o .r.o .F.o .f.o:
1741556Srgrimes	${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} -c ${.IMPSRC}
1751556Srgrimes
1761556Srgrimes.S.o:
1771556Srgrimes	${CC} ${CFLAGS} -c ${.IMPSRC}
1781556Srgrimes
1791556Srgrimes.s.o:
1801556Srgrimes	${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
1811556Srgrimes
1821556Srgrimes# XXX not -j safe
1831556Srgrimes.y.o:
1841556Srgrimes	${YACC} ${YFLAGS} ${.IMPSRC}
1851556Srgrimes	${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET}
1861556Srgrimes	rm -f y.tab.c
1871556Srgrimes
1881556Srgrimes.l.o:
1891556Srgrimes	${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
1901556Srgrimes	${CC} ${CFLAGS} -c ${.PREFIX}.tmp.c -o ${.TARGET}
1911556Srgrimes	rm -f ${.PREFIX}.tmp.c
1921556Srgrimes
1931556Srgrimes# XXX not -j safe
1941556Srgrimes.y.c:
1951556Srgrimes	${YACC} ${YFLAGS} ${.IMPSRC}
1961556Srgrimes	mv y.tab.c ${.TARGET}
1971556Srgrimes
1981556Srgrimes.l.c:
1991556Srgrimes	${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.TARGET}
2001556Srgrimes
2011556Srgrimes.s.out .c.out .o.out:
2021556Srgrimes	${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
2031556Srgrimes
2041556Srgrimes.f.out .F.out .r.out .e.out:
2051556Srgrimes	${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} \
2061556Srgrimes	    ${LDLIBS} -o ${.TARGET}
2071556Srgrimes	rm -f ${.PREFIX}.o
2081556Srgrimes
2091556Srgrimes# XXX not -j safe
2101556Srgrimes.y.out:
2111556Srgrimes	${YACC} ${YFLAGS} ${.IMPSRC}
2121556Srgrimes	${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET}
2131556Srgrimes	rm -f y.tab.c
2141556Srgrimes
2151556Srgrimes.l.out:
2161556Srgrimes	${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
2171556Srgrimes	${CC} ${CFLAGS} ${LDFLAGS} ${.PREFIX}.tmp.c ${LDLIBS} -ll -o ${.TARGET}
2181556Srgrimes	rm -f ${.PREFIX}.tmp.c
2191556Srgrimes
2201556Srgrimes.endif
2211556Srgrimes
2221556Srgrimes.include <bsd.own.mk>
2231556Srgrimes
2241556Srgrimes.if exists(/etc/make.conf)
2251556Srgrimes.include </etc/make.conf>
2261556Srgrimes.endif
2271556Srgrimes