Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/share/mk/bsd.prog.mk,v rcsdiff: /ftp/cvs/cvsroot/src/share/mk/bsd.prog.mk,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.22 retrieving revision 1.56 diff -u -p -r1.22 -r1.56 --- src/share/mk/bsd.prog.mk 1993/07/30 03:40:12 1.22 +++ src/share/mk/bsd.prog.mk 1996/10/18 02:34:47 1.56 @@ -1,43 +1,39 @@ +# $NetBSD: bsd.prog.mk,v 1.56 1996/10/18 02:34:47 thorpej Exp $ # @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 .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 - -.8.0 .7.0 .6.0 .5.0 .4.0 .3.0 .2.0 .1.0: - nroff -mandoc ${.IMPSRC} > ${.TARGET} +.include -CFLAGS+=${COPTS} +.SUFFIXES: .out .o .c .cc .C .y .l .s .8 .7 .6 .5 .4 .3 .2 .1 .0 -STRIP?= -s +CFLAGS+= ${COPTS} -BINGRP?= bin -BINOWN?= bin -BINMODE?= 555 - -LIBCRT0?= /usr/lib/crt0.o -LIBC?= /usr/lib/libc.a -LIBCOMPAT?= /usr/lib/libcompat.a -.ifndef EXPORTABLE_SYSTEM -LIBCRYPT?= /usr/lib/libcrypt.a -.endif -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 -LIBRPC?= /usr/lib/librpc.a -LIBRPCSVC?= /usr/lib/librpcsvc.a -LIBTERM?= /usr/lib/libterm.a -LIBUTIL?= /usr/lib/libutil.a +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 +LIBDBM?= ${DESTDIR}/usr/lib/libdbm.a +LIBDES?= ${DESTDIR}/usr/lib/libdes.a +LIBEDIT?= ${DESTDIR}/usr/lib/libedit.a +LIBGCC?= ${DESTDIR}/usr/lib/libgcc.a +LIBKDB?= ${DESTDIR}/usr/lib/libkdb.a +LIBKRB?= ${DESTDIR}/usr/lib/libkrb.a +LIBKVM?= ${DESTDIR}/usr/lib/libkvm.a +LIBL?= ${DESTDIR}/usr/lib/libl.a +LIBM?= ${DESTDIR}/usr/lib/libm.a +LIBMP?= ${DESTDIR}/usr/lib/libmp.a +LIBPC?= ${DESTDIR}/usr/lib/libpc.a +LIBPLOT?= ${DESTDIR}/usr/lib/libplot.a +LIBRESOLV?= ${DESTDIR}/usr/lib/libresolv.a +LIBRPCSVC?= ${DESTDIR}/usr/lib/librpcsvc.a +LIBSKEY?= ${DESTDIR}/usr/lib/libskey.a +LIBTERMCAP?= ${DESTDIR}/usr/lib/libtermcap.a +LIBUTIL?= ${DESTDIR}/usr/lib/libutil.a +LIBY?= ${DESTDIR}/usr/lib/liby.a .if defined(SHAREDSTRINGS) CLEANFILES+=strings @@ -50,124 +46,73 @@ CLEANFILES+=strings ${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} ${LIBC} ${OBJS} ${DPADD} - ${LD} ${LDFLAGS} -o ${.TARGET} ${LIBCRT0} ${OBJS} ${LIBC} ${LDADD} - -.else defined(LDONLY) - -${PROG}: ${OBJS} ${LIBC} ${DPADD} - ${CC} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} +.if defined(PROG) +SRCS?= ${PROG}.c +.if !empty(SRCS:N*.h:N*.sh) +OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.o/g} +LOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln} .endif -.else defined(PROG) +.if defined(OBJS) && !empty(OBJS) +.if defined(DESTDIR) -SRCS= ${PROG}.c +${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD} + ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostdlib -L${DESTDIR}/usr/lib ${LIBCRT0} ${OBJS} ${LDADD} -lgcc -lc -lgcc -${PROG}: ${SRCS} ${LIBC} ${DPADD} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${.TARGET} ${.CURDIR}/${SRCS} ${LDADD} - -MKDEP= -p +.else -.endif +${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD} + ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD} -.if !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \ - !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \ - !defined(MAN7) && !defined(MAN8) -MAN1= ${PROG}.0 -.endif -.endif +.endif # defined(DESTDIR) +.endif # defined(OBJS) && !empty(OBJS) -.if !defined(NOMAN) -MANALL= ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8} -.endif - -_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 +.if !defined(MAN) +MAN= ${PROG}.1 +.endif # !defined(MAN) +.endif # defined(PROG) .MAIN: all -all: ${PROG} ${MANALL} _PROGSUBDIR +all: ${PROG} _SUBDIRUSE .if !target(clean) -clean: _PROGSUBDIR - rm -f a.out [Ee]rrs mklog core ${PROG} ${OBJS} ${CLEANFILES} +clean: _SUBDIRUSE + rm -f a.out [Ee]rrs mklog core *.core \ + ${PROG} ${OBJS} ${LOBJS} ${CLEANFILES} .endif -.if !target(cleandir) -cleandir: _PROGSUBDIR - rm -f a.out [Ee]rrs mklog core ${PROG} ${OBJS} ${CLEANFILES} - 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) - rm -f .depend - files="${.ALLSRC:M*.c}"; \ - if [ "$$files" != "" ]; then \ - mkdep -a ${MKDEP} ${CFLAGS:M-[ID]*} $$files; \ - fi - files="${.ALLSRC:M*.cc} ${.ALLSRC:M*.C} ${.ALLSRC:M*.cxx}"; \ - if [ "$$files" != " " ]; then \ - mkdep -a ${MKDEP} -+ ${CXXFLAGS:M-[ID]*} $$files; \ - fi -.endif -.endif +cleandir: _SUBDIRUSE clean .if !target(install) .if !target(beforeinstall) beforeinstall: -.if defined(DESTDIR) || defined(BINDIR) - @if [ ! -d "${DESTDIR}${BINDIR}" ]; then \ - /bin/rm -f ${DESTDIR}${BINDIR} ; \ - mkdir -p ${DESTDIR}${BINDIR} ; \ - chown root.wheel ${DESTDIR}${BINDIR} ; \ - chmod 755 ${DESTDIR}${BINDIR} ; \ - else \ - true ; \ - fi -.endif .endif .if !target(afterinstall) afterinstall: .endif .if !target(realinstall) -realinstall: _PROGSUBDIR +realinstall: .if defined(PROG) - install ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ + ${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}) + (cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG}) +.endif .endif + +install: maninstall _SUBDIRUSE .if defined(LINKS) && !empty(LINKS) @set ${LINKS}; \ while test $$# -ge 2; do \ @@ -180,55 +125,28 @@ realinstall: _PROGSUBDIR ln $$l $$t; \ done; true .endif -.endif -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 +lint: ${LOBJS} +.if defined(LOBJS) && !empty(LOBJS) + @${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD} .endif .endif -.if !target(obj) -.if defined(NOOBJ) -obj: _PROGSUBDIR -.else -obj: _PROGSUBDIR - @cd ${.CURDIR}; rm -f obj > /dev/null 2>&1 || true; \ - 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; \ - else \ - true ; \ - dest=$$here/obj ; \ - if test ! -d obj ; then \ - echo "making $$dest" ; \ - mkdir $$dest; \ - fi ; \ - fi; -.endif +.if !defined(NOMAN) +.include .endif -.if !target(tags) -tags: ${SRCS} _PROGSUBDIR -.if defined(PROG) - -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC} | \ - sed "s;\${.CURDIR}/;;" > tags -.endif +.if !defined(NONLS) +.include .endif -.if !defined(NOMAN) -.include -.endif +.include +.include +.include +.include