1994-08-04 21:09:27 +00:00
|
|
|
# from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91
|
1997-02-22 14:13:04 +00:00
|
|
|
# $Id$
|
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
|
|
|
|
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
|
|
|
|
|
1996-09-28 06:01:01 +00:00
|
|
|
.include <bsd.libnames.mk>
|
|
|
|
|
1994-05-30 19:09:18 +00:00
|
|
|
.if defined(PROG)
|
|
|
|
.if defined(SRCS)
|
|
|
|
|
1994-08-04 21:09:27 +00:00
|
|
|
DPSRCS+= ${SRCS:M*.h}
|
|
|
|
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
|
|
|
|
|
|
|
|
.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
|
|
|
|
|
1995-05-07 06:39:30 +00:00
|
|
|
.else !defined(SRCS)
|
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
|
|
|
|
|
1995-02-08 21:35:31 +00:00
|
|
|
# XXX I think MANDEPEND is only used for groff. It should be named more
|
|
|
|
# generally and perhaps not be in the maninstall dependencies now it is
|
|
|
|
# here (or does maninstall always work when nothing is made?),
|
|
|
|
|
1994-05-30 19:09:18 +00:00
|
|
|
.MAIN: all
|
1996-09-18 06:09:19 +00:00
|
|
|
all: objwarn ${PROG} all-man _SUBDIR
|
1994-05-30 19:09:18 +00:00
|
|
|
|
|
|
|
.if !target(clean)
|
1996-06-24 04:26:21 +00:00
|
|
|
clean: _SUBDIR
|
1996-03-09 23:48:55 +00:00
|
|
|
rm -f a.out Errs errs mklog ${PROG} ${OBJS} ${CLEANFILES}
|
1996-06-29 03:12:49 +00:00
|
|
|
.if defined(CLEANDIRS) && !empty(CLEANDIRS)
|
1996-06-17 15:59:52 +00:00
|
|
|
rm -rf ${CLEANDIRS}
|
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !target(install)
|
|
|
|
.if !target(beforeinstall)
|
|
|
|
beforeinstall:
|
|
|
|
.endif
|
|
|
|
|
1996-06-24 04:26:21 +00:00
|
|
|
realinstall: beforeinstall
|
1994-05-30 19:09:18 +00:00
|
|
|
.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
|
|
|
|
|
1996-06-24 04:26:21 +00:00
|
|
|
install: afterinstall _SUBDIR
|
1994-08-04 21:09:27 +00:00
|
|
|
.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
|
|
|
.endif
|
|
|
|
|
1995-01-14 07:51:10 +00:00
|
|
|
DISTRIBUTION?= bin
|
1994-11-13 21:05:28 +00:00
|
|
|
.if !target(distribute)
|
1996-06-24 04:26:21 +00:00
|
|
|
distribute: _SUBDIR
|
1995-02-25 20:51:14 +00:00
|
|
|
cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${DISTRIBUTION} SHARED=copies
|
1994-11-13 21:05:28 +00:00
|
|
|
.endif
|
|
|
|
|
1994-05-30 19:09:18 +00:00
|
|
|
.if !target(lint)
|
1996-06-24 04:26:21 +00:00
|
|
|
lint: ${SRCS} _SUBDIR
|
1994-05-30 19:09:18 +00:00
|
|
|
.if defined(PROG)
|
|
|
|
@${LINT} ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | more 2>&1
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !target(tags)
|
1996-06-24 04:26:21 +00:00
|
|
|
tags: ${SRCS} _SUBDIR
|
1994-05-30 19:09:18 +00:00
|
|
|
.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:
|
1995-10-02 20:02:05 +00:00
|
|
|
all-man:
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
1994-08-04 21:09:27 +00:00
|
|
|
|
|
|
|
.include <bsd.dep.mk>
|
1996-06-24 04:26:21 +00:00
|
|
|
.include <bsd.obj.mk>
|