150 lines
3.0 KiB
Makefile
150 lines
3.0 KiB
Makefile
# from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91
|
|
# $Id: bsd.prog.mk,v 1.36 1994/03/24 16:11:40 mycroft Exp $
|
|
|
|
.if exists(${.CURDIR}/../Makefile.inc)
|
|
.include "${.CURDIR}/../Makefile.inc"
|
|
.endif
|
|
|
|
.SUFFIXES: .out .o .c .cc .C .y .l .s .8 .7 .6 .5 .4 .3 .2 .1 .0
|
|
|
|
CFLAGS+= ${COPTS}
|
|
|
|
LIBCRT0?= /usr/lib/crt0.o
|
|
LIBC?= /usr/lib/libc.a
|
|
LIBCOMPAT?= /usr/lib/libcompat.a
|
|
LIBCRYPT?= /usr/lib/libcrypt.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
|
|
LIBKVM?= /usr/lib/libkvm.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
|
|
LIBRPCSVC?= /usr/lib/librpcsvc.a
|
|
LIBTERMCAP?= /usr/lib/libtermcap.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
|
|
|
|
.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
|
|
|
|
.if defined(PROG)
|
|
.if defined(SRCS)
|
|
|
|
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
|
|
|
|
.if defined(LDONLY)
|
|
|
|
${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD}
|
|
${LD} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${LIBCRT0} ${OBJS} ${LIBC} ${LDADD}
|
|
|
|
.else defined(LDONLY)
|
|
|
|
${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD}
|
|
${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD}
|
|
|
|
.endif
|
|
|
|
.else
|
|
|
|
SRCS= ${PROG}.c
|
|
|
|
${PROG}: ${SRCS} ${LIBC} ${DPADD}
|
|
${CC} ${LDFLAGS} ${LDSTATIC} ${CFLAGS} -o ${.TARGET} ${.CURDIR}/${SRCS} ${LDADD}
|
|
|
|
MKDEP= -p
|
|
|
|
.endif
|
|
|
|
.if !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \
|
|
!defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \
|
|
!defined(MAN7) && !defined(MAN8)
|
|
MAN1= ${PROG}.0
|
|
.endif
|
|
.endif
|
|
|
|
.MAIN: all
|
|
all: ${PROG}
|
|
|
|
.if !target(clean)
|
|
clean:
|
|
rm -f a.out [Ee]rrs mklog core *.core ${PROG} ${OBJS} ${CLEANFILES}
|
|
.endif
|
|
|
|
cleandir: clean
|
|
|
|
.if !target(install)
|
|
.if !target(beforeinstall)
|
|
beforeinstall:
|
|
.endif
|
|
.if !target(afterinstall)
|
|
afterinstall:
|
|
.endif
|
|
|
|
.if !target(realinstall)
|
|
realinstall:
|
|
.if defined(PROG)
|
|
install ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
|
|
${PROG} ${DESTDIR}${BINDIR}
|
|
.endif
|
|
.if defined(HIDEGAME)
|
|
(cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG}; \
|
|
chown games.bin ${PROG})
|
|
.endif
|
|
.endif
|
|
|
|
install: maninstall _SUBDIRUSE
|
|
.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
|
|
|
|
maninstall: afterinstall
|
|
afterinstall: realinstall
|
|
realinstall: beforeinstall
|
|
.endif
|
|
|
|
.if !target(lint)
|
|
lint: ${SRCS}
|
|
.if defined(PROG)
|
|
@${LINT} ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | more 2>&1
|
|
.endif
|
|
.endif
|
|
|
|
.if !defined(NOMAN)
|
|
.include <bsd.man.mk>
|
|
.endif
|
|
|
|
.include <bsd.obj.mk>
|
|
.include <bsd.dep.mk>
|
|
.include <bsd.subdir.mk>
|