13585b293SGarrett Wollman# from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 289d11b8aSBruce Evans# $Id: bsd.prog.mk,v 1.62 1998/02/19 14:53:29 eivind 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 83ec75cc6SPeter Wemm# Default executable format 93ec75cc6SPeter WemmBINFORMAT?= aout 103ec75cc6SPeter Wemm 113585b293SGarrett Wollman.SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S 12afe61c15SRodney W. Grimes 13e82b0b99SJordan K. HubbardCFLAGS+=${COPTS} ${DEBUG_FLAGS} 143585b293SGarrett Wollman.if defined(DESTDIR) 153585b293SGarrett WollmanCFLAGS+= -I${DESTDIR}/usr/include 1615db27b8SSatoshi AsamiCXXINCLUDES+= -I${DESTDIR}/usr/include/g++ 173585b293SGarrett Wollman.endif 18afe61c15SRodney W. Grimes 19e82b0b99SJordan K. Hubbard.if !defined(DEBUG_FLAGS) 20afe61c15SRodney W. GrimesSTRIP?= -s 21e82b0b99SJordan K. Hubbard.endif 22afe61c15SRodney W. Grimes 233d8cd70cSPaul Traina.if defined(NOSHARED) && ( ${NOSHARED} != "no" && ${NOSHARED} != "NO" ) 243585b293SGarrett WollmanLDFLAGS+= -static 253585b293SGarrett Wollman.endif 26afe61c15SRodney W. Grimes 27afe61c15SRodney W. Grimes.if defined(PROG) 28afe61c15SRodney W. Grimes.if defined(SRCS) 29afe61c15SRodney W. Grimes 303585b293SGarrett WollmanDPSRCS+= ${SRCS:M*.h} 313585b293SGarrett WollmanOBJS+= ${SRCS:N*.h:R:S/$/.o/g} 32afe61c15SRodney W. Grimes 33663e9677SBruce Evans${PROG}: ${DPSRCS} ${OBJS} 343585b293SGarrett Wollman ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDDESTDIR} ${LDADD} 353585b293SGarrett Wollman 36fd2e43eaSBruce Evans.else !defined(SRCS) 37afe61c15SRodney W. Grimes 38f5c75051SEivind Eklund.if !target(${PROG}) 39afe61c15SRodney W. GrimesSRCS= ${PROG}.c 40afe61c15SRodney W. Grimes 41a4c39c7aSBruce Evans# Always make an intermediate object file because: 42a4c39c7aSBruce Evans# - it saves time rebuilding when only the library has changed 43a4c39c7aSBruce Evans# - the name of the object gets put into the executable symbol table instead of 44a4c39c7aSBruce Evans# the name of a variable temporary object. 45a4c39c7aSBruce Evans# - it's useful to keep objects around for crunching. 46a4c39c7aSBruce EvansOBJS= ${PROG}.o 47f5c75051SEivind Eklund 48663e9677SBruce Evans${PROG}: ${DPSRCS} ${OBJS} 49a4c39c7aSBruce Evans ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDDESTDIR} ${LDADD} 50afe61c15SRodney W. Grimes.endif 51f5c75051SEivind Eklund 526fe6af9fSEivind Eklund.endif 53afe61c15SRodney W. Grimes 54afe61c15SRodney W. Grimes.if !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \ 55afe61c15SRodney W. Grimes !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \ 56afe61c15SRodney W. Grimes !defined(MAN7) && !defined(MAN8) && !defined(NOMAN) 573585b293SGarrett WollmanMAN1= ${PROG}.1 58afe61c15SRodney W. Grimes.endif 59afe61c15SRodney W. Grimes.endif 60afe61c15SRodney W. Grimes 61afe61c15SRodney W. Grimes.MAIN: all 62b3618bcfSSteven Wallaceall: objwarn ${PROG} all-man _SUBDIR 63afe61c15SRodney W. Grimes 6489d11b8aSBruce EvansCLEANFILES+= ${PROG} ${OBJS} 65afe61c15SRodney W. Grimes 662799473bSSatoshi Asami.if defined(PROG) && !defined(NOEXTRADEPEND) 67663e9677SBruce Evans_EXTRADEPEND: 688c05a446SPeter Wemm.if ${BINFORMAT} == aout 69663e9677SBruce Evans echo ${PROG}: `${CC} -Wl,-f ${CFLAGS} ${LDFLAGS} ${LDDESTDIR} \ 701c735bb4SBruce Evans ${LDADD:S/^/-Wl,/}` >> ${DEPENDFILE} 718c05a446SPeter Wemm.else 724e9229baSBruce Evans.if defined(DPADD) && !empty(DPADD) 738c05a446SPeter Wemm echo ${PROG}: ${DPADD} >> ${DEPENDFILE} 748c05a446SPeter Wemm.endif 758c05a446SPeter Wemm.endif 76663e9677SBruce Evans.endif 77663e9677SBruce Evans 78afe61c15SRodney W. Grimes.if !target(install) 79afe61c15SRodney W. Grimes.if !target(beforeinstall) 80afe61c15SRodney W. Grimesbeforeinstall: 81afe61c15SRodney W. Grimes.endif 82afe61c15SRodney W. Grimes 83cd9a2f5cSJordan K. Hubbardrealinstall: beforeinstall 84afe61c15SRodney W. Grimes.if defined(PROG) 853585b293SGarrett Wollman ${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 8645f7f888SGarrett Wollman ${INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR} 87afe61c15SRodney W. Grimes.endif 88afe61c15SRodney W. Grimes.if defined(HIDEGAME) 89afe61c15SRodney W. Grimes (cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG}; \ 90870d9837SBruce Evans chown games:bin ${PROG}) 91afe61c15SRodney W. Grimes.endif 92afe61c15SRodney W. Grimes.if defined(LINKS) && !empty(LINKS) 93afe61c15SRodney W. Grimes @set ${LINKS}; \ 94afe61c15SRodney W. Grimes while test $$# -ge 2; do \ 95afe61c15SRodney W. Grimes l=${DESTDIR}$$1; \ 96afe61c15SRodney W. Grimes shift; \ 97afe61c15SRodney W. Grimes t=${DESTDIR}$$1; \ 98afe61c15SRodney W. Grimes shift; \ 99a4c39c7aSBruce Evans ${ECHO} $$t -\> $$l; \ 100afe61c15SRodney W. Grimes rm -f $$t; \ 10145f7d107SJordan K. Hubbard ln ${LN_FLAGS} $$l $$t; \ 102afe61c15SRodney W. Grimes done; true 103afe61c15SRodney W. Grimes.endif 104afe61c15SRodney W. Grimes 105cd9a2f5cSJordan K. Hubbardinstall: afterinstall _SUBDIR 1063585b293SGarrett Wollman.if !defined(NOMAN) 1073585b293SGarrett Wollmanafterinstall: realinstall maninstall 1083585b293SGarrett Wollman.else 109afe61c15SRodney W. Grimesafterinstall: realinstall 1103585b293SGarrett Wollman.endif 111afe61c15SRodney W. Grimes.endif 112afe61c15SRodney W. Grimes 113d9584d76SJordan K. HubbardDISTRIBUTION?= bin 11455ff8fb1SPoul-Henning Kamp.if !target(distribute) 115cd9a2f5cSJordan K. Hubbarddistribute: _SUBDIR 116398ac038SJordan K. Hubbard.for dist in ${DISTRIBUTION} 117398ac038SJordan K. Hubbard cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${dist} SHARED=copies 118398ac038SJordan K. Hubbard.endfor 11955ff8fb1SPoul-Henning Kamp.endif 12055ff8fb1SPoul-Henning Kamp 121afe61c15SRodney W. Grimes.if !target(lint) 122cd9a2f5cSJordan K. Hubbardlint: ${SRCS} _SUBDIR 123afe61c15SRodney W. Grimes.if defined(PROG) 124afe61c15SRodney W. Grimes @${LINT} ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | more 2>&1 125afe61c15SRodney W. Grimes.endif 126afe61c15SRodney W. Grimes.endif 127afe61c15SRodney W. Grimes 1286eb5e456SJordan K. Hubbard.if defined(NOTAGS) 1296eb5e456SJordan K. Hubbardtags: 1306eb5e456SJordan K. Hubbard.endif 1316eb5e456SJordan K. Hubbard 132afe61c15SRodney W. Grimes.if !target(tags) 133cd9a2f5cSJordan K. Hubbardtags: ${SRCS} _SUBDIR 134afe61c15SRodney W. Grimes.if defined(PROG) 1356eb5e456SJordan K. Hubbard @cd ${.CURDIR} && gtags ${GTAGSFLAGS} 1366eb5e456SJordan K. Hubbard.if defined(HTML) 1376eb5e456SJordan K. Hubbard @cd ${.CURDIR} && htags ${HTAGSFLAGS} 1386eb5e456SJordan K. Hubbard.endif 139afe61c15SRodney W. Grimes.endif 140afe61c15SRodney W. Grimes.endif 141afe61c15SRodney W. Grimes 142afe61c15SRodney W. Grimes.if !defined(NOMAN) 143afe61c15SRodney W. Grimes.include <bsd.man.mk> 1443585b293SGarrett Wollman.elif !target(maninstall) 145afe61c15SRodney W. Grimesmaninstall: 146973f098aSGarrett Wollmanall-man: 147afe61c15SRodney W. Grimes.endif 1483585b293SGarrett Wollman 1494e9229baSBruce Evans.if ${BINFORMAT} != aout || make(checkdpadd) 1508c05a446SPeter Wemm.include <bsd.libnames.mk> 1518c05a446SPeter Wemm.endif 1528c05a446SPeter Wemm 1533585b293SGarrett Wollman.include <bsd.dep.mk> 154cd9a2f5cSJordan K. Hubbard.include <bsd.obj.mk> 155