add sccs id
[unix-history] / usr / src / share / mk / bsd.prog.mk
# @(#)bsd.prog.mk 5.11 (Berkeley) %G%
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.SUFFIXES: .out .o .c .y .l .s .8 .7 .6 .5 .4 .3 .2 .1 .0
.8.0 .7.0 .6.0 .5.0 .4.0 .3.0 .2.0 .1.0:
nroff -man -h ${.IMPSRC} > ${.TARGET}
CFLAGS+=${COPTS}
LIBC?= /lib/libc.a
LIBCOMPAT?= /usr/lib/libcompat.a
LIBCURSES?= /usr/lib/libcurses.a
LIBDBM?= /usr/lib/libdbm.a
LIBDES?= /usr/lib/libdes.a
LIBL?= /usr/lib/libl.a
LIBKDB?= /usr/lib/libkdb.a
LIBKRB?= /usr/lib/libkrb.a
LIBM?= /usr/lib/libm.a
LIBMP?= /usr/lib/libmp.a
LIBPC?= /usr/lib/libpc.a
LIBPLOT?= /usr/lib/libplot.a
LIBRPC?= /usr/lib/sunrpc.a
LIBTERM?= /usr/lib/libterm.a
LIBUTIL?= /usr/lib/libutil.a
.if defined(SHAREDSTRINGS)
.c.o:
${CC} -E ${CFLAGS} ${.IMPSRC} | /usr/bin/xstr -c -
@${CC} ${CFLAGS} -c x.c -o ${.TARGET}
@rm -f x.c
.endif
.if defined(PROG)
.if defined(SRCS)
OBJS+= ${SRCS:.c=.o}
${PROG}: ${OBJS} ${LIBC} ${DPADD}
${CC} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
.else defined(PROG)
SRCS= ${PROG}.c
${PROG}: ${SRCS} ${LIBC} ${DPADD}
${CC} ${CFLAGS} -o ${.TARGET} ${.CURDIR}/${SRCS} ${LDADD}
.endif
.if !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \
!defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \
!defined(MAN7) && !defined(MAN8) && !defined(NOMAN)
MAN1= ${PROG}.0
.endif
.endif
MANALL= ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8}
PROGSUBDIR: .USE
.if defined(SUBDIR) && !empty(SUBDIR)
@for entry in ${SUBDIR}; do \
(echo "===> ${PROG}/$$entry"; \
if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \
cd ${.CURDIR}/$${entry}.${MACHINE}; \
else \
cd ${.CURDIR}/$${entry}; \
fi; \
${MAKE} ${.TARGET}) \
done
.endif
.MAIN: all
all: ${PROG} ${MANALL} PROGSUBDIR
.if !target(clean)
clean: PROGSUBDIR
rm -f a.out [Ee]rrs mklog core ${PROG} ${OBJS} ${CLEANFILES}
.endif
.if !target(cleandir)
cleandir: PROGSUBDIR
rm -f a.out [Ee]rrs mklog core ${PROG} ${OBJS} ${CLEANFILES}
rm -f .depend ${.CURDIR}/tags ${MANALL}
.endif
# some of the rules involve .h sources, so remove them from mkdep line
.if !target(depend)
depend: .depend
.depend: ${SRCS} PROGSUBDIR
mkdep ${CFLAGS:M-[ID]*} ${.ALLSRC:M*.c}
.endif
.if !target(install)
.if !target(beforeinstall)
beforeinstall:
.endif
realinstall: beforeinstall PROGSUBDIR
install ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
${PROG} ${DESTDIR}${BINDIR}
.if defined(HIDEGAME)
(cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG}; \
chown games.bin ${PROG})
.endif
install: afterinstall PROGSUBDIR
afterinstall: realinstall maninstall
.else
install: PROGSUBDIR
.endif
.if !target(lint)
lint: ${SRCS} PROGSUBDIR
@${LINT} ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | more 2>&1
.endif
.if !target(tags)
tags: ${SRCS} PROGSUBDIR
ctags -f ${.CURDIR}/tags ${.ALLSRC}
.endif
.include <bsd.own.mk>