13585b293SGarrett Wollman# from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 2209396dfSPoul-Henning Kamp# $Id: bsd.prog.mk,v 1.34 1996/06/24 04:24:13 jkh Exp $ 3afe61c15SRodney W. Grimes 43585b293SGarrett Wollman.if exists(${.CURDIR}/../Makefile.inc) 5afe61c15SRodney W. Grimes.include "${.CURDIR}/../Makefile.inc" 6afe61c15SRodney W. Grimes.endif 7afe61c15SRodney W. Grimes 83585b293SGarrett Wollman.SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S 9afe61c15SRodney W. Grimes 10e82b0b99SJordan K. HubbardCFLAGS+=${COPTS} ${DEBUG_FLAGS} 113585b293SGarrett Wollman.if defined(DESTDIR) 123585b293SGarrett WollmanCFLAGS+= -I${DESTDIR}/usr/include 133585b293SGarrett WollmanCXXINCLUDES+= -I${DESTDIR}/usr/include/${CXX} 143585b293SGarrett Wollman.endif 15afe61c15SRodney W. Grimes 16e82b0b99SJordan K. Hubbard.if !defined(DEBUG_FLAGS) 17afe61c15SRodney W. GrimesSTRIP?= -s 18e82b0b99SJordan K. Hubbard.endif 19afe61c15SRodney W. Grimes 20afe61c15SRodney W. Grimes 213585b293SGarrett WollmanLIBCRT0?= ${DESTDIR}/usr/lib/crt0.o 22580ccec4SBruce EvansLIBKZHEAD?= ${DESTDIR}/usr/lib/kzhead.o 23580ccec4SBruce EvansLIBKZTAIL?= ${DESTDIR}/usr/lib/kztail.o 24580ccec4SBruce Evans 253585b293SGarrett WollmanLIBC?= ${DESTDIR}/usr/lib/libc.a 26580ccec4SBruce EvansLIBC_PIC= ${DESTDIR}/usr/lib/libc_pic.a 27580ccec4SBruce EvansLIBCOM_ERR= ${DESTDIR}/usr/lib/libcom_err.a 283585b293SGarrett WollmanLIBCOMPAT?= ${DESTDIR}/usr/lib/libcompat.a 293585b293SGarrett WollmanLIBCRYPT?= ${DESTDIR}/usr/lib/libcrypt.a 303585b293SGarrett WollmanLIBCURSES?= ${DESTDIR}/usr/lib/libcurses.a 313ecb4369SBruce EvansLIBDES?= ${DESTDIR}/usr/lib/libdes.a # XXX doesn't exist 3220bb37a7SAndrey A. ChernovLIBDIALOG?= ${DESTDIR}/usr/lib/libdialog.a 33580ccec4SBruce EvansLIBDISK?= ${DESTDIR}/usr/lib/libdisk.a 343ecb4369SBruce EvansLIBEDIT?= ${DESTDIR}/usr/lib/libedit.a 35580ccec4SBruce EvansLIBF2C?= ${DESTDIR}/usr/lib/libf2c.a 36580ccec4SBruce EvansLIBFL?= "don't use LIBFL, use LIBL" 37316cd0cfSAndrey A. ChernovLIBFORMS?= ${DESTDIR}/usr/lib/libforms.a 38abf58409SJordan K. HubbardLIBFTPIO?= ${DESTDIR}/usr/lib/libftpio.a 39580ccec4SBruce EvansLIBGPLUSPLUS?= ${DESTDIR}/usr/lib/libg++.a 403ecb4369SBruce EvansLIBGCC?= ${DESTDIR}/usr/lib/libgcc.a 41580ccec4SBruce EvansLIBGCC_PIC?= ${DESTDIR}/usr/lib/libgcc_pic.a 42580ccec4SBruce EvansLIBGMP?= ${DESTDIR}/usr/lib/libgmp.a 433585b293SGarrett WollmanLIBGNUREGEX?= ${DESTDIR}/usr/lib/libgnuregex.a 44580ccec4SBruce EvansLIBIPX?= ${DESTDIR}/usr/lib/libipx.a 453ecb4369SBruce EvansLIBKDB?= ${DESTDIR}/usr/lib/libkdb.a # XXX doesn't exist 463ecb4369SBruce EvansLIBKRB?= ${DESTDIR}/usr/lib/libkrb.a # XXX doesn't exist 47580ccec4SBruce EvansLIBKEYCAP?= ${DESTDIR}/usr/lib/libkeycap.a 483ecb4369SBruce EvansLIBKVM?= ${DESTDIR}/usr/lib/libkvm.a 493585b293SGarrett WollmanLIBL?= ${DESTDIR}/usr/lib/libl.a 50580ccec4SBruce EvansLIBLN?= "don't use, LIBLN, use LIBL" 513585b293SGarrett WollmanLIBM?= ${DESTDIR}/usr/lib/libm.a 521c423e89SPaul TrainaLIBMD?= ${DESTDIR}/usr/lib/libmd.a 53580ccec4SBruce EvansLIBMP?= ${DESTDIR}/usr/lib/libmp.a 5436ee0312SAndrey A. ChernovLIBMYTINFO?= ${DESTDIR}/usr/lib/libmytinfo.a 5536ee0312SAndrey A. ChernovLIBNCURSES?= ${DESTDIR}/usr/lib/libncurses.a 563ecb4369SBruce EvansLIBPC?= ${DESTDIR}/usr/lib/libpc.a # XXX doesn't exist 571dcbf7afSAndras OlahLIBPCAP?= ${DESTDIR}/usr/lib/libpcap.a 583ecb4369SBruce EvansLIBPLOT?= ${DESTDIR}/usr/lib/libplot.a # XXX doesn't exist 593585b293SGarrett WollmanLIBREADLINE?= ${DESTDIR}/usr/lib/libreadline.a 603585b293SGarrett WollmanLIBRESOLV?= ${DESTDIR}/usr/lib/libresolv.a 613585b293SGarrett WollmanLIBRPCSVC?= ${DESTDIR}/usr/lib/librpcsvc.a 62580ccec4SBruce EvansLIBSCRYPT?= "don't use LIBSCRYPT, use LIBCRYPT" 63316cd0cfSAndrey A. ChernovLIBSCSI?= ${DESTDIR}/usr/lib/libscsi.a 643585b293SGarrett WollmanLIBSKEY?= ${DESTDIR}/usr/lib/libskey.a 65580ccec4SBruce EvansLIBSS?= ${DESTDIR}/usr/lib/libss.a 66e767093fSPoul-Henning KampLIBTCL?= ${DESTDIR}/usr/lib/libtcl.a 673585b293SGarrett WollmanLIBTELNET?= ${DESTDIR}/usr/lib/libtelnet.a 680e58d919SRodney W. GrimesLIBTERMCAP?= ${DESTDIR}/usr/lib/libtermcap.a 69580ccec4SBruce EvansLIBTERMLIB?= "don't use LIBTERMLIB, use LIBTERMCAP" 703585b293SGarrett WollmanLIBUTIL?= ${DESTDIR}/usr/lib/libutil.a 71580ccec4SBruce EvansLIBXPG4?= ${DESTDIR}/usr/lib/libxpg4.a 723ecb4369SBruce EvansLIBY?= ${DESTDIR}/usr/lib/liby.a 733ecb4369SBruce Evans 743585b293SGarrett Wollman.if defined(NOSHARED) 753585b293SGarrett WollmanLDFLAGS+= -static 763585b293SGarrett Wollman.endif 77afe61c15SRodney W. Grimes 783585b293SGarrett Wollman.if defined(DESTDIR) 7943fae827SBruce EvansLDDESTDIR+= -L${DESTDIR}/usr/lib 80afe61c15SRodney W. Grimes.endif 81afe61c15SRodney W. Grimes 82afe61c15SRodney W. Grimes.if defined(PROG) 83afe61c15SRodney W. Grimes.if defined(SRCS) 84afe61c15SRodney W. Grimes 853585b293SGarrett WollmanDPSRCS+= ${SRCS:M*.h} 86ad1565eeSJordan K. Hubbard.if !defined(NOOBJ) 873585b293SGarrett WollmanOBJS+= ${SRCS:N*.h:R:S/$/.o/g} 8862ef7455SJordan K. Hubbard.endif 89afe61c15SRodney W. Grimes 903585b293SGarrett Wollman.if defined(LDONLY) 91afe61c15SRodney W. Grimes 923585b293SGarrett Wollman${PROG}: ${LIBCRT0} ${LIBC} ${DPSRCS} ${OBJS} ${DPADD} 93a4c39c7aSBruce Evans ${LD} ${LDFLAGS} -o ${.TARGET} ${LIBCRT0} ${OBJS} ${LIBC} ${LDDESTDIR} \ 943585b293SGarrett Wollman ${LDADD} 953585b293SGarrett Wollman 963585b293SGarrett Wollman.else defined(LDONLY) 973585b293SGarrett Wollman 983585b293SGarrett Wollman${PROG}: ${DPSRCS} ${OBJS} ${LIBC} ${DPADD} 993585b293SGarrett Wollman ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDDESTDIR} ${LDADD} 1003585b293SGarrett Wollman 1013585b293SGarrett Wollman.endif 1023585b293SGarrett Wollman 103fd2e43eaSBruce Evans.else !defined(SRCS) 104afe61c15SRodney W. Grimes 105afe61c15SRodney W. GrimesSRCS= ${PROG}.c 106afe61c15SRodney W. Grimes 107a4c39c7aSBruce Evans.if 0 1083585b293SGarrett Wollman${PROG}: ${DPSRCS} ${SRCS} ${LIBC} ${DPADD} 1093585b293SGarrett Wollman ${CC} ${LDFLAGS} ${CFLAGS} -o ${.TARGET} ${.CURDIR}/${SRCS} \ 1103585b293SGarrett Wollman ${LDDESTDIR} ${LDADD} 11114c28f38SBruce Evans 11214c28f38SBruce EvansMKDEP= -p 113a4c39c7aSBruce Evans.else 114a4c39c7aSBruce Evans# Always make an intermediate object file because: 115a4c39c7aSBruce Evans# - it saves time rebuilding when only the library has changed 116a4c39c7aSBruce Evans# - the name of the object gets put into the executable symbol table instead of 117a4c39c7aSBruce Evans# the name of a variable temporary object. 118a4c39c7aSBruce Evans# - it's useful to keep objects around for crunching. 119a4c39c7aSBruce EvansOBJS= ${PROG}.o 120a4c39c7aSBruce Evans${PROG}: ${DPSRCS} ${OBJS} ${LIBC} ${DPADD} 121a4c39c7aSBruce Evans ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDDESTDIR} ${LDADD} 122a4c39c7aSBruce Evans.endif 123afe61c15SRodney W. Grimes 124afe61c15SRodney W. Grimes.endif 125afe61c15SRodney W. Grimes 126afe61c15SRodney W. Grimes.if !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \ 127afe61c15SRodney W. Grimes !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \ 128afe61c15SRodney W. Grimes !defined(MAN7) && !defined(MAN8) && !defined(NOMAN) 1293585b293SGarrett WollmanMAN1= ${PROG}.1 130afe61c15SRodney W. Grimes.endif 131afe61c15SRodney W. Grimes.endif 132afe61c15SRodney W. Grimes 133cdaec7b1SBruce Evans# XXX I think MANDEPEND is only used for groff. It should be named more 134cdaec7b1SBruce Evans# generally and perhaps not be in the maninstall dependencies now it is 135cdaec7b1SBruce Evans# here (or does maninstall always work when nothing is made?), 136cdaec7b1SBruce Evans 137afe61c15SRodney W. Grimes.MAIN: all 138cd9a2f5cSJordan K. Hubbardall: ${PROG} all-man _SUBDIR 139afe61c15SRodney W. Grimes 140afe61c15SRodney W. Grimes.if !target(clean) 141cd9a2f5cSJordan K. Hubbardclean: _SUBDIR 1425c2da789SWolfram Schneider rm -f a.out Errs errs mklog ${PROG} ${OBJS} ${CLEANFILES} 143209396dfSPoul-Henning Kamp.if defined(CLEANDIRS) && !empty(CLEANDIRS) 1442b9cd238SPoul-Henning Kamp rm -rf ${CLEANDIRS} 1452b9cd238SPoul-Henning Kamp.endif 146afe61c15SRodney W. Grimes.endif 147afe61c15SRodney W. Grimes 148afe61c15SRodney W. Grimes.if !target(install) 149afe61c15SRodney W. Grimes.if !target(beforeinstall) 150afe61c15SRodney W. Grimesbeforeinstall: 151afe61c15SRodney W. Grimes.endif 152afe61c15SRodney W. Grimes 153cd9a2f5cSJordan K. Hubbardrealinstall: beforeinstall 154afe61c15SRodney W. Grimes.if defined(PROG) 1553585b293SGarrett Wollman ${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 15645f7f888SGarrett Wollman ${INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR} 157afe61c15SRodney W. Grimes.endif 158afe61c15SRodney W. Grimes.if defined(HIDEGAME) 159afe61c15SRodney W. Grimes (cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG}; \ 160afe61c15SRodney W. Grimes chown games.bin ${PROG}) 161afe61c15SRodney W. Grimes.endif 162afe61c15SRodney W. Grimes.if defined(LINKS) && !empty(LINKS) 163afe61c15SRodney W. Grimes @set ${LINKS}; \ 164afe61c15SRodney W. Grimes while test $$# -ge 2; do \ 165afe61c15SRodney W. Grimes l=${DESTDIR}$$1; \ 166afe61c15SRodney W. Grimes shift; \ 167afe61c15SRodney W. Grimes t=${DESTDIR}$$1; \ 168afe61c15SRodney W. Grimes shift; \ 169a4c39c7aSBruce Evans ${ECHO} $$t -\> $$l; \ 170afe61c15SRodney W. Grimes rm -f $$t; \ 17145f7d107SJordan K. Hubbard ln ${LN_FLAGS} $$l $$t; \ 172afe61c15SRodney W. Grimes done; true 173afe61c15SRodney W. Grimes.endif 174afe61c15SRodney W. Grimes 175cd9a2f5cSJordan K. Hubbardinstall: afterinstall _SUBDIR 1763585b293SGarrett Wollman.if !defined(NOMAN) 1773585b293SGarrett Wollmanafterinstall: realinstall maninstall 1783585b293SGarrett Wollman.else 179afe61c15SRodney W. Grimesafterinstall: realinstall 1803585b293SGarrett Wollman.endif 181afe61c15SRodney W. Grimes.endif 182afe61c15SRodney W. Grimes 183d9584d76SJordan K. HubbardDISTRIBUTION?= bin 18455ff8fb1SPoul-Henning Kamp.if !target(distribute) 185cd9a2f5cSJordan K. Hubbarddistribute: _SUBDIR 186ffd87c07SPoul-Henning Kamp cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${DISTRIBUTION} SHARED=copies 18755ff8fb1SPoul-Henning Kamp.endif 18855ff8fb1SPoul-Henning Kamp 189afe61c15SRodney W. Grimes.if !target(lint) 190cd9a2f5cSJordan K. Hubbardlint: ${SRCS} _SUBDIR 191afe61c15SRodney W. Grimes.if defined(PROG) 192afe61c15SRodney W. Grimes @${LINT} ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | more 2>&1 193afe61c15SRodney W. Grimes.endif 194afe61c15SRodney W. Grimes.endif 195afe61c15SRodney W. Grimes 196afe61c15SRodney W. Grimes.if !target(tags) 197cd9a2f5cSJordan K. Hubbardtags: ${SRCS} _SUBDIR 198afe61c15SRodney W. Grimes.if defined(PROG) 1993585b293SGarrett Wollman -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC} | \ 2003585b293SGarrett Wollman sed "s;\${.CURDIR}/;;" > tags 201afe61c15SRodney W. Grimes.endif 202afe61c15SRodney W. Grimes.endif 203afe61c15SRodney W. Grimes 204afe61c15SRodney W. Grimes.if !defined(NOMAN) 205afe61c15SRodney W. Grimes.include <bsd.man.mk> 2063585b293SGarrett Wollman.elif !target(maninstall) 207afe61c15SRodney W. Grimesmaninstall: 208973f098aSGarrett Wollmanall-man: 209afe61c15SRodney W. Grimes.endif 2103585b293SGarrett Wollman 2113585b293SGarrett Wollman.include <bsd.dep.mk> 212cd9a2f5cSJordan K. Hubbard.include <bsd.obj.mk> 213