1*66685Sbostic# @(#)bsd.prog.mk 8.2 (Berkeley) 04/02/94 241563Sbostic 356034Sbostic.if !defined(NOINCLUDE) && exists(${.CURDIR}/../Makefile.inc) 441369Sbostic.include "${.CURDIR}/../Makefile.inc" 540510Sbostic.endif 639193Sbostic 741559Sbostic.SUFFIXES: .out .o .c .y .l .s .8 .7 .6 .5 .4 .3 .2 .1 .0 841559Sbostic 941559Sbostic.8.0 .7.0 .6.0 .5.0 .4.0 .3.0 .2.0 .1.0: 1051067Sbostic nroff -man ${.IMPSRC} > ${.TARGET} 1141559Sbostic 1241559SbosticCFLAGS+=${COPTS} 1341559Sbostic 1441602SbosticSTRIP?= -s 1541602Sbostic 1641602SbosticBINGRP?= bin 1741602SbosticBINOWN?= bin 1841602SbosticBINMODE?= 555 1941602Sbostic 2044598SbosticLIBC?= /usr/lib/libc.a 2141369SbosticLIBCOMPAT?= /usr/lib/libcompat.a 2241369SbosticLIBCURSES?= /usr/lib/libcurses.a 2341369SbosticLIBDBM?= /usr/lib/libdbm.a 2441369SbosticLIBDES?= /usr/lib/libdes.a 2541369SbosticLIBL?= /usr/lib/libl.a 2641369SbosticLIBKDB?= /usr/lib/libkdb.a 2741369SbosticLIBKRB?= /usr/lib/libkrb.a 2853135SbosticLIBKVM?= /usr/lib/libkvm.a 2941369SbosticLIBM?= /usr/lib/libm.a 3041369SbosticLIBMP?= /usr/lib/libmp.a 3141369SbosticLIBPC?= /usr/lib/libpc.a 3241369SbosticLIBPLOT?= /usr/lib/libplot.a 3343473SbosticLIBRESOLV?= /usr/lib/libresolv.a 3441369SbosticLIBRPC?= /usr/lib/sunrpc.a 3541369SbosticLIBTERM?= /usr/lib/libterm.a 3641369SbosticLIBUTIL?= /usr/lib/libutil.a 3739208Sbostic 3841559Sbostic.if defined(SHAREDSTRINGS) 3943649SbosticCLEANFILES+=strings 4041559Sbostic.c.o: 4142446Sbostic ${CC} -E ${CFLAGS} ${.IMPSRC} | xstr -c - 4241559Sbostic @${CC} ${CFLAGS} -c x.c -o ${.TARGET} 4341559Sbostic @rm -f x.c 4441559Sbostic.endif 4541559Sbostic 4641556Sbostic.if defined(PROG) 4741369Sbostic.if defined(SRCS) 4839199Sbostic 4946047SbosticOBJS+= ${SRCS:R:S/$/.o/g} 5039199Sbostic 5141369Sbostic${PROG}: ${OBJS} ${LIBC} ${DPADD} 5241369Sbostic ${CC} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} 5339208Sbostic 5451695Skarels.else defined(SRCS) 5539208Sbostic 5641369SbosticSRCS= ${PROG}.c 5739208Sbostic 5841369Sbostic${PROG}: ${SRCS} ${LIBC} ${DPADD} 5941369Sbostic ${CC} ${CFLAGS} -o ${.TARGET} ${.CURDIR}/${SRCS} ${LDADD} 6039193Sbostic 6143505SbosticMKDEP= -p 6243505Sbostic 6341369Sbostic.endif 6439193Sbostic 6541369Sbostic.if !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \ 6641369Sbostic !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \ 6741369Sbostic !defined(MAN7) && !defined(MAN8) && !defined(NOMAN) 6840510SbosticMAN1= ${PROG}.0 6939208Sbostic.endif 7041556Sbostic.endif 7155712Sbostic.if !defined(NOMAN) 7241369SbosticMANALL= ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8} 7355712Sbostic.else 7455712SbosticMANALL= 7555712Sbostic.endif 7650803Skarelsmanpages: ${MANALL} 7739208Sbostic 7841602Sbostic_PROGSUBDIR: .USE 7941369Sbostic.if defined(SUBDIR) && !empty(SUBDIR) 8041369Sbostic @for entry in ${SUBDIR}; do \ 8141602Sbostic (echo "===> $$entry"; \ 8241369Sbostic if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \ 8341369Sbostic cd ${.CURDIR}/$${entry}.${MACHINE}; \ 8441369Sbostic else \ 8541369Sbostic cd ${.CURDIR}/$${entry}; \ 8641369Sbostic fi; \ 8746193Sbostic ${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/}); \ 8841369Sbostic done 8941369Sbostic.endif 9039193Sbostic 9151695Skarels.if !target(all) 9241369Sbostic.MAIN: all 9341602Sbosticall: ${PROG} ${MANALL} _PROGSUBDIR 9451695Skarels.endif 9539193Sbostic 9641369Sbostic.if !target(clean) 9741602Sbosticclean: _PROGSUBDIR 98*66685Sbostic rm -f a.out [Ee]rrs mklog ${PROG}.core ${PROG} ${OBJS} ${CLEANFILES} 9939208Sbostic.endif 10039208Sbostic 10141461Sbostic.if !target(cleandir) 10241602Sbosticcleandir: _PROGSUBDIR 103*66685Sbostic rm -f a.out [Ee]rrs mklog ${PROG}.core ${PROG} ${OBJS} ${CLEANFILES} 10450130Sbostic rm -f .depend ${MANALL} 10541461Sbostic.endif 10639193Sbostic 10741369Sbostic# some of the rules involve .h sources, so remove them from mkdep line 10841461Sbostic.if !target(depend) 10942442Sbosticdepend: .depend _PROGSUBDIR 11042442Sbostic.depend: ${SRCS} 11142069Sbostic.if defined(PROG) 11243505Sbostic mkdep ${MKDEP} ${CFLAGS:M-[ID]*} ${.ALLSRC:M*.c} 11341461Sbostic.endif 11442069Sbostic.endif 11539193Sbostic 11641461Sbostic.if !target(install) 11741461Sbostic.if !target(beforeinstall) 11841461Sbosticbeforeinstall: 11941461Sbostic.endif 12041602Sbostic.if !target(afterinstall) 12141602Sbosticafterinstall: 12241602Sbostic.endif 12341461Sbostic 12441602Sbosticrealinstall: _PROGSUBDIR 12541602Sbostic.if defined(PROG) 12639208Sbostic install ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 12763868Sbostic ${INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR} 12841602Sbostic.endif 12941369Sbostic.if defined(HIDEGAME) 13041369Sbostic (cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG}; \ 13141369Sbostic chown games.bin ${PROG}) 13239208Sbostic.endif 13341602Sbostic.if defined(LINKS) && !empty(LINKS) 13441602Sbostic @set ${LINKS}; \ 13541602Sbostic while test $$# -ge 2; do \ 13641602Sbostic l=${DESTDIR}$$1; \ 13741602Sbostic shift; \ 13841602Sbostic t=${DESTDIR}$$1; \ 13941602Sbostic shift; \ 14041602Sbostic echo $$t -\> $$l; \ 14141602Sbostic rm -f $$t; \ 14241602Sbostic ln $$l $$t; \ 14341602Sbostic done; true 14441602Sbostic.endif 14540510Sbostic 14650803Skarelsinstall: afterinstall maninstall 14741602Sbosticafterinstall: realinstall 14841602Sbosticrealinstall: beforeinstall 14941461Sbostic.endif 15041461Sbostic 15141461Sbostic.if !target(lint) 15241602Sbosticlint: ${SRCS} _PROGSUBDIR 15342069Sbostic.if defined(PROG) 15441369Sbostic @${LINT} ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | more 2>&1 15541461Sbostic.endif 15642069Sbostic.endif 15741369Sbostic 15843473Sbostic.if !target(obj) 15943473Sbostic.if defined(NOOBJ) 16043473Sbosticobj: _PROGSUBDIR 16143473Sbostic.else 16243473Sbosticobj: _PROGSUBDIR 16343473Sbostic @cd ${.CURDIR}; rm -rf obj; \ 16443473Sbostic here=`pwd`; dest=/usr/obj/`echo $$here | sed 's,/usr/src/,,'`; \ 16545780Sbostic echo "$$here -> $$dest"; ln -s $$dest obj; \ 16645780Sbostic if test -d /usr/obj -a ! -d $$dest; then \ 16745780Sbostic mkdir -p $$dest; \ 16845780Sbostic else \ 16945780Sbostic true; \ 17045780Sbostic fi; 17143473Sbostic.endif 17243473Sbostic.endif 17343473Sbostic 17450803Skarels.if !target(objdir) 17550803Skarels.if defined(NOOBJ) 17650803Skarelsobjdir: _PROGSUBDIR 17750803Skarels.else 17850803Skarelsobjdir: _PROGSUBDIR 17950803Skarels @cd ${.CURDIR}; \ 18050803Skarels here=`pwd`; dest=/usr/obj/`echo $$here | sed 's,/usr/src/,,'`; \ 18150803Skarels if test -d /usr/obj -a ! -d $$dest; then \ 18250803Skarels mkdir -p $$dest; \ 18350803Skarels else \ 18450803Skarels true; \ 18550803Skarels fi; 18650803Skarels.endif 18750803Skarels.endif 18850803Skarels 18941461Sbostic.if !target(tags) 19041602Sbostictags: ${SRCS} _PROGSUBDIR 19142069Sbostic.if defined(PROG) 19256928Sbostic -ctags -f /dev/stdout ${.ALLSRC} | \ 19356928Sbostic sed "s;${.CURDIR}/;;" > ${.CURDIR}/tags 19441461Sbostic.endif 19542069Sbostic.endif 19641369Sbostic 19741602Sbostic.if !defined(NOMAN) 19841602Sbostic.include <bsd.man.mk> 19951169Sbostic.else 20051169Sbosticmaninstall: 20141602Sbostic.endif 202