1993-03-21 12:45:37 +03:00
|
|
|
# @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91
|
|
|
|
|
|
|
|
.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 -mandoc ${.IMPSRC} > ${.TARGET}
|
|
|
|
|
|
|
|
CFLAGS+=${COPTS}
|
|
|
|
|
|
|
|
STRIP?= -s
|
|
|
|
|
|
|
|
BINGRP?= bin
|
|
|
|
BINOWN?= bin
|
|
|
|
BINMODE?= 555
|
|
|
|
|
1993-03-27 15:17:32 +03:00
|
|
|
LIBCRT0?= /usr/lib/crt0.o
|
1993-03-21 12:45:37 +03:00
|
|
|
LIBC?= /usr/lib/libc.a
|
|
|
|
LIBCOMPAT?= /usr/lib/libcompat.a
|
1993-04-26 17:07:57 +04:00
|
|
|
.ifndef EXPORTABLE_SYSTEM
|
|
|
|
LIBCRYPT?= /usr/lib/libcrypt.a
|
|
|
|
.endif
|
1993-03-21 12:45:37 +03:00
|
|
|
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
|
|
|
|
LIBRESOLV?= /usr/lib/libresolv.a
|
1993-04-04 19:30:16 +04:00
|
|
|
LIBRPC?= /usr/lib/librpc.a
|
1993-03-21 12:45:37 +03:00
|
|
|
LIBTERM?= /usr/lib/libterm.a
|
|
|
|
LIBUTIL?= /usr/lib/libutil.a
|
|
|
|
|
|
|
|
.if defined(SHAREDSTRINGS)
|
|
|
|
CLEANFILES+=strings
|
|
|
|
.c.o:
|
|
|
|
${CC} -E ${CFLAGS} ${.IMPSRC} | xstr -c -
|
|
|
|
@${CC} ${CFLAGS} -c x.c -o ${.TARGET}
|
|
|
|
@rm -f x.c
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if defined(PROG)
|
|
|
|
.if defined(SRCS)
|
|
|
|
|
|
|
|
OBJS+= ${SRCS:R:S/$/.o/g}
|
|
|
|
|
1993-03-27 15:17:32 +03:00
|
|
|
.if defined(LDONLY)
|
|
|
|
|
|
|
|
${PROG}: ${LIBCRT0} ${LIBC} ${OBJS} ${DPADD}
|
|
|
|
${LD} ${LDFLAGS} -o ${.TARGET} ${LIBCRT0} ${OBJS} ${LIBC} ${LDADD}
|
|
|
|
|
|
|
|
.else defined(LDONLY)
|
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
${PROG}: ${OBJS} ${LIBC} ${DPADD}
|
|
|
|
${CC} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
|
|
|
|
|
1993-03-27 15:17:32 +03:00
|
|
|
.endif
|
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
.else defined(PROG)
|
|
|
|
|
|
|
|
SRCS= ${PROG}.c
|
|
|
|
|
|
|
|
${PROG}: ${SRCS} ${LIBC} ${DPADD}
|
1993-04-25 09:53:48 +04:00
|
|
|
${CC} ${LDFLAGS} ${CFLAGS} -o ${.TARGET} ${.CURDIR}/${SRCS} ${LDADD}
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
MKDEP= -p
|
|
|
|
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \
|
|
|
|
!defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \
|
1993-04-25 08:15:26 +04:00
|
|
|
!defined(MAN7) && !defined(MAN8)
|
1993-03-21 12:45:37 +03:00
|
|
|
MAN1= ${PROG}.0
|
|
|
|
.endif
|
|
|
|
.endif
|
1993-04-25 08:55:52 +04:00
|
|
|
|
|
|
|
.if !defined(NOMAN)
|
1993-03-21 12:45:37 +03:00
|
|
|
MANALL= ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8}
|
1993-04-25 08:15:26 +04:00
|
|
|
.endif
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
_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
|
|
|
|
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
|
1993-04-08 21:18:42 +04:00
|
|
|
rm -f a.out [Ee]rrs mklog core ${PROG} ${OBJS} ${CLEANFILES}
|
1993-03-21 12:45:37 +03:00
|
|
|
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(beforeinstall)
|
|
|
|
beforeinstall:
|
1993-04-25 09:36:13 +04:00
|
|
|
.if defined(DESTDIR) || defined(BINDIR)
|
1993-04-08 21:18:42 +04:00
|
|
|
@if [ ! -d "${DESTDIR}${BINDIR}" ]; then \
|
1993-04-08 18:10:30 +04:00
|
|
|
/bin/rm -f ${DESTDIR}${BINDIR} ; \
|
1993-04-08 18:02:00 +04:00
|
|
|
mkdir -p ${DESTDIR}${BINDIR} ; \
|
|
|
|
chown root.wheel ${DESTDIR}${BINDIR} ; \
|
|
|
|
chmod 755 ${DESTDIR}${BINDIR} ; \
|
|
|
|
else \
|
|
|
|
true ; \
|
|
|
|
fi
|
1993-03-21 12:45:37 +03:00
|
|
|
.endif
|
1993-04-25 09:36:13 +04:00
|
|
|
.endif
|
1993-03-21 12:45:37 +03:00
|
|
|
.if !target(afterinstall)
|
|
|
|
afterinstall:
|
|
|
|
.endif
|
|
|
|
|
1993-04-26 07:26:17 +04:00
|
|
|
.if !target(realinstall)
|
1993-03-21 12:45:37 +03:00
|
|
|
realinstall: _PROGSUBDIR
|
|
|
|
.if defined(PROG)
|
1993-04-10 00:05:56 +04:00
|
|
|
install ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
|
1993-03-21 12:45:37 +03:00
|
|
|
${PROG} ${DESTDIR}${BINDIR}
|
|
|
|
.endif
|
|
|
|
.if defined(HIDEGAME)
|
|
|
|
(cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG}; \
|
|
|
|
chown games.bin ${PROG})
|
|
|
|
.endif
|
|
|
|
.if defined(LINKS) && !empty(LINKS)
|
|
|
|
@set ${LINKS}; \
|
|
|
|
while test $$# -ge 2; do \
|
|
|
|
l=${DESTDIR}$$1; \
|
|
|
|
shift; \
|
|
|
|
t=${DESTDIR}$$1; \
|
|
|
|
shift; \
|
|
|
|
echo $$t -\> $$l; \
|
|
|
|
rm -f $$t; \
|
|
|
|
ln $$l $$t; \
|
|
|
|
done; true
|
|
|
|
.endif
|
1993-04-26 07:26:17 +04:00
|
|
|
.endif
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
install: maninstall
|
|
|
|
maninstall: afterinstall
|
|
|
|
afterinstall: realinstall
|
|
|
|
realinstall: beforeinstall
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !target(lint)
|
|
|
|
lint: ${SRCS} _PROGSUBDIR
|
|
|
|
.if defined(PROG)
|
|
|
|
@${LINT} ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | more 2>&1
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !target(obj)
|
|
|
|
.if defined(NOOBJ)
|
|
|
|
obj: _PROGSUBDIR
|
|
|
|
.else
|
|
|
|
obj: _PROGSUBDIR
|
1993-03-23 10:26:38 +03:00
|
|
|
@cd ${.CURDIR}; rm -f obj > /dev/null 2>&1 || true; \
|
1993-03-22 11:09:36 +03:00
|
|
|
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; \
|
1993-03-21 12:45:37 +03:00
|
|
|
else \
|
1993-03-22 11:09:36 +03:00
|
|
|
true ; \
|
|
|
|
dest=$$here/obj ; \
|
|
|
|
echo "making $$here/obj" ; \
|
|
|
|
if test ! -d obj ; then \
|
|
|
|
mkdir $$here/obj; \
|
|
|
|
fi ; \
|
1993-03-21 12:45:37 +03:00
|
|
|
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)
|
|
|
|
.include <bsd.man.mk>
|
|
|
|
.endif
|