1994-08-04 21:09:27 +00:00
|
|
|
# from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91
|
1995-01-30 07:20:01 +00:00
|
|
|
# $Id: bsd.prog.mk,v 1.20 1995/01/25 20:24:01 ache Exp $
|
1994-05-30 19:09:18 +00:00
|
|
|
|
1994-08-04 21:09:27 +00:00
|
|
|
.if exists(${.CURDIR}/../Makefile.inc)
|
1994-05-30 19:09:18 +00:00
|
|
|
.include "${.CURDIR}/../Makefile.inc"
|
|
|
|
.endif
|
|
|
|
|
1994-08-04 21:09:27 +00:00
|
|
|
.SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S
|
1994-05-30 19:09:18 +00:00
|
|
|
|
1994-09-16 14:30:25 +00:00
|
|
|
CFLAGS+=${COPTS} ${DEBUG_FLAGS}
|
1994-08-04 21:09:27 +00:00
|
|
|
.if defined(DESTDIR)
|
|
|
|
CFLAGS+= -I${DESTDIR}/usr/include
|
|
|
|
CXXINCLUDES+= -I${DESTDIR}/usr/include/${CXX}
|
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
1994-09-16 14:30:25 +00:00
|
|
|
.if !defined(DEBUG_FLAGS)
|
1994-05-30 19:09:18 +00:00
|
|
|
STRIP?= -s
|
1994-09-16 14:30:25 +00:00
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
|
|
|
BINGRP?= bin
|
|
|
|
BINOWN?= bin
|
|
|
|
BINMODE?= 555
|
|
|
|
|
1994-08-04 21:09:27 +00:00
|
|
|
LIBCRT0?= ${DESTDIR}/usr/lib/crt0.o
|
|
|
|
LIBC?= ${DESTDIR}/usr/lib/libc.a
|
|
|
|
LIBCOMPAT?= ${DESTDIR}/usr/lib/libcompat.a
|
|
|
|
LIBCRYPT?= ${DESTDIR}/usr/lib/libcrypt.a
|
|
|
|
LIBCURSES?= ${DESTDIR}/usr/lib/libcurses.a
|
1994-11-14 04:28:44 +00:00
|
|
|
LIBDES?= ${DESTDIR}/usr/lib/libdes.a # XXX doesn't exist
|
1994-10-11 23:38:19 +00:00
|
|
|
LIBDIALOG?= ${DESTDIR}/usr/lib/libdialog.a
|
1994-11-14 04:28:44 +00:00
|
|
|
LIBEDIT?= ${DESTDIR}/usr/lib/libedit.a
|
1995-01-25 20:24:01 +00:00
|
|
|
LIBFORMS?= ${DESTDIR}/usr/lib/libforms.a
|
1994-11-14 04:28:44 +00:00
|
|
|
LIBGCC?= ${DESTDIR}/usr/lib/libgcc.a
|
1994-08-04 21:09:27 +00:00
|
|
|
LIBGNUMALLOC?= ${DESTDIR}/usr/lib/libgnumalloc.a
|
|
|
|
LIBGNUREGEX?= ${DESTDIR}/usr/lib/libgnuregex.a
|
1994-11-14 04:28:44 +00:00
|
|
|
LIBKDB?= ${DESTDIR}/usr/lib/libkdb.a # XXX doesn't exist
|
|
|
|
LIBKRB?= ${DESTDIR}/usr/lib/libkrb.a # XXX doesn't exist
|
|
|
|
LIBKVM?= ${DESTDIR}/usr/lib/libkvm.a
|
1994-08-04 21:09:27 +00:00
|
|
|
LIBL?= ${DESTDIR}/usr/lib/libl.a
|
|
|
|
LIBM?= ${DESTDIR}/usr/lib/libm.a
|
1994-10-18 23:01:22 +00:00
|
|
|
LIBMD?= ${DESTDIR}/usr/lib/libmd.a
|
1994-11-14 04:28:44 +00:00
|
|
|
LIBMP?= ${DESTDIR}/usr/lib/libmp.a # XXX doesn't exist
|
1994-10-07 03:10:05 +00:00
|
|
|
LIBMYTINFO?= ${DESTDIR}/usr/lib/libmytinfo.a
|
|
|
|
LIBNCURSES?= ${DESTDIR}/usr/lib/libncurses.a
|
1994-11-14 04:28:44 +00:00
|
|
|
LIBPC?= ${DESTDIR}/usr/lib/libpc.a # XXX doesn't exist
|
|
|
|
LIBPLOT?= ${DESTDIR}/usr/lib/libplot.a # XXX doesn't exist
|
1994-08-04 21:09:27 +00:00
|
|
|
LIBREADLINE?= ${DESTDIR}/usr/lib/libreadline.a
|
|
|
|
LIBRESOLV?= ${DESTDIR}/usr/lib/libresolv.a
|
|
|
|
LIBRPCSVC?= ${DESTDIR}/usr/lib/librpcsvc.a
|
1994-11-14 04:28:44 +00:00
|
|
|
LIBSCRYPT?= ${DESTDIR}/usr/lib/libscrypt.a # XXX don't use, use LIBCRYPT
|
1995-01-25 20:24:01 +00:00
|
|
|
LIBSCSI?= ${DESTDIR}/usr/lib/libscsi.a
|
1994-08-04 21:09:27 +00:00
|
|
|
LIBSKEY?= ${DESTDIR}/usr/lib/libskey.a
|
|
|
|
LIBTELNET?= ${DESTDIR}/usr/lib/libtelnet.a
|
1994-09-11 21:32:28 +00:00
|
|
|
LIBTERMCAP?= ${DESTDIR}/usr/lib/libtermcap.a
|
1994-08-04 21:09:27 +00:00
|
|
|
LIBUTIL?= ${DESTDIR}/usr/lib/libutil.a
|
1994-11-14 04:28:44 +00:00
|
|
|
LIBY?= ${DESTDIR}/usr/lib/liby.a
|
|
|
|
|
1994-08-04 21:09:27 +00:00
|
|
|
.if defined(NOSHARED)
|
|
|
|
LDFLAGS+= -static
|
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
1994-08-04 21:09:27 +00:00
|
|
|
.if defined(DESTDIR)
|
1994-10-25 18:09:44 +00:00
|
|
|
LDDESTDIR+= -L${DESTDIR}/usr/lib
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.if defined(PROG)
|
|
|
|
.if defined(SRCS)
|
|
|
|
|
1994-08-04 21:09:27 +00:00
|
|
|
DPSRCS+= ${SRCS:M*.h}
|
1995-01-24 17:50:30 +00:00
|
|
|
.if !defined(NOOBJ)
|
1994-08-04 21:09:27 +00:00
|
|
|
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
|
1995-01-24 17:33:22 +00:00
|
|
|
.endif
|
1994-08-04 21:09:27 +00:00
|
|
|
|
|
|
|
.if defined(LDONLY)
|
1994-05-30 19:09:18 +00:00
|
|
|
|
1994-08-04 21:09:27 +00:00
|
|
|
${PROG}: ${LIBCRT0} ${LIBC} ${DPSRCS} ${OBJS} ${DPADD}
|
1994-08-28 15:32:10 +00:00
|
|
|
${LD} ${LDFLAGS} -o ${.TARGET} ${LIBCRT0} ${OBJS} ${LIBC} ${LDDESTDIR} \
|
1994-08-04 21:09:27 +00:00
|
|
|
${LDADD}
|
1994-05-30 19:09:18 +00:00
|
|
|
|
1994-08-04 21:09:27 +00:00
|
|
|
.else defined(LDONLY)
|
|
|
|
|
|
|
|
${PROG}: ${DPSRCS} ${OBJS} ${LIBC} ${DPADD}
|
|
|
|
${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDDESTDIR} ${LDADD}
|
|
|
|
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.else defined(PROG)
|
1994-05-30 19:09:18 +00:00
|
|
|
|
1994-08-28 15:32:10 +00:00
|
|
|
SRCS= ${PROG}.c
|
1994-05-30 19:09:18 +00:00
|
|
|
|
1994-08-28 15:32:10 +00:00
|
|
|
.if 0
|
1994-08-04 21:09:27 +00:00
|
|
|
${PROG}: ${DPSRCS} ${SRCS} ${LIBC} ${DPADD}
|
|
|
|
${CC} ${LDFLAGS} ${CFLAGS} -o ${.TARGET} ${.CURDIR}/${SRCS} \
|
|
|
|
${LDDESTDIR} ${LDADD}
|
1994-12-22 17:20:52 +00:00
|
|
|
|
|
|
|
MKDEP= -p
|
1994-08-28 15:32:10 +00:00
|
|
|
.else
|
|
|
|
# Always make an intermediate object file because:
|
|
|
|
# - it saves time rebuilding when only the library has changed
|
|
|
|
# - the name of the object gets put into the executable symbol table instead of
|
|
|
|
# the name of a variable temporary object.
|
|
|
|
# - it's useful to keep objects around for crunching.
|
|
|
|
OBJS= ${PROG}.o
|
|
|
|
${PROG}: ${DPSRCS} ${OBJS} ${LIBC} ${DPADD}
|
|
|
|
${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDDESTDIR} ${LDADD}
|
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \
|
|
|
|
!defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \
|
|
|
|
!defined(MAN7) && !defined(MAN8) && !defined(NOMAN)
|
1994-08-04 21:09:27 +00:00
|
|
|
MAN1= ${PROG}.1
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
|
|
|
_PROGSUBDIR: .USE
|
|
|
|
.if defined(SUBDIR) && !empty(SUBDIR)
|
|
|
|
@for entry in ${SUBDIR}; do \
|
1995-01-14 19:48:49 +00:00
|
|
|
(${ECHODIR} "===> ${DIRPRFX}$$entry"; \
|
1994-05-30 19:09:18 +00:00
|
|
|
if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \
|
|
|
|
cd ${.CURDIR}/$${entry}.${MACHINE}; \
|
|
|
|
else \
|
|
|
|
cd ${.CURDIR}/$${entry}; \
|
|
|
|
fi; \
|
1995-01-14 19:48:49 +00:00
|
|
|
${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/} DIRPRFX=${DIRPRFX}$$entry/); \
|
1994-05-30 19:09:18 +00:00
|
|
|
done
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.MAIN: all
|
1994-08-04 21:09:27 +00:00
|
|
|
all: ${PROG} _PROGSUBDIR
|
1994-05-30 19:09:18 +00:00
|
|
|
|
|
|
|
.if !target(clean)
|
|
|
|
clean: _PROGSUBDIR
|
1994-08-04 21:09:27 +00:00
|
|
|
rm -f a.out [Ee]rrs mklog ${PROG} ${OBJS} ${CLEANFILES}
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !target(cleandir)
|
|
|
|
cleandir: _PROGSUBDIR
|
1994-08-04 21:09:27 +00:00
|
|
|
rm -f a.out [Ee]rrs mklog ${PROG} ${OBJS} ${CLEANFILES}
|
|
|
|
rm -f ${.CURDIR}/tags .depend
|
|
|
|
cd ${.CURDIR}; rm -rf obj;
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !target(install)
|
|
|
|
.if !target(beforeinstall)
|
|
|
|
beforeinstall:
|
|
|
|
.endif
|
|
|
|
.if !target(afterinstall)
|
|
|
|
afterinstall:
|
|
|
|
.endif
|
|
|
|
|
|
|
|
realinstall: _PROGSUBDIR
|
|
|
|
.if defined(PROG)
|
1994-08-04 21:09:27 +00:00
|
|
|
${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
|
1994-08-10 02:48:08 +00:00
|
|
|
${INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}
|
1994-05-30 19:09:18 +00:00
|
|
|
.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; \
|
1994-08-28 15:32:10 +00:00
|
|
|
${ECHO} $$t -\> $$l; \
|
1994-05-30 19:09:18 +00:00
|
|
|
rm -f $$t; \
|
1995-01-30 07:20:01 +00:00
|
|
|
ln ${LN_FLAGS} $$l $$t; \
|
1994-05-30 19:09:18 +00:00
|
|
|
done; true
|
|
|
|
.endif
|
|
|
|
|
1994-08-04 21:09:27 +00:00
|
|
|
install: afterinstall
|
|
|
|
.if !defined(NOMAN)
|
|
|
|
afterinstall: realinstall maninstall
|
|
|
|
.else
|
1994-05-30 19:09:18 +00:00
|
|
|
afterinstall: realinstall
|
1994-08-04 21:09:27 +00:00
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
realinstall: beforeinstall
|
|
|
|
.endif
|
|
|
|
|
1995-01-14 07:51:10 +00:00
|
|
|
DISTRIBUTION?= bin
|
1994-11-13 21:05:28 +00:00
|
|
|
.if !target(distribute)
|
|
|
|
distribute:
|
|
|
|
cd ${.CURDIR} ; $(MAKE) install DESTDIR=${RELEASEDIR}/${DISTRIBUTION} SHARED=copies
|
|
|
|
.endif
|
|
|
|
|
1994-05-30 19:09:18 +00:00
|
|
|
.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
|
|
|
|
@cd ${.CURDIR}; rm -rf obj; \
|
1994-08-04 21:09:27 +00:00
|
|
|
here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
|
1994-08-28 15:32:10 +00:00
|
|
|
${ECHO} "$$here -> $$dest"; ln -s $$dest obj; \
|
1994-05-30 19:09:18 +00:00
|
|
|
if test -d /usr/obj -a ! -d $$dest; then \
|
|
|
|
mkdir -p $$dest; \
|
|
|
|
else \
|
|
|
|
true; \
|
|
|
|
fi;
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !target(tags)
|
|
|
|
tags: ${SRCS} _PROGSUBDIR
|
|
|
|
.if defined(PROG)
|
1994-08-04 21:09:27 +00:00
|
|
|
-cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC} | \
|
|
|
|
sed "s;\${.CURDIR}/;;" > tags
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !defined(NOMAN)
|
|
|
|
.include <bsd.man.mk>
|
1994-08-04 21:09:27 +00:00
|
|
|
.elif !target(maninstall)
|
1994-05-30 19:09:18 +00:00
|
|
|
maninstall:
|
|
|
|
.endif
|
1994-08-04 21:09:27 +00:00
|
|
|
|
|
|
|
.include <bsd.dep.mk>
|