13585b293SGarrett Wollman# from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 24e9229baSBruce Evans# $Id: bsd.prog.mk,v 1.56 1997/09/05 09:09:56 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 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 38afe61c15SRodney W. GrimesSRCS= ${PROG}.c 39afe61c15SRodney W. Grimes 40a4c39c7aSBruce Evans# Always make an intermediate object file because: 41a4c39c7aSBruce Evans# - it saves time rebuilding when only the library has changed 42a4c39c7aSBruce Evans# - the name of the object gets put into the executable symbol table instead of 43a4c39c7aSBruce Evans# the name of a variable temporary object. 44a4c39c7aSBruce Evans# - it's useful to keep objects around for crunching. 45a4c39c7aSBruce EvansOBJS= ${PROG}.o 46663e9677SBruce Evans${PROG}: ${DPSRCS} ${OBJS} 47a4c39c7aSBruce Evans ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDDESTDIR} ${LDADD} 48afe61c15SRodney W. Grimes 49afe61c15SRodney W. Grimes.endif 50afe61c15SRodney W. Grimes 51afe61c15SRodney W. Grimes.if !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \ 52afe61c15SRodney W. Grimes !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \ 53afe61c15SRodney W. Grimes !defined(MAN7) && !defined(MAN8) && !defined(NOMAN) 543585b293SGarrett WollmanMAN1= ${PROG}.1 55afe61c15SRodney W. Grimes.endif 56afe61c15SRodney W. Grimes.endif 57afe61c15SRodney W. Grimes 58afe61c15SRodney W. Grimes.MAIN: all 59b3618bcfSSteven Wallaceall: objwarn ${PROG} all-man _SUBDIR 60afe61c15SRodney W. Grimes 61afe61c15SRodney W. Grimes.if !target(clean) 62cd9a2f5cSJordan K. Hubbardclean: _SUBDIR 634e9229baSBruce Evans rm -f ${PROG} ${OBJS} ${CLEANFILES} 64209396dfSPoul-Henning Kamp.if defined(CLEANDIRS) && !empty(CLEANDIRS) 652b9cd238SPoul-Henning Kamp rm -rf ${CLEANDIRS} 662b9cd238SPoul-Henning Kamp.endif 67afe61c15SRodney W. Grimes.endif 68afe61c15SRodney W. Grimes 692799473bSSatoshi Asami.if defined(PROG) && !defined(NOEXTRADEPEND) 70663e9677SBruce Evans_EXTRADEPEND: 718c05a446SPeter Wemm.if ${BINFORMAT} == aout 72663e9677SBruce Evans echo ${PROG}: `${CC} -Wl,-f ${CFLAGS} ${LDFLAGS} ${LDDESTDIR} \ 731c735bb4SBruce Evans ${LDADD:S/^/-Wl,/}` >> ${DEPENDFILE} 748c05a446SPeter Wemm.else 754e9229baSBruce Evans.if defined(DPADD) && !empty(DPADD) 768c05a446SPeter Wemm echo ${PROG}: ${DPADD} >> ${DEPENDFILE} 778c05a446SPeter Wemm.endif 788c05a446SPeter Wemm.endif 79663e9677SBruce Evans.endif 80663e9677SBruce Evans 81afe61c15SRodney W. Grimes.if !target(install) 82afe61c15SRodney W. Grimes.if !target(beforeinstall) 83afe61c15SRodney W. Grimesbeforeinstall: 84afe61c15SRodney W. Grimes.endif 85afe61c15SRodney W. Grimes 86cd9a2f5cSJordan K. Hubbardrealinstall: beforeinstall 87afe61c15SRodney W. Grimes.if defined(PROG) 883585b293SGarrett Wollman ${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 8945f7f888SGarrett Wollman ${INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR} 90afe61c15SRodney W. Grimes.endif 91afe61c15SRodney W. Grimes.if defined(HIDEGAME) 92afe61c15SRodney W. Grimes (cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG}; \ 93870d9837SBruce Evans chown games:bin ${PROG}) 94afe61c15SRodney W. Grimes.endif 95afe61c15SRodney W. Grimes.if defined(LINKS) && !empty(LINKS) 96afe61c15SRodney W. Grimes @set ${LINKS}; \ 97afe61c15SRodney W. Grimes while test $$# -ge 2; do \ 98afe61c15SRodney W. Grimes l=${DESTDIR}$$1; \ 99afe61c15SRodney W. Grimes shift; \ 100afe61c15SRodney W. Grimes t=${DESTDIR}$$1; \ 101afe61c15SRodney W. Grimes shift; \ 102a4c39c7aSBruce Evans ${ECHO} $$t -\> $$l; \ 103afe61c15SRodney W. Grimes rm -f $$t; \ 10445f7d107SJordan K. Hubbard ln ${LN_FLAGS} $$l $$t; \ 105afe61c15SRodney W. Grimes done; true 106afe61c15SRodney W. Grimes.endif 107afe61c15SRodney W. Grimes 108cd9a2f5cSJordan K. Hubbardinstall: afterinstall _SUBDIR 1093585b293SGarrett Wollman.if !defined(NOMAN) 1103585b293SGarrett Wollmanafterinstall: realinstall maninstall 1113585b293SGarrett Wollman.else 112afe61c15SRodney W. Grimesafterinstall: realinstall 1133585b293SGarrett Wollman.endif 114afe61c15SRodney W. Grimes.endif 115afe61c15SRodney W. Grimes 116d9584d76SJordan K. HubbardDISTRIBUTION?= bin 11755ff8fb1SPoul-Henning Kamp.if !target(distribute) 118cd9a2f5cSJordan K. Hubbarddistribute: _SUBDIR 119398ac038SJordan K. Hubbard.for dist in ${DISTRIBUTION} 120398ac038SJordan K. Hubbard cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${dist} SHARED=copies 121398ac038SJordan K. Hubbard.endfor 12255ff8fb1SPoul-Henning Kamp.endif 12355ff8fb1SPoul-Henning Kamp 124afe61c15SRodney W. Grimes.if !target(lint) 125cd9a2f5cSJordan K. Hubbardlint: ${SRCS} _SUBDIR 126afe61c15SRodney W. Grimes.if defined(PROG) 127afe61c15SRodney W. Grimes @${LINT} ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | more 2>&1 128afe61c15SRodney W. Grimes.endif 129afe61c15SRodney W. Grimes.endif 130afe61c15SRodney W. Grimes 1316eb5e456SJordan K. Hubbard.if defined(NOTAGS) 1326eb5e456SJordan K. Hubbardtags: 1336eb5e456SJordan K. Hubbard.endif 1346eb5e456SJordan K. Hubbard 135afe61c15SRodney W. Grimes.if !target(tags) 136cd9a2f5cSJordan K. Hubbardtags: ${SRCS} _SUBDIR 137afe61c15SRodney W. Grimes.if defined(PROG) 1386eb5e456SJordan K. Hubbard @cd ${.CURDIR} && gtags ${GTAGSFLAGS} 1396eb5e456SJordan K. Hubbard.if defined(HTML) 1406eb5e456SJordan K. Hubbard @cd ${.CURDIR} && htags ${HTAGSFLAGS} 1416eb5e456SJordan K. Hubbard.endif 142afe61c15SRodney W. Grimes.endif 143afe61c15SRodney W. Grimes.endif 144afe61c15SRodney W. Grimes 145afe61c15SRodney W. Grimes.if !defined(NOMAN) 146afe61c15SRodney W. Grimes.include <bsd.man.mk> 1473585b293SGarrett Wollman.elif !target(maninstall) 148afe61c15SRodney W. Grimesmaninstall: 149973f098aSGarrett Wollmanall-man: 150afe61c15SRodney W. Grimes.endif 1513585b293SGarrett Wollman 1524e9229baSBruce Evans.if ${BINFORMAT} != aout || make(checkdpadd) 1538c05a446SPeter Wemm.include <bsd.libnames.mk> 1548c05a446SPeter Wemm.endif 1558c05a446SPeter Wemm 1563585b293SGarrett Wollman.include <bsd.dep.mk> 157cd9a2f5cSJordan K. Hubbard.include <bsd.obj.mk> 158