13585b293SGarrett Wollman# from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 2870d9837SBruce Evans# $Id: bsd.prog.mk,v 1.44 1997/02/22 13:56:13 peter 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 203585b293SGarrett Wollman.if defined(NOSHARED) 213585b293SGarrett WollmanLDFLAGS+= -static 223585b293SGarrett Wollman.endif 23afe61c15SRodney W. Grimes 243585b293SGarrett Wollman.if defined(DESTDIR) 2543fae827SBruce EvansLDDESTDIR+= -L${DESTDIR}/usr/lib 26afe61c15SRodney W. Grimes.endif 27afe61c15SRodney W. Grimes 281a5ed802SBruce Evans.include <bsd.libnames.mk> 291a5ed802SBruce Evans 30afe61c15SRodney W. Grimes.if defined(PROG) 31afe61c15SRodney W. Grimes.if defined(SRCS) 32afe61c15SRodney W. Grimes 333585b293SGarrett WollmanDPSRCS+= ${SRCS:M*.h} 343585b293SGarrett WollmanOBJS+= ${SRCS:N*.h:R:S/$/.o/g} 35afe61c15SRodney W. Grimes 363585b293SGarrett Wollman.if defined(LDONLY) 37afe61c15SRodney W. Grimes 383585b293SGarrett Wollman${PROG}: ${LIBCRT0} ${LIBC} ${DPSRCS} ${OBJS} ${DPADD} 39a4c39c7aSBruce Evans ${LD} ${LDFLAGS} -o ${.TARGET} ${LIBCRT0} ${OBJS} ${LIBC} ${LDDESTDIR} \ 403585b293SGarrett Wollman ${LDADD} 413585b293SGarrett Wollman 423585b293SGarrett Wollman.else defined(LDONLY) 433585b293SGarrett Wollman 443585b293SGarrett Wollman${PROG}: ${DPSRCS} ${OBJS} ${LIBC} ${DPADD} 453585b293SGarrett Wollman ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDDESTDIR} ${LDADD} 463585b293SGarrett Wollman 473585b293SGarrett Wollman.endif 483585b293SGarrett Wollman 49fd2e43eaSBruce Evans.else !defined(SRCS) 50afe61c15SRodney W. Grimes 51afe61c15SRodney W. GrimesSRCS= ${PROG}.c 52afe61c15SRodney W. Grimes 53a4c39c7aSBruce Evans.if 0 543585b293SGarrett Wollman${PROG}: ${DPSRCS} ${SRCS} ${LIBC} ${DPADD} 553585b293SGarrett Wollman ${CC} ${LDFLAGS} ${CFLAGS} -o ${.TARGET} ${.CURDIR}/${SRCS} \ 563585b293SGarrett Wollman ${LDDESTDIR} ${LDADD} 5714c28f38SBruce Evans 5814c28f38SBruce EvansMKDEP= -p 59a4c39c7aSBruce Evans.else 60a4c39c7aSBruce Evans# Always make an intermediate object file because: 61a4c39c7aSBruce Evans# - it saves time rebuilding when only the library has changed 62a4c39c7aSBruce Evans# - the name of the object gets put into the executable symbol table instead of 63a4c39c7aSBruce Evans# the name of a variable temporary object. 64a4c39c7aSBruce Evans# - it's useful to keep objects around for crunching. 65a4c39c7aSBruce EvansOBJS= ${PROG}.o 66a4c39c7aSBruce Evans${PROG}: ${DPSRCS} ${OBJS} ${LIBC} ${DPADD} 67a4c39c7aSBruce Evans ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDDESTDIR} ${LDADD} 68a4c39c7aSBruce Evans.endif 69afe61c15SRodney W. Grimes 70afe61c15SRodney W. Grimes.endif 71afe61c15SRodney W. Grimes 72afe61c15SRodney W. Grimes.if !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \ 73afe61c15SRodney W. Grimes !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \ 74afe61c15SRodney W. Grimes !defined(MAN7) && !defined(MAN8) && !defined(NOMAN) 753585b293SGarrett WollmanMAN1= ${PROG}.1 76afe61c15SRodney W. Grimes.endif 77afe61c15SRodney W. Grimes.endif 78afe61c15SRodney W. Grimes 79cdaec7b1SBruce Evans# XXX I think MANDEPEND is only used for groff. It should be named more 80cdaec7b1SBruce Evans# generally and perhaps not be in the maninstall dependencies now it is 81cdaec7b1SBruce Evans# here (or does maninstall always work when nothing is made?), 82cdaec7b1SBruce Evans 83afe61c15SRodney W. Grimes.MAIN: all 84b3618bcfSSteven Wallaceall: objwarn ${PROG} all-man _SUBDIR 85afe61c15SRodney W. Grimes 86afe61c15SRodney W. Grimes.if !target(clean) 87cd9a2f5cSJordan K. Hubbardclean: _SUBDIR 885c2da789SWolfram Schneider rm -f a.out Errs errs mklog ${PROG} ${OBJS} ${CLEANFILES} 89209396dfSPoul-Henning Kamp.if defined(CLEANDIRS) && !empty(CLEANDIRS) 902b9cd238SPoul-Henning Kamp rm -rf ${CLEANDIRS} 912b9cd238SPoul-Henning Kamp.endif 92afe61c15SRodney W. Grimes.endif 93afe61c15SRodney W. Grimes 94afe61c15SRodney W. Grimes.if !target(install) 95afe61c15SRodney W. Grimes.if !target(beforeinstall) 96afe61c15SRodney W. Grimesbeforeinstall: 97afe61c15SRodney W. Grimes.endif 98afe61c15SRodney W. Grimes 99cd9a2f5cSJordan K. Hubbardrealinstall: beforeinstall 100afe61c15SRodney W. Grimes.if defined(PROG) 1013585b293SGarrett Wollman ${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 10245f7f888SGarrett Wollman ${INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR} 103afe61c15SRodney W. Grimes.endif 104afe61c15SRodney W. Grimes.if defined(HIDEGAME) 105afe61c15SRodney W. Grimes (cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG}; \ 106870d9837SBruce Evans chown games:bin ${PROG}) 107afe61c15SRodney W. Grimes.endif 108afe61c15SRodney W. Grimes.if defined(LINKS) && !empty(LINKS) 109afe61c15SRodney W. Grimes @set ${LINKS}; \ 110afe61c15SRodney W. Grimes while test $$# -ge 2; do \ 111afe61c15SRodney W. Grimes l=${DESTDIR}$$1; \ 112afe61c15SRodney W. Grimes shift; \ 113afe61c15SRodney W. Grimes t=${DESTDIR}$$1; \ 114afe61c15SRodney W. Grimes shift; \ 115a4c39c7aSBruce Evans ${ECHO} $$t -\> $$l; \ 116afe61c15SRodney W. Grimes rm -f $$t; \ 11745f7d107SJordan K. Hubbard ln ${LN_FLAGS} $$l $$t; \ 118afe61c15SRodney W. Grimes done; true 119afe61c15SRodney W. Grimes.endif 120afe61c15SRodney W. Grimes 121cd9a2f5cSJordan K. Hubbardinstall: afterinstall _SUBDIR 1223585b293SGarrett Wollman.if !defined(NOMAN) 1233585b293SGarrett Wollmanafterinstall: realinstall maninstall 1243585b293SGarrett Wollman.else 125afe61c15SRodney W. Grimesafterinstall: realinstall 1263585b293SGarrett Wollman.endif 127afe61c15SRodney W. Grimes.endif 128afe61c15SRodney W. Grimes 129d9584d76SJordan K. HubbardDISTRIBUTION?= bin 13055ff8fb1SPoul-Henning Kamp.if !target(distribute) 131cd9a2f5cSJordan K. Hubbarddistribute: _SUBDIR 132ffd87c07SPoul-Henning Kamp cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${DISTRIBUTION} SHARED=copies 13355ff8fb1SPoul-Henning Kamp.endif 13455ff8fb1SPoul-Henning Kamp 135afe61c15SRodney W. Grimes.if !target(lint) 136cd9a2f5cSJordan K. Hubbardlint: ${SRCS} _SUBDIR 137afe61c15SRodney W. Grimes.if defined(PROG) 138afe61c15SRodney W. Grimes @${LINT} ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | more 2>&1 139afe61c15SRodney W. Grimes.endif 140afe61c15SRodney W. Grimes.endif 141afe61c15SRodney W. Grimes 142afe61c15SRodney W. Grimes.if !target(tags) 143cd9a2f5cSJordan K. Hubbardtags: ${SRCS} _SUBDIR 144afe61c15SRodney W. Grimes.if defined(PROG) 1453585b293SGarrett Wollman -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC} | \ 1463585b293SGarrett Wollman sed "s;\${.CURDIR}/;;" > tags 147afe61c15SRodney W. Grimes.endif 148afe61c15SRodney W. Grimes.endif 149afe61c15SRodney W. Grimes 150afe61c15SRodney W. Grimes.if !defined(NOMAN) 151afe61c15SRodney W. Grimes.include <bsd.man.mk> 1523585b293SGarrett Wollman.elif !target(maninstall) 153afe61c15SRodney W. Grimesmaninstall: 154973f098aSGarrett Wollmanall-man: 155afe61c15SRodney W. Grimes.endif 1563585b293SGarrett Wollman 1573585b293SGarrett Wollman.include <bsd.dep.mk> 158cd9a2f5cSJordan K. Hubbard.include <bsd.obj.mk> 159