bsd.prog.mk revision 21673
1194676Sthompsa# from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 2194676Sthompsa# $FreeBSD: head/share/mk/bsd.prog.mk 21673 1997-01-14 07:20:47Z jkh $ 3194676Sthompsa 4194676Sthompsa.if exists(${.CURDIR}/../Makefile.inc) 5194676Sthompsa.include "${.CURDIR}/../Makefile.inc" 6194676Sthompsa.endif 7194676Sthompsa 8194676Sthompsa.SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S 9194676Sthompsa 10194676SthompsaCFLAGS+=${COPTS} ${DEBUG_FLAGS} 11194676Sthompsa.if defined(DESTDIR) 12194676SthompsaCFLAGS+= -I${DESTDIR}/usr/include 13194676SthompsaCXXINCLUDES+= -I${DESTDIR}/usr/include/${CXX} 14194676Sthompsa.endif 15194676Sthompsa 16194676Sthompsa.if !defined(DEBUG_FLAGS) 17194676SthompsaSTRIP?= -s 18194676Sthompsa.endif 19194676Sthompsa 20194676Sthompsa.if defined(NOSHARED) 21194676SthompsaLDFLAGS+= -static 22194676Sthompsa.endif 23194676Sthompsa 24194676Sthompsa.if defined(DESTDIR) 25194676SthompsaLDDESTDIR+= -L${DESTDIR}/usr/lib 26194676Sthompsa.endif 27194676Sthompsa 28194676Sthompsa.include <bsd.libnames.mk> 29194676Sthompsa 30194676Sthompsa.if defined(PROG) 31194676Sthompsa.if defined(SRCS) 32194676Sthompsa 33194676SthompsaDPSRCS+= ${SRCS:M*.h} 34194676Sthompsa.if !defined(NOOBJ) 35194676SthompsaOBJS+= ${SRCS:N*.h:R:S/$/.o/g} 36194676Sthompsa.endif 37194676Sthompsa 38194676Sthompsa.if defined(LDONLY) 39194676Sthompsa 40194676Sthompsa${PROG}: ${LIBCRT0} ${LIBC} ${DPSRCS} ${OBJS} ${DPADD} 41194676Sthompsa ${LD} ${LDFLAGS} -o ${.TARGET} ${LIBCRT0} ${OBJS} ${LIBC} ${LDDESTDIR} \ 42194676Sthompsa ${LDADD} 43194676Sthompsa 44194676Sthompsa.else defined(LDONLY) 45194676Sthompsa 46194676Sthompsa${PROG}: ${DPSRCS} ${OBJS} ${LIBC} ${DPADD} 47194676Sthompsa ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDDESTDIR} ${LDADD} 48194676Sthompsa 49194676Sthompsa.endif 50194676Sthompsa 51194676Sthompsa.else !defined(SRCS) 52194676Sthompsa 53194676SthompsaSRCS= ${PROG}.c 54194676Sthompsa 55194676Sthompsa.if 0 56194676Sthompsa${PROG}: ${DPSRCS} ${SRCS} ${LIBC} ${DPADD} 57194676Sthompsa ${CC} ${LDFLAGS} ${CFLAGS} -o ${.TARGET} ${.CURDIR}/${SRCS} \ 58194676Sthompsa ${LDDESTDIR} ${LDADD} 59194676Sthompsa 60194676SthompsaMKDEP= -p 61194676Sthompsa.else 62194676Sthompsa# Always make an intermediate object file because: 63194676Sthompsa# - it saves time rebuilding when only the library has changed 64194676Sthompsa# - the name of the object gets put into the executable symbol table instead of 65194676Sthompsa# the name of a variable temporary object. 66194676Sthompsa# - it's useful to keep objects around for crunching. 67194676SthompsaOBJS= ${PROG}.o 68194676Sthompsa${PROG}: ${DPSRCS} ${OBJS} ${LIBC} ${DPADD} 69194676Sthompsa ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDDESTDIR} ${LDADD} 70194676Sthompsa.endif 71194676Sthompsa 72194676Sthompsa.endif 73194676Sthompsa 74194676Sthompsa.if !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \ 75194676Sthompsa !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \ 76194676Sthompsa !defined(MAN7) && !defined(MAN8) && !defined(NOMAN) 77194676SthompsaMAN1= ${PROG}.1 78194676Sthompsa.endif 79194676Sthompsa.endif 80194676Sthompsa 81194676Sthompsa# XXX I think MANDEPEND is only used for groff. It should be named more 82194676Sthompsa# generally and perhaps not be in the maninstall dependencies now it is 83194676Sthompsa# here (or does maninstall always work when nothing is made?), 84194676Sthompsa 85194676Sthompsa.MAIN: all 86194676Sthompsaall: objwarn ${PROG} all-man _SUBDIR 87194676Sthompsa 88194676Sthompsa.if !target(clean) 89194676Sthompsaclean: _SUBDIR 90194676Sthompsa rm -f a.out Errs errs mklog ${PROG} ${OBJS} ${CLEANFILES} 91194676Sthompsa.if defined(CLEANDIRS) && !empty(CLEANDIRS) 92194676Sthompsa rm -rf ${CLEANDIRS} 93194676Sthompsa.endif 94194676Sthompsa.endif 95194676Sthompsa 96194676Sthompsa.if !target(install) 97194676Sthompsa.if !target(beforeinstall) 98194676Sthompsabeforeinstall: 99194676Sthompsa.endif 100194676Sthompsa 101194676Sthompsarealinstall: beforeinstall 102194676Sthompsa.if defined(PROG) 103194676Sthompsa ${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 104194676Sthompsa ${INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR} 105194676Sthompsa.endif 106194676Sthompsa.if defined(HIDEGAME) 107194676Sthompsa (cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG}; \ 108194676Sthompsa chown games.bin ${PROG}) 109194676Sthompsa.endif 110194676Sthompsa.if defined(LINKS) && !empty(LINKS) 111194676Sthompsa @set ${LINKS}; \ 112194676Sthompsa while test $$# -ge 2; do \ 113194676Sthompsa l=${DESTDIR}$$1; \ 114194676Sthompsa shift; \ 115194676Sthompsa t=${DESTDIR}$$1; \ 116194676Sthompsa shift; \ 117194676Sthompsa ${ECHO} $$t -\> $$l; \ 118194676Sthompsa rm -f $$t; \ 119194676Sthompsa ln ${LN_FLAGS} $$l $$t; \ 120194676Sthompsa done; true 121194676Sthompsa.endif 122194676Sthompsa 123194676Sthompsainstall: afterinstall _SUBDIR 124194676Sthompsa.if !defined(NOMAN) 125194676Sthompsaafterinstall: realinstall maninstall 126194676Sthompsa.else 127194676Sthompsaafterinstall: realinstall 128194676Sthompsa.endif 129194676Sthompsa.endif 130194676Sthompsa 131194676SthompsaDISTRIBUTION?= bin 132194676Sthompsa.if !target(distribute) 133194676Sthompsadistribute: _SUBDIR 134194676Sthompsa cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${DISTRIBUTION} SHARED=copies 135194676Sthompsa.endif 136194676Sthompsa 137194676Sthompsa.if !target(lint) 138194676Sthompsalint: ${SRCS} _SUBDIR 139194676Sthompsa.if defined(PROG) 140194676Sthompsa @${LINT} ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | more 2>&1 141194676Sthompsa.endif 142194676Sthompsa.endif 143194676Sthompsa 144194676Sthompsa.if !target(tags) 145194676Sthompsatags: ${SRCS} _SUBDIR 146194676Sthompsa.if defined(PROG) 147194676Sthompsa -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC} | \ 148194676Sthompsa sed "s;\${.CURDIR}/;;" > tags 149194676Sthompsa.endif 150194676Sthompsa.endif 151194676Sthompsa 152194676Sthompsa.if !defined(NOMAN) 153194676Sthompsa.include <bsd.man.mk> 154194676Sthompsa.elif !target(maninstall) 155194676Sthompsamaninstall: 156194676Sthompsaall-man: 157194676Sthompsa.endif 158194676Sthompsa 159194676Sthompsa.include <bsd.dep.mk> 160194676Sthompsa.include <bsd.obj.mk> 161194676Sthompsa