1*53135Sbostic# @(#)bsd.prog.mk 5.31 (Berkeley) 04/08/92 241563Sbostic 341369Sbostic.if 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 28*53135SbosticLIBKVM?= /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 7141369SbosticMANALL= ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8} 7250803Skarelsmanpages: ${MANALL} 7339208Sbostic 7441602Sbostic_PROGSUBDIR: .USE 7541369Sbostic.if defined(SUBDIR) && !empty(SUBDIR) 7641369Sbostic @for entry in ${SUBDIR}; do \ 7741602Sbostic (echo "===> $$entry"; \ 7841369Sbostic if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \ 7941369Sbostic cd ${.CURDIR}/$${entry}.${MACHINE}; \ 8041369Sbostic else \ 8141369Sbostic cd ${.CURDIR}/$${entry}; \ 8241369Sbostic fi; \ 8346193Sbostic ${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/}); \ 8441369Sbostic done 8541369Sbostic.endif 8639193Sbostic 8751695Skarels.if !target(all) 8841369Sbostic.MAIN: all 8941602Sbosticall: ${PROG} ${MANALL} _PROGSUBDIR 9051695Skarels.endif 9139193Sbostic 9241369Sbostic.if !target(clean) 9341602Sbosticclean: _PROGSUBDIR 9441369Sbostic rm -f a.out [Ee]rrs mklog core ${PROG} ${OBJS} ${CLEANFILES} 9539208Sbostic.endif 9639208Sbostic 9741461Sbostic.if !target(cleandir) 9841602Sbosticcleandir: _PROGSUBDIR 9941369Sbostic rm -f a.out [Ee]rrs mklog core ${PROG} ${OBJS} ${CLEANFILES} 10050130Sbostic rm -f .depend ${MANALL} 10141461Sbostic.endif 10239193Sbostic 10341369Sbostic# some of the rules involve .h sources, so remove them from mkdep line 10441461Sbostic.if !target(depend) 10542442Sbosticdepend: .depend _PROGSUBDIR 10642442Sbostic.depend: ${SRCS} 10742069Sbostic.if defined(PROG) 10843505Sbostic mkdep ${MKDEP} ${CFLAGS:M-[ID]*} ${.ALLSRC:M*.c} 10941461Sbostic.endif 11042069Sbostic.endif 11139193Sbostic 11241461Sbostic.if !target(install) 11341461Sbostic.if !target(beforeinstall) 11441461Sbosticbeforeinstall: 11541461Sbostic.endif 11641602Sbostic.if !target(afterinstall) 11741602Sbosticafterinstall: 11841602Sbostic.endif 11941461Sbostic 12041602Sbosticrealinstall: _PROGSUBDIR 12141602Sbostic.if defined(PROG) 12239208Sbostic install ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 12340510Sbostic ${PROG} ${DESTDIR}${BINDIR} 12441602Sbostic.endif 12541369Sbostic.if defined(HIDEGAME) 12641369Sbostic (cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG}; \ 12741369Sbostic chown games.bin ${PROG}) 12839208Sbostic.endif 12941602Sbostic.if defined(LINKS) && !empty(LINKS) 13041602Sbostic @set ${LINKS}; \ 13141602Sbostic while test $$# -ge 2; do \ 13241602Sbostic l=${DESTDIR}$$1; \ 13341602Sbostic shift; \ 13441602Sbostic t=${DESTDIR}$$1; \ 13541602Sbostic shift; \ 13641602Sbostic echo $$t -\> $$l; \ 13741602Sbostic rm -f $$t; \ 13841602Sbostic ln $$l $$t; \ 13941602Sbostic done; true 14041602Sbostic.endif 14140510Sbostic 14250803Skarelsinstall: afterinstall maninstall 14341602Sbosticafterinstall: realinstall 14441602Sbosticrealinstall: beforeinstall 14541461Sbostic.endif 14641461Sbostic 14741461Sbostic.if !target(lint) 14841602Sbosticlint: ${SRCS} _PROGSUBDIR 14942069Sbostic.if defined(PROG) 15041369Sbostic @${LINT} ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | more 2>&1 15141461Sbostic.endif 15242069Sbostic.endif 15341369Sbostic 15443473Sbostic.if !target(obj) 15543473Sbostic.if defined(NOOBJ) 15643473Sbosticobj: _PROGSUBDIR 15743473Sbostic.else 15843473Sbosticobj: _PROGSUBDIR 15943473Sbostic @cd ${.CURDIR}; rm -rf obj; \ 16043473Sbostic here=`pwd`; dest=/usr/obj/`echo $$here | sed 's,/usr/src/,,'`; \ 16145780Sbostic echo "$$here -> $$dest"; ln -s $$dest obj; \ 16245780Sbostic if test -d /usr/obj -a ! -d $$dest; then \ 16345780Sbostic mkdir -p $$dest; \ 16445780Sbostic else \ 16545780Sbostic true; \ 16645780Sbostic fi; 16743473Sbostic.endif 16843473Sbostic.endif 16943473Sbostic 17050803Skarels.if !target(objdir) 17150803Skarels.if defined(NOOBJ) 17250803Skarelsobjdir: _PROGSUBDIR 17350803Skarels.else 17450803Skarelsobjdir: _PROGSUBDIR 17550803Skarels @cd ${.CURDIR}; \ 17650803Skarels here=`pwd`; dest=/usr/obj/`echo $$here | sed 's,/usr/src/,,'`; \ 17750803Skarels if test -d /usr/obj -a ! -d $$dest; then \ 17850803Skarels mkdir -p $$dest; \ 17950803Skarels else \ 18050803Skarels true; \ 18150803Skarels fi; 18250803Skarels.endif 18350803Skarels.endif 18450803Skarels 18541461Sbostic.if !target(tags) 18641602Sbostictags: ${SRCS} _PROGSUBDIR 18742069Sbostic.if defined(PROG) 18843473Sbostic -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC} | \ 18941874Sbostic sed "s;\${.CURDIR}/;;" > tags 19041461Sbostic.endif 19142069Sbostic.endif 19241369Sbostic 19341602Sbostic.if !defined(NOMAN) 19441602Sbostic.include <bsd.man.mk> 19551169Sbostic.else 19651169Sbosticmaninstall: 19741602Sbostic.endif 198