bsd.prog.mk revision 1638
11638Srgrimes# @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94 21638Srgrimes 31638Srgrimes.if !defined(NOINCLUDE) && exists(${.CURDIR}/../Makefile.inc) 41638Srgrimes.include "${.CURDIR}/../Makefile.inc" 51638Srgrimes.endif 61638Srgrimes 71638Srgrimes.SUFFIXES: .out .o .c .y .l .s .8 .7 .6 .5 .4 .3 .2 .1 .0 81638Srgrimes 91638Srgrimes.8.0 .7.0 .6.0 .5.0 .4.0 .3.0 .2.0 .1.0: 101638Srgrimes nroff -man ${.IMPSRC} > ${.TARGET} 111638Srgrimes 121638SrgrimesCFLAGS+=${COPTS} 131638Srgrimes 141638SrgrimesSTRIP?= -s 151638Srgrimes 161638SrgrimesBINGRP?= bin 171638SrgrimesBINOWN?= bin 181638SrgrimesBINMODE?= 555 191638Srgrimes 201638SrgrimesLIBC?= /usr/lib/libc.a 211638SrgrimesLIBCOMPAT?= /usr/lib/libcompat.a 221638SrgrimesLIBCURSES?= /usr/lib/libcurses.a 231638SrgrimesLIBDBM?= /usr/lib/libdbm.a 241638SrgrimesLIBDES?= /usr/lib/libdes.a 251638SrgrimesLIBL?= /usr/lib/libl.a 261638SrgrimesLIBKDB?= /usr/lib/libkdb.a 271638SrgrimesLIBKRB?= /usr/lib/libkrb.a 281638SrgrimesLIBKVM?= /usr/lib/libkvm.a 291638SrgrimesLIBM?= /usr/lib/libm.a 301638SrgrimesLIBMP?= /usr/lib/libmp.a 311638SrgrimesLIBPC?= /usr/lib/libpc.a 321638SrgrimesLIBPLOT?= /usr/lib/libplot.a 331638SrgrimesLIBRESOLV?= /usr/lib/libresolv.a 341638SrgrimesLIBRPC?= /usr/lib/sunrpc.a 351638SrgrimesLIBTERM?= /usr/lib/libterm.a 361638SrgrimesLIBUTIL?= /usr/lib/libutil.a 371638Srgrimes 381638Srgrimes.if defined(SHAREDSTRINGS) 391638SrgrimesCLEANFILES+=strings 401638Srgrimes.c.o: 411638Srgrimes ${CC} -E ${CFLAGS} ${.IMPSRC} | xstr -c - 421638Srgrimes @${CC} ${CFLAGS} -c x.c -o ${.TARGET} 431638Srgrimes @rm -f x.c 441638Srgrimes.endif 451638Srgrimes 461638Srgrimes.if defined(PROG) 471638Srgrimes.if defined(SRCS) 481638Srgrimes 491638SrgrimesOBJS+= ${SRCS:R:S/$/.o/g} 501638Srgrimes 511638Srgrimes${PROG}: ${OBJS} ${LIBC} ${DPADD} 521638Srgrimes ${CC} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} 531638Srgrimes 541638Srgrimes.else defined(SRCS) 551638Srgrimes 561638SrgrimesSRCS= ${PROG}.c 571638Srgrimes 581638Srgrimes${PROG}: ${SRCS} ${LIBC} ${DPADD} 591638Srgrimes ${CC} ${CFLAGS} -o ${.TARGET} ${.CURDIR}/${SRCS} ${LDADD} 601638Srgrimes 611638SrgrimesMKDEP= -p 621638Srgrimes 631638Srgrimes.endif 641638Srgrimes 651638Srgrimes.if !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \ 661638Srgrimes !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \ 671638Srgrimes !defined(MAN7) && !defined(MAN8) && !defined(NOMAN) 681638SrgrimesMAN1= ${PROG}.0 691638Srgrimes.endif 701638Srgrimes.endif 711638Srgrimes.if !defined(NOMAN) 721638SrgrimesMANALL= ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8} 731638Srgrimes.else 741638SrgrimesMANALL= 751638Srgrimes.endif 761638Srgrimesmanpages: ${MANALL} 771638Srgrimes 781638Srgrimes_PROGSUBDIR: .USE 791638Srgrimes.if defined(SUBDIR) && !empty(SUBDIR) 801638Srgrimes @for entry in ${SUBDIR}; do \ 811638Srgrimes (echo "===> $$entry"; \ 821638Srgrimes if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \ 831638Srgrimes cd ${.CURDIR}/$${entry}.${MACHINE}; \ 841638Srgrimes else \ 851638Srgrimes cd ${.CURDIR}/$${entry}; \ 861638Srgrimes fi; \ 871638Srgrimes ${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/}); \ 881638Srgrimes done 891638Srgrimes.endif 901638Srgrimes 911638Srgrimes.if !target(all) 921638Srgrimes.MAIN: all 931638Srgrimesall: ${PROG} ${MANALL} _PROGSUBDIR 941638Srgrimes.endif 951638Srgrimes 961638Srgrimes.if !target(clean) 971638Srgrimesclean: _PROGSUBDIR 981638Srgrimes rm -f a.out [Ee]rrs mklog ${PROG}.core ${PROG} ${OBJS} ${CLEANFILES} 991638Srgrimes.endif 1001638Srgrimes 1011638Srgrimes.if !target(cleandir) 1021638Srgrimescleandir: _PROGSUBDIR 1031638Srgrimes rm -f a.out [Ee]rrs mklog ${PROG}.core ${PROG} ${OBJS} ${CLEANFILES} 1041638Srgrimes rm -f .depend ${MANALL} 1051638Srgrimes.endif 1061638Srgrimes 1071638Srgrimes# some of the rules involve .h sources, so remove them from mkdep line 1081638Srgrimes.if !target(depend) 1091638Srgrimesdepend: .depend _PROGSUBDIR 1101638Srgrimes.depend: ${SRCS} 1111638Srgrimes.if defined(PROG) 1121638Srgrimes mkdep ${MKDEP} ${CFLAGS:M-[ID]*} ${.ALLSRC:M*.c} 1131638Srgrimes.endif 1141638Srgrimes.endif 1151638Srgrimes 1161638Srgrimes.if !target(install) 1171638Srgrimes.if !target(beforeinstall) 1181638Srgrimesbeforeinstall: 1191638Srgrimes.endif 1201638Srgrimes.if !target(afterinstall) 1211638Srgrimesafterinstall: 1221638Srgrimes.endif 1231638Srgrimes 1241638Srgrimesrealinstall: _PROGSUBDIR 1251638Srgrimes.if defined(PROG) 1261638Srgrimes install ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 1271638Srgrimes ${INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR} 1281638Srgrimes.endif 1291638Srgrimes.if defined(HIDEGAME) 1301638Srgrimes (cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG}; \ 1311638Srgrimes chown games.bin ${PROG}) 1321638Srgrimes.endif 1331638Srgrimes.if defined(LINKS) && !empty(LINKS) 1341638Srgrimes @set ${LINKS}; \ 1351638Srgrimes while test $$# -ge 2; do \ 1361638Srgrimes l=${DESTDIR}$$1; \ 1371638Srgrimes shift; \ 1381638Srgrimes t=${DESTDIR}$$1; \ 1391638Srgrimes shift; \ 1401638Srgrimes echo $$t -\> $$l; \ 1411638Srgrimes rm -f $$t; \ 1421638Srgrimes ln $$l $$t; \ 1431638Srgrimes done; true 1441638Srgrimes.endif 1451638Srgrimes 1461638Srgrimesinstall: afterinstall maninstall 1471638Srgrimesafterinstall: realinstall 1481638Srgrimesrealinstall: beforeinstall 1491638Srgrimes.endif 1501638Srgrimes 1511638Srgrimes.if !target(lint) 1521638Srgrimeslint: ${SRCS} _PROGSUBDIR 1531638Srgrimes.if defined(PROG) 1541638Srgrimes @${LINT} ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | more 2>&1 1551638Srgrimes.endif 1561638Srgrimes.endif 1571638Srgrimes 1581638Srgrimes.if !target(obj) 1591638Srgrimes.if defined(NOOBJ) 1601638Srgrimesobj: _PROGSUBDIR 1611638Srgrimes.else 1621638Srgrimesobj: _PROGSUBDIR 1631638Srgrimes @cd ${.CURDIR}; rm -rf obj; \ 1641638Srgrimes here=`pwd`; dest=/usr/obj/`echo $$here | sed 's,/usr/src/,,'`; \ 1651638Srgrimes echo "$$here -> $$dest"; ln -s $$dest obj; \ 1661638Srgrimes if test -d /usr/obj -a ! -d $$dest; then \ 1671638Srgrimes mkdir -p $$dest; \ 1681638Srgrimes else \ 1691638Srgrimes true; \ 1701638Srgrimes fi; 1711638Srgrimes.endif 1721638Srgrimes.endif 1731638Srgrimes 1741638Srgrimes.if !target(objdir) 1751638Srgrimes.if defined(NOOBJ) 1761638Srgrimesobjdir: _PROGSUBDIR 1771638Srgrimes.else 1781638Srgrimesobjdir: _PROGSUBDIR 1791638Srgrimes @cd ${.CURDIR}; \ 1801638Srgrimes here=`pwd`; dest=/usr/obj/`echo $$here | sed 's,/usr/src/,,'`; \ 1811638Srgrimes if test -d /usr/obj -a ! -d $$dest; then \ 1821638Srgrimes mkdir -p $$dest; \ 1831638Srgrimes else \ 1841638Srgrimes true; \ 1851638Srgrimes fi; 1861638Srgrimes.endif 1871638Srgrimes.endif 1881638Srgrimes 1891638Srgrimes.if !target(tags) 1901638Srgrimestags: ${SRCS} _PROGSUBDIR 1911638Srgrimes.if defined(PROG) 1921638Srgrimes -ctags -f /dev/stdout ${.ALLSRC} | \ 1931638Srgrimes sed "s;${.CURDIR}/;;" > ${.CURDIR}/tags 1941638Srgrimes.endif 1951638Srgrimes.endif 1961638Srgrimes 1971638Srgrimes.if !defined(NOMAN) 1981638Srgrimes.include <bsd.man.mk> 1991638Srgrimes.else 2001638Srgrimesmaninstall: 2011638Srgrimes.endif 202