BSD 4_4 release
[unix-history] / usr / share / mk / bsd.prog.mk
index 406f015..5549d2c 100644 (file)
@@ -1,13 +1,13 @@
-#      @(#)bsd.prog.mk 5.20 (Berkeley) 6/29/90
+#      @(#)bsd.prog.mk 8.1 (Berkeley) 7/19/93
 
 
-.if exists(${.CURDIR}/../Makefile.inc)
+.if !defined(NOINCLUDE) && 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:
 .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 -h ${.IMPSRC} > ${.TARGET}
+       nroff -man ${.IMPSRC} > ${.TARGET}
 
 CFLAGS+=${COPTS}
 
 
 CFLAGS+=${COPTS}
 
@@ -25,6 +25,7 @@ LIBDES?=      /usr/lib/libdes.a
 LIBL?=         /usr/lib/libl.a
 LIBKDB?=       /usr/lib/libkdb.a
 LIBKRB?=       /usr/lib/libkrb.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
 LIBM?=         /usr/lib/libm.a
 LIBMP?=                /usr/lib/libmp.a
 LIBPC?=                /usr/lib/libpc.a
@@ -45,12 +46,12 @@ CLEANFILES+=strings
 .if defined(PROG)
 .if defined(SRCS)
 
 .if defined(PROG)
 .if defined(SRCS)
 
-OBJS+= ${SRCS:.c=.o}
+OBJS+=  ${SRCS:R:S/$/.o/g}
 
 ${PROG}: ${OBJS} ${LIBC} ${DPADD}
        ${CC} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
 
 
 ${PROG}: ${OBJS} ${LIBC} ${DPADD}
        ${CC} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
 
-.else defined(PROG)
+.else defined(SRCS)
 
 SRCS= ${PROG}.c
 
 
 SRCS= ${PROG}.c
 
@@ -67,7 +68,12 @@ MKDEP=       -p
 MAN1=  ${PROG}.0
 .endif
 .endif
 MAN1=  ${PROG}.0
 .endif
 .endif
+.if !defined(NOMAN)
 MANALL=        ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8}
 MANALL=        ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8}
+.else
+MANALL=
+.endif
+manpages: ${MANALL}
 
 _PROGSUBDIR: .USE
 .if defined(SUBDIR) && !empty(SUBDIR)
 
 _PROGSUBDIR: .USE
 .if defined(SUBDIR) && !empty(SUBDIR)
@@ -78,22 +84,24 @@ _PROGSUBDIR: .USE
                else \
                        cd ${.CURDIR}/$${entry}; \
                fi; \
                else \
                        cd ${.CURDIR}/$${entry}; \
                fi; \
-               ${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/}) \
+               ${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/}); \
        done
 .endif
 
        done
 .endif
 
+.if !target(all)
 .MAIN: all
 all: ${PROG} ${MANALL} _PROGSUBDIR
 .MAIN: all
 all: ${PROG} ${MANALL} _PROGSUBDIR
+.endif
 
 .if !target(clean)
 clean: _PROGSUBDIR
 
 .if !target(clean)
 clean: _PROGSUBDIR
-       rm -f a.out [Ee]rrs mklog core ${PROG} ${OBJS} ${CLEANFILES}
+       rm -f a.out [Ee]rrs mklog core.${PROG} ${PROG} ${OBJS} ${CLEANFILES}
 .endif
 
 .if !target(cleandir)
 cleandir: _PROGSUBDIR
 .endif
 
 .if !target(cleandir)
 cleandir: _PROGSUBDIR
-       rm -f a.out [Ee]rrs mklog core ${PROG} ${OBJS} ${CLEANFILES}
-       rm -f .depend ${.CURDIR}/tags ${MANALL}
+       rm -f a.out [Ee]rrs mklog core.${PROG} ${PROG} ${OBJS} ${CLEANFILES}
+       rm -f .depend ${MANALL}
 .endif
 
 # some of the rules involve .h sources, so remove them from mkdep line
 .endif
 
 # some of the rules involve .h sources, so remove them from mkdep line
@@ -116,7 +124,7 @@ afterinstall:
 realinstall: _PROGSUBDIR
 .if defined(PROG)
        install ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
 realinstall: _PROGSUBDIR
 .if defined(PROG)
        install ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
-           ${PROG} ${DESTDIR}${BINDIR}
+           ${INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}
 .endif
 .if defined(HIDEGAME)
        (cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG}; \
 .endif
 .if defined(HIDEGAME)
        (cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG}; \
@@ -135,8 +143,7 @@ realinstall: _PROGSUBDIR
        done; true
 .endif
 
        done; true
 .endif
 
-install: maninstall
-maninstall: afterinstall
+install: afterinstall maninstall
 afterinstall: realinstall
 realinstall: beforeinstall
 .endif
 afterinstall: realinstall
 realinstall: beforeinstall
 .endif
@@ -155,18 +162,40 @@ obj: _PROGSUBDIR
 obj: _PROGSUBDIR
        @cd ${.CURDIR}; rm -rf obj; \
        here=`pwd`; dest=/usr/obj/`echo $$here | sed 's,/usr/src/,,'`; \
 obj: _PROGSUBDIR
        @cd ${.CURDIR}; rm -rf obj; \
        here=`pwd`; dest=/usr/obj/`echo $$here | sed 's,/usr/src/,,'`; \
-       echo "$$here -> $$dest"; ln -s $$dest obj
+       echo "$$here -> $$dest"; ln -s $$dest obj; \
+       if test -d /usr/obj -a ! -d $$dest; then \
+               mkdir -p $$dest; \
+       else \
+               true; \
+       fi;
+.endif
+.endif
+
+.if !target(objdir)
+.if defined(NOOBJ)
+objdir: _PROGSUBDIR
+.else
+objdir: _PROGSUBDIR
+       @cd ${.CURDIR}; \
+       here=`pwd`; dest=/usr/obj/`echo $$here | sed 's,/usr/src/,,'`; \
+       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)
 .endif
 .endif
 
 .if !target(tags)
 tags: ${SRCS} _PROGSUBDIR
 .if defined(PROG)
-       -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC} | \
-           sed "s;\${.CURDIR}/;;" > tags
+       -ctags -f /dev/stdout ${.ALLSRC} | \
+           sed "s;${.CURDIR}/;;" > ${.CURDIR}/tags
 .endif
 .endif
 
 .if !defined(NOMAN)
 .include <bsd.man.mk>
 .endif
 .endif
 
 .if !defined(NOMAN)
 .include <bsd.man.mk>
+.else
+maninstall:
 .endif
 .endif