13585b293SGarrett Wollman# from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 22799473bSSatoshi Asami# $Id: bsd.prog.mk,v 1.53 1997/07/31 06:12:04 asami 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 1315db27b8SSatoshi AsamiCXXINCLUDES+= -I${DESTDIR}/usr/include/g++ 143585b293SGarrett Wollman.endif 15afe61c15SRodney W. Grimes 16e82b0b99SJordan K. Hubbard.if !defined(DEBUG_FLAGS) 17afe61c15SRodney W. GrimesSTRIP?= -s 18e82b0b99SJordan K. Hubbard.endif 19afe61c15SRodney W. Grimes 203d8cd70cSPaul Traina.if defined(NOSHARED) && ( ${NOSHARED} != "no" && ${NOSHARED} != "NO" ) 213585b293SGarrett WollmanLDFLAGS+= -static 223585b293SGarrett Wollman.endif 23afe61c15SRodney W. Grimes 24afe61c15SRodney W. Grimes.if defined(PROG) 25afe61c15SRodney W. Grimes.if defined(SRCS) 26afe61c15SRodney W. Grimes 273585b293SGarrett WollmanDPSRCS+= ${SRCS:M*.h} 283585b293SGarrett WollmanOBJS+= ${SRCS:N*.h:R:S/$/.o/g} 29afe61c15SRodney W. Grimes 30663e9677SBruce Evans${PROG}: ${DPSRCS} ${OBJS} 313585b293SGarrett Wollman ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDDESTDIR} ${LDADD} 323585b293SGarrett Wollman 33fd2e43eaSBruce Evans.else !defined(SRCS) 34afe61c15SRodney W. Grimes 35afe61c15SRodney W. GrimesSRCS= ${PROG}.c 36afe61c15SRodney W. Grimes 37a4c39c7aSBruce Evans# Always make an intermediate object file because: 38a4c39c7aSBruce Evans# - it saves time rebuilding when only the library has changed 39a4c39c7aSBruce Evans# - the name of the object gets put into the executable symbol table instead of 40a4c39c7aSBruce Evans# the name of a variable temporary object. 41a4c39c7aSBruce Evans# - it's useful to keep objects around for crunching. 42a4c39c7aSBruce EvansOBJS= ${PROG}.o 43663e9677SBruce Evans${PROG}: ${DPSRCS} ${OBJS} 44a4c39c7aSBruce Evans ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDDESTDIR} ${LDADD} 45afe61c15SRodney W. Grimes 46afe61c15SRodney W. Grimes.endif 47afe61c15SRodney W. Grimes 48afe61c15SRodney W. Grimes.if !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \ 49afe61c15SRodney W. Grimes !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \ 50afe61c15SRodney W. Grimes !defined(MAN7) && !defined(MAN8) && !defined(NOMAN) 513585b293SGarrett WollmanMAN1= ${PROG}.1 52afe61c15SRodney W. Grimes.endif 53afe61c15SRodney W. Grimes.endif 54afe61c15SRodney W. Grimes 55afe61c15SRodney W. Grimes.MAIN: all 56b3618bcfSSteven Wallaceall: objwarn ${PROG} all-man _SUBDIR 57afe61c15SRodney W. Grimes 58afe61c15SRodney W. Grimes.if !target(clean) 59cd9a2f5cSJordan K. Hubbardclean: _SUBDIR 605c2da789SWolfram Schneider rm -f a.out Errs errs mklog ${PROG} ${OBJS} ${CLEANFILES} 61209396dfSPoul-Henning Kamp.if defined(CLEANDIRS) && !empty(CLEANDIRS) 622b9cd238SPoul-Henning Kamp rm -rf ${CLEANDIRS} 632b9cd238SPoul-Henning Kamp.endif 64afe61c15SRodney W. Grimes.endif 65afe61c15SRodney W. Grimes 662799473bSSatoshi Asami.if defined(PROG) && !defined(NOEXTRADEPEND) 67663e9677SBruce Evans_EXTRADEPEND: 68663e9677SBruce Evans echo ${PROG}: `${CC} -Wl,-f ${CFLAGS} ${LDFLAGS} ${LDDESTDIR} \ 691c735bb4SBruce Evans ${LDADD:S/^/-Wl,/}` >> ${DEPENDFILE} 70663e9677SBruce Evans.endif 71663e9677SBruce Evans 72afe61c15SRodney W. Grimes.if !target(install) 73afe61c15SRodney W. Grimes.if !target(beforeinstall) 74afe61c15SRodney W. Grimesbeforeinstall: 75afe61c15SRodney W. Grimes.endif 76afe61c15SRodney W. Grimes 77cd9a2f5cSJordan K. Hubbardrealinstall: beforeinstall 78afe61c15SRodney W. Grimes.if defined(PROG) 793585b293SGarrett Wollman ${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 8045f7f888SGarrett Wollman ${INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR} 81afe61c15SRodney W. Grimes.endif 82afe61c15SRodney W. Grimes.if defined(HIDEGAME) 83afe61c15SRodney W. Grimes (cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG}; \ 84870d9837SBruce Evans chown games:bin ${PROG}) 85afe61c15SRodney W. Grimes.endif 86afe61c15SRodney W. Grimes.if defined(LINKS) && !empty(LINKS) 87afe61c15SRodney W. Grimes @set ${LINKS}; \ 88afe61c15SRodney W. Grimes while test $$# -ge 2; do \ 89afe61c15SRodney W. Grimes l=${DESTDIR}$$1; \ 90afe61c15SRodney W. Grimes shift; \ 91afe61c15SRodney W. Grimes t=${DESTDIR}$$1; \ 92afe61c15SRodney W. Grimes shift; \ 93a4c39c7aSBruce Evans ${ECHO} $$t -\> $$l; \ 94afe61c15SRodney W. Grimes rm -f $$t; \ 9545f7d107SJordan K. Hubbard ln ${LN_FLAGS} $$l $$t; \ 96afe61c15SRodney W. Grimes done; true 97afe61c15SRodney W. Grimes.endif 98afe61c15SRodney W. Grimes 99cd9a2f5cSJordan K. Hubbardinstall: afterinstall _SUBDIR 1003585b293SGarrett Wollman.if !defined(NOMAN) 1013585b293SGarrett Wollmanafterinstall: realinstall maninstall 1023585b293SGarrett Wollman.else 103afe61c15SRodney W. Grimesafterinstall: realinstall 1043585b293SGarrett Wollman.endif 105afe61c15SRodney W. Grimes.endif 106afe61c15SRodney W. Grimes 107d9584d76SJordan K. HubbardDISTRIBUTION?= bin 10855ff8fb1SPoul-Henning Kamp.if !target(distribute) 109cd9a2f5cSJordan K. Hubbarddistribute: _SUBDIR 110398ac038SJordan K. Hubbard.for dist in ${DISTRIBUTION} 111398ac038SJordan K. Hubbard cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${dist} SHARED=copies 112398ac038SJordan K. Hubbard.endfor 11355ff8fb1SPoul-Henning Kamp.endif 11455ff8fb1SPoul-Henning Kamp 115afe61c15SRodney W. Grimes.if !target(lint) 116cd9a2f5cSJordan K. Hubbardlint: ${SRCS} _SUBDIR 117afe61c15SRodney W. Grimes.if defined(PROG) 118afe61c15SRodney W. Grimes @${LINT} ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | more 2>&1 119afe61c15SRodney W. Grimes.endif 120afe61c15SRodney W. Grimes.endif 121afe61c15SRodney W. Grimes 1226eb5e456SJordan K. Hubbard.if defined(NOTAGS) 1236eb5e456SJordan K. Hubbardtags: 1246eb5e456SJordan K. Hubbard.endif 1256eb5e456SJordan K. Hubbard 126afe61c15SRodney W. Grimes.if !target(tags) 127cd9a2f5cSJordan K. Hubbardtags: ${SRCS} _SUBDIR 128afe61c15SRodney W. Grimes.if defined(PROG) 1296eb5e456SJordan K. Hubbard @cd ${.CURDIR} && gtags ${GTAGSFLAGS} 1306eb5e456SJordan K. Hubbard.if defined(HTML) 1316eb5e456SJordan K. Hubbard @cd ${.CURDIR} && htags ${HTAGSFLAGS} 1326eb5e456SJordan K. Hubbard.endif 133afe61c15SRodney W. Grimes.endif 134afe61c15SRodney W. Grimes.endif 135afe61c15SRodney W. Grimes 136afe61c15SRodney W. Grimes.if !defined(NOMAN) 137afe61c15SRodney W. Grimes.include <bsd.man.mk> 1383585b293SGarrett Wollman.elif !target(maninstall) 139afe61c15SRodney W. Grimesmaninstall: 140973f098aSGarrett Wollmanall-man: 141afe61c15SRodney W. Grimes.endif 1423585b293SGarrett Wollman 1433585b293SGarrett Wollman.include <bsd.dep.mk> 144cd9a2f5cSJordan K. Hubbard.include <bsd.obj.mk> 145