version 1.15, 1993/04/26 13:07:59 |
version 1.27, 1993/08/15 20:59:38 |
|
|
# @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 |
# from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 |
|
# $Id$ |
|
|
.if exists(${.CURDIR}/../Makefile.inc) |
.if exists(${.CURDIR}/../Makefile.inc) |
.include "${.CURDIR}/../Makefile.inc" |
.include "${.CURDIR}/../Makefile.inc" |
.endif |
.endif |
|
|
.SUFFIXES: .out .o .c .y .l .s .8 .7 .6 .5 .4 .3 .2 .1 .0 |
.SUFFIXES: .out .o .c .cc .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: |
CFLAGS+= ${COPTS} |
nroff -mandoc ${.IMPSRC} > ${.TARGET} |
|
|
|
CFLAGS+=${COPTS} |
|
|
|
STRIP?= -s |
|
|
|
BINGRP?= bin |
|
BINOWN?= bin |
|
BINMODE?= 555 |
|
|
|
LIBCRT0?= /usr/lib/crt0.o |
LIBCRT0?= /usr/lib/crt0.o |
LIBC?= /usr/lib/libc.a |
LIBC?= /usr/lib/libc.a |
Line 35 LIBPC?= /usr/lib/libpc.a |
|
Line 27 LIBPC?= /usr/lib/libpc.a |
|
LIBPLOT?= /usr/lib/libplot.a |
LIBPLOT?= /usr/lib/libplot.a |
LIBRESOLV?= /usr/lib/libresolv.a |
LIBRESOLV?= /usr/lib/libresolv.a |
LIBRPC?= /usr/lib/librpc.a |
LIBRPC?= /usr/lib/librpc.a |
|
LIBRPCSVC?= /usr/lib/librpcsvc.a |
LIBTERM?= /usr/lib/libterm.a |
LIBTERM?= /usr/lib/libterm.a |
LIBUTIL?= /usr/lib/libutil.a |
LIBUTIL?= /usr/lib/libutil.a |
|
|
Line 44 CLEANFILES+=strings |
|
Line 37 CLEANFILES+=strings |
|
${CC} -E ${CFLAGS} ${.IMPSRC} | xstr -c - |
${CC} -E ${CFLAGS} ${.IMPSRC} | xstr -c - |
@${CC} ${CFLAGS} -c x.c -o ${.TARGET} |
@${CC} ${CFLAGS} -c x.c -o ${.TARGET} |
@rm -f x.c |
@rm -f x.c |
|
|
|
.cc.o: |
|
${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c - |
|
@mv -f x.c x.cc |
|
@${CXX} ${CXXFLAGS} -c x.cc -o ${.TARGET} |
|
@rm -f x.cc |
|
|
|
.C.o: |
|
${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c - |
|
@mv -f x.c x.C |
|
@${CXX} ${CXXFLAGS} -c x.C -o ${.TARGET} |
|
@rm -f x.C |
.endif |
.endif |
|
|
.if defined(PROG) |
.if defined(PROG) |
.if defined(SRCS) |
.if defined(SRCS) |
|
|
OBJS+= ${SRCS:R:S/$/.o/g} |
OBJS+= ${SRCS:N*.h:R:S/$/.o/g} |
|
|
.if defined(LDONLY) |
.if defined(LDONLY) |
|
|
${PROG}: ${LIBCRT0} ${LIBC} ${OBJS} ${DPADD} |
${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD} |
${LD} ${LDFLAGS} -o ${.TARGET} ${LIBCRT0} ${OBJS} ${LIBC} ${LDADD} |
${LD} ${LDFLAGS} -o ${.TARGET} ${LIBCRT0} ${OBJS} ${LIBC} ${LDADD} |
|
|
.else defined(LDONLY) |
.else defined(LDONLY) |
|
|
${PROG}: ${OBJS} ${LIBC} ${DPADD} |
${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD} |
${CC} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} |
${CC} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} |
|
|
.endif |
.endif |
|
|
.else defined(PROG) |
.else |
|
|
SRCS= ${PROG}.c |
SRCS= ${PROG}.c |
|
|
${PROG}: ${SRCS} ${LIBC} ${DPADD} |
${PROG}: ${SRCS} ${LIBC} ${DPADD} |
${CC} ${LDFLAGS} ${CFLAGS} -o ${.TARGET} ${.CURDIR}/${SRCS} ${LDADD} |
${CC} ${LDFLAGS} ${CFLAGS} -o ${.TARGET} ${.CURDIR}/${SRCS} ${LDADD} |
|
|
.endif |
.endif |
.endif |
.endif |
|
|
.if !defined(NOMAN) |
|
MANALL= ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8} |
|
.endif |
|
|
|
_PROGSUBDIR: .USE |
|
.if defined(SUBDIR) && !empty(SUBDIR) |
|
@for entry in ${SUBDIR}; do \ |
|
(echo "===> $$entry"; \ |
|
if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \ |
|
cd ${.CURDIR}/$${entry}.${MACHINE}; \ |
|
else \ |
|
cd ${.CURDIR}/$${entry}; \ |
|
fi; \ |
|
${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/}); \ |
|
done |
|
.endif |
|
|
|
.MAIN: all |
.MAIN: all |
all: ${PROG} ${MANALL} _PROGSUBDIR |
all: ${PROG} |
|
|
.if !target(clean) |
.if !target(clean) |
clean: _PROGSUBDIR |
clean: |
rm -f a.out [Ee]rrs mklog core ${PROG} ${OBJS} ${CLEANFILES} |
rm -f a.out [Ee]rrs mklog core ${PROG} ${OBJS} ${CLEANFILES} |
.endif |
.endif |
|
|
.if !target(cleandir) |
cleandir: clean |
cleandir: _PROGSUBDIR |
|
rm -f a.out [Ee]rrs mklog core ${PROG} ${OBJS} ${CLEANFILES} |
|
rm -f .depend ${MANALL} |
|
.endif |
|
|
|
# some of the rules involve .h sources, so remove them from mkdep line |
|
.if !target(depend) |
|
depend: .depend _PROGSUBDIR |
|
.depend: ${SRCS} |
|
.if defined(PROG) |
|
mkdep ${MKDEP} ${CFLAGS:M-[ID]*} ${.ALLSRC:M*.c} |
|
.endif |
|
.endif |
|
|
|
.if !target(install) |
.if !target(install) |
.if !target(beforeinstall) |
.if !target(beforeinstall) |
beforeinstall: |
beforeinstall: |
.if defined(DESTDIR) || defined(BINDIR) |
.if defined(DESTDIR) || defined(BINDIR) |
@if [ ! -d "${DESTDIR}${BINDIR}" ]; then \ |
@install -d -o root -g wheel -m 755 ${DESTDIR}${BINDIR} |
/bin/rm -f ${DESTDIR}${BINDIR} ; \ |
|
mkdir -p ${DESTDIR}${BINDIR} ; \ |
|
chown root.wheel ${DESTDIR}${BINDIR} ; \ |
|
chmod 755 ${DESTDIR}${BINDIR} ; \ |
|
else \ |
|
true ; \ |
|
fi |
|
.endif |
.endif |
.endif |
.endif |
.if !target(afterinstall) |
.if !target(afterinstall) |
|
|
.endif |
.endif |
|
|
.if !target(realinstall) |
.if !target(realinstall) |
realinstall: _PROGSUBDIR |
realinstall: |
.if defined(PROG) |
.if defined(PROG) |
install ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ |
install ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ |
${PROG} ${DESTDIR}${BINDIR} |
${PROG} ${DESTDIR}${BINDIR} |
Line 149 realinstall: _PROGSUBDIR |
|
Line 117 realinstall: _PROGSUBDIR |
|
(cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG}; \ |
(cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG}; \ |
chown games.bin ${PROG}) |
chown games.bin ${PROG}) |
.endif |
.endif |
|
.endif |
|
|
|
install: maninstall |
.if defined(LINKS) && !empty(LINKS) |
.if defined(LINKS) && !empty(LINKS) |
@set ${LINKS}; \ |
@set ${LINKS}; \ |
while test $$# -ge 2; do \ |
while test $$# -ge 2; do \ |
Line 161 realinstall: _PROGSUBDIR |
|
Line 132 realinstall: _PROGSUBDIR |
|
ln $$l $$t; \ |
ln $$l $$t; \ |
done; true |
done; true |
.endif |
.endif |
.endif |
|
|
|
install: maninstall |
|
maninstall: afterinstall |
maninstall: afterinstall |
afterinstall: realinstall |
afterinstall: realinstall |
realinstall: beforeinstall |
realinstall: beforeinstall |
.endif |
.endif |
|
|
.if !target(lint) |
.if !target(lint) |
lint: ${SRCS} _PROGSUBDIR |
lint: ${SRCS} |
.if defined(PROG) |
.if defined(PROG) |
@${LINT} ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | more 2>&1 |
@${LINT} ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | more 2>&1 |
.endif |
.endif |
.endif |
.endif |
|
|
.if !target(obj) |
|
.if defined(NOOBJ) |
|
obj: _PROGSUBDIR |
|
.else |
|
obj: _PROGSUBDIR |
|
@cd ${.CURDIR}; rm -f obj > /dev/null 2>&1 || true; \ |
|
here=`pwd`; subdir=`echo $$here | sed 's,^/usr/src/,,'`; \ |
|
if test $$here != $$subdir ; then \ |
|
dest=/usr/obj/$$subdir ; \ |
|
echo "$$here -> $$dest"; ln -s $$dest obj; \ |
|
if test -d /usr/obj -a ! -d $$dest; then \ |
|
mkdir -p $$dest; \ |
|
else \ |
|
true; \ |
|
fi; \ |
|
else \ |
|
true ; \ |
|
dest=$$here/obj ; \ |
|
echo "making $$here/obj" ; \ |
|
if test ! -d obj ; then \ |
|
mkdir $$here/obj; \ |
|
fi ; \ |
|
fi; |
|
.endif |
|
.endif |
|
|
|
.if !target(tags) |
|
tags: ${SRCS} _PROGSUBDIR |
|
.if defined(PROG) |
|
-cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC} | \ |
|
sed "s;\${.CURDIR}/;;" > tags |
|
.endif |
|
.endif |
|
|
|
.if !defined(NOMAN) |
.if !defined(NOMAN) |
.include <bsd.man.mk> |
.include <bsd.man.mk> |
.endif |
.endif |
|
|
|
.include <bsd.obj.mk> |
|
.include <bsd.dep.mk> |