13585b293SGarrett Wollman# from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 23d8cd70cSPaul Traina# $Id: bsd.prog.mk,v 1.51 1997/06/21 15:40:33 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 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 243585b293SGarrett Wollman.if defined(DESTDIR) 25663e9677SBruce EvansLDDESTDIR?= -L${DESTDIR}${SHLIBDIR} -L${DESTDIR}/usr/lib 26663e9677SBruce Evans# LDDESTDIR+= -nostdlib 27afe61c15SRodney W. Grimes.endif 28afe61c15SRodney W. Grimes 29afe61c15SRodney W. Grimes.if defined(PROG) 30afe61c15SRodney W. Grimes.if defined(SRCS) 31afe61c15SRodney W. Grimes 323585b293SGarrett WollmanDPSRCS+= ${SRCS:M*.h} 333585b293SGarrett WollmanOBJS+= ${SRCS:N*.h:R:S/$/.o/g} 34afe61c15SRodney W. Grimes 35663e9677SBruce Evans${PROG}: ${DPSRCS} ${OBJS} 363585b293SGarrett Wollman ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDDESTDIR} ${LDADD} 373585b293SGarrett Wollman 38fd2e43eaSBruce Evans.else !defined(SRCS) 39afe61c15SRodney W. Grimes 40afe61c15SRodney W. GrimesSRCS= ${PROG}.c 41afe61c15SRodney W. Grimes 42a4c39c7aSBruce Evans# Always make an intermediate object file because: 43a4c39c7aSBruce Evans# - it saves time rebuilding when only the library has changed 44a4c39c7aSBruce Evans# - the name of the object gets put into the executable symbol table instead of 45a4c39c7aSBruce Evans# the name of a variable temporary object. 46a4c39c7aSBruce Evans# - it's useful to keep objects around for crunching. 47a4c39c7aSBruce EvansOBJS= ${PROG}.o 48663e9677SBruce Evans${PROG}: ${DPSRCS} ${OBJS} 49a4c39c7aSBruce Evans ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDDESTDIR} ${LDADD} 50afe61c15SRodney W. Grimes 51afe61c15SRodney W. Grimes.endif 52afe61c15SRodney W. Grimes 53afe61c15SRodney W. Grimes.if !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \ 54afe61c15SRodney W. Grimes !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \ 55afe61c15SRodney W. Grimes !defined(MAN7) && !defined(MAN8) && !defined(NOMAN) 563585b293SGarrett WollmanMAN1= ${PROG}.1 57afe61c15SRodney W. Grimes.endif 58afe61c15SRodney W. Grimes.endif 59afe61c15SRodney W. Grimes 60afe61c15SRodney W. Grimes.MAIN: all 61b3618bcfSSteven Wallaceall: objwarn ${PROG} all-man _SUBDIR 62afe61c15SRodney W. Grimes 63afe61c15SRodney W. Grimes.if !target(clean) 64cd9a2f5cSJordan K. Hubbardclean: _SUBDIR 655c2da789SWolfram Schneider rm -f a.out Errs errs mklog ${PROG} ${OBJS} ${CLEANFILES} 66209396dfSPoul-Henning Kamp.if defined(CLEANDIRS) && !empty(CLEANDIRS) 672b9cd238SPoul-Henning Kamp rm -rf ${CLEANDIRS} 682b9cd238SPoul-Henning Kamp.endif 69afe61c15SRodney W. Grimes.endif 70afe61c15SRodney W. Grimes 71663e9677SBruce Evans.if defined(PROG) 72663e9677SBruce Evans_EXTRADEPEND: 73663e9677SBruce Evans echo ${PROG}: `${CC} -Wl,-f ${CFLAGS} ${LDFLAGS} ${LDDESTDIR} \ 741c735bb4SBruce Evans ${LDADD:S/^/-Wl,/}` >> ${DEPENDFILE} 75663e9677SBruce Evans.endif 76663e9677SBruce Evans 77afe61c15SRodney W. Grimes.if !target(install) 78afe61c15SRodney W. Grimes.if !target(beforeinstall) 79afe61c15SRodney W. Grimesbeforeinstall: 80afe61c15SRodney W. Grimes.endif 81afe61c15SRodney W. Grimes 82cd9a2f5cSJordan K. Hubbardrealinstall: beforeinstall 83afe61c15SRodney W. Grimes.if defined(PROG) 843585b293SGarrett Wollman ${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 8545f7f888SGarrett Wollman ${INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR} 86afe61c15SRodney W. Grimes.endif 87afe61c15SRodney W. Grimes.if defined(HIDEGAME) 88afe61c15SRodney W. Grimes (cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG}; \ 89870d9837SBruce Evans chown games:bin ${PROG}) 90afe61c15SRodney W. Grimes.endif 91afe61c15SRodney W. Grimes.if defined(LINKS) && !empty(LINKS) 92afe61c15SRodney W. Grimes @set ${LINKS}; \ 93afe61c15SRodney W. Grimes while test $$# -ge 2; do \ 94afe61c15SRodney W. Grimes l=${DESTDIR}$$1; \ 95afe61c15SRodney W. Grimes shift; \ 96afe61c15SRodney W. Grimes t=${DESTDIR}$$1; \ 97afe61c15SRodney W. Grimes shift; \ 98a4c39c7aSBruce Evans ${ECHO} $$t -\> $$l; \ 99afe61c15SRodney W. Grimes rm -f $$t; \ 10045f7d107SJordan K. Hubbard ln ${LN_FLAGS} $$l $$t; \ 101afe61c15SRodney W. Grimes done; true 102afe61c15SRodney W. Grimes.endif 103afe61c15SRodney W. Grimes 104cd9a2f5cSJordan K. Hubbardinstall: afterinstall _SUBDIR 1053585b293SGarrett Wollman.if !defined(NOMAN) 1063585b293SGarrett Wollmanafterinstall: realinstall maninstall 1073585b293SGarrett Wollman.else 108afe61c15SRodney W. Grimesafterinstall: realinstall 1093585b293SGarrett Wollman.endif 110afe61c15SRodney W. Grimes.endif 111afe61c15SRodney W. Grimes 112d9584d76SJordan K. HubbardDISTRIBUTION?= bin 11355ff8fb1SPoul-Henning Kamp.if !target(distribute) 114cd9a2f5cSJordan K. Hubbarddistribute: _SUBDIR 115398ac038SJordan K. Hubbard.for dist in ${DISTRIBUTION} 116398ac038SJordan K. Hubbard cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${dist} SHARED=copies 117398ac038SJordan K. Hubbard.endfor 11855ff8fb1SPoul-Henning Kamp.endif 11955ff8fb1SPoul-Henning Kamp 120afe61c15SRodney W. Grimes.if !target(lint) 121cd9a2f5cSJordan K. Hubbardlint: ${SRCS} _SUBDIR 122afe61c15SRodney W. Grimes.if defined(PROG) 123afe61c15SRodney W. Grimes @${LINT} ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | more 2>&1 124afe61c15SRodney W. Grimes.endif 125afe61c15SRodney W. Grimes.endif 126afe61c15SRodney W. Grimes 1276eb5e456SJordan K. Hubbard.if defined(NOTAGS) 1286eb5e456SJordan K. Hubbardtags: 1296eb5e456SJordan K. Hubbard.endif 1306eb5e456SJordan K. Hubbard 131afe61c15SRodney W. Grimes.if !target(tags) 132cd9a2f5cSJordan K. Hubbardtags: ${SRCS} _SUBDIR 133afe61c15SRodney W. Grimes.if defined(PROG) 1346eb5e456SJordan K. Hubbard @cd ${.CURDIR} && gtags ${GTAGSFLAGS} 1356eb5e456SJordan K. Hubbard.if defined(HTML) 1366eb5e456SJordan K. Hubbard @cd ${.CURDIR} && htags ${HTAGSFLAGS} 1376eb5e456SJordan K. Hubbard.endif 138afe61c15SRodney W. Grimes.endif 139afe61c15SRodney W. Grimes.endif 140afe61c15SRodney W. Grimes 141afe61c15SRodney W. Grimes.if !defined(NOMAN) 142afe61c15SRodney W. Grimes.include <bsd.man.mk> 1433585b293SGarrett Wollman.elif !target(maninstall) 144afe61c15SRodney W. Grimesmaninstall: 145973f098aSGarrett Wollmanall-man: 146afe61c15SRodney W. Grimes.endif 1473585b293SGarrett Wollman 1483585b293SGarrett Wollman.include <bsd.dep.mk> 149cd9a2f5cSJordan K. Hubbard.include <bsd.obj.mk> 150