[BACK]Return to bsd.prog.mk CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / share / mk

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/share/mk/bsd.prog.mk between version 1.8 and 1.71

version 1.8, 1993/04/08 17:18:46 version 1.71, 1997/05/06 20:54:40
Line 1 
Line 1 
 #       @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91  #       $NetBSD$
   #       @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94
   
 .if exists(${.CURDIR}/../Makefile.inc)  .if exists(${.CURDIR}/../Makefile.inc)
 .include "${.CURDIR}/../Makefile.inc"  .include "${.CURDIR}/../Makefile.inc"
 .endif  .endif
   
 .SUFFIXES: .out .o .c .y .l .s .8 .7 .6 .5 .4 .3 .2 .1 .0  .MAIN:          all
   .PHONY:         cleanprog afterdepend beforeinstall proginstall afterinstall
   
 .8.0 .7.0 .6.0 .5.0 .4.0 .3.0 .2.0 .1.0:  .include <bsd.own.mk>
         nroff -mandoc ${.IMPSRC} > ${.TARGET}  
   
 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  # ELF platforms depend on crtbegin.o and crtend.o
 BINOWN?=        bin  .if (${MACHINE_ARCH} == "alpha")   || \
 BINMODE?=       555      (${MACHINE_ARCH} == "powerpc")
   LIBCRTBEGIN?=   ${DESTDIR}/usr/lib/crtbegin.o
   LIBCRTEND?=     ${DESTDIR}/usr/lib/crtend.o
 LIBCRT0?=       /usr/lib/crt0.o  .else
 LIBC?=          /usr/lib/libc.a  LIBCRTBEGIN?=
 LIBCOMPAT?=     /usr/lib/libcompat.a  LIBCRTEND?=
 LIBCURSES?=     /usr/lib/libcurses.a  .endif
 LIBDBM?=        /usr/lib/libdbm.a  
 LIBDES?=        /usr/lib/libdes.a  LIBCRT0?=       ${DESTDIR}/usr/lib/crt0.o
 LIBL?=          /usr/lib/libl.a  LIBC?=          ${DESTDIR}/usr/lib/libc.a
 LIBKDB?=        /usr/lib/libkdb.a  LIBC_PIC?=      ${DESTDIR}/usr/lib/libc_pic.a
 LIBKRB?=        /usr/lib/libkrb.a  LIBCOMPAT?=     ${DESTDIR}/usr/lib/libcompat.a
 LIBM?=          /usr/lib/libm.a  LIBCRYPT?=      ${DESTDIR}/usr/lib/libcrypt.a
 LIBMP?=         /usr/lib/libmp.a  LIBCURSES?=     ${DESTDIR}/usr/lib/libcurses.a
 LIBPC?=         /usr/lib/libpc.a  LIBDBM?=        ${DESTDIR}/usr/lib/libdbm.a
 LIBPLOT?=       /usr/lib/libplot.a  LIBDES?=        ${DESTDIR}/usr/lib/libdes.a
 LIBRESOLV?=     /usr/lib/libresolv.a  LIBEDIT?=       ${DESTDIR}/usr/lib/libedit.a
 LIBRPC?=        /usr/lib/librpc.a  LIBGCC?=        ${DESTDIR}/usr/lib/libgcc.a
 LIBTERM?=       /usr/lib/libterm.a  LIBGNUMALLOC?=  ${DESTDIR}/usr/lib/libgnumalloc.a
 LIBUTIL?=       /usr/lib/libutil.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
   LIBNTP?=        ${DESTDIR}/usr/lib/libntp.a
   LIBPC?=         ${DESTDIR}/usr/lib/libpc.a
   LIBPCAP?=       ${DESTDIR}/usr/lib/libpcap.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
   LIBTELNET?=     ${DESTDIR}/usr/lib/libtelnet.a
   LIBUTIL?=       ${DESTDIR}/usr/lib/libutil.a
   LIBWRAP?=       ${DESTDIR}/usr/lib/libwrap.a
   LIBY?=          ${DESTDIR}/usr/lib/liby.a
   LIBZ?=          ${DESTDIR}/usr/lib/libz.a
   
 .if defined(SHAREDSTRINGS)  .if defined(SHAREDSTRINGS)
 CLEANFILES+=strings  CLEANFILES+=strings
Line 42  CLEANFILES+=strings
Line 61  CLEANFILES+=strings
         ${CC} -E ${CFLAGS} ${.IMPSRC} | xstr -c -          ${CC} -E ${CFLAGS} ${.IMPSRC} | xstr -c -
         @${CC} ${CFLAGS} -c x.c -o ${.TARGET}          @${CC} ${CFLAGS} -c x.c -o ${.TARGET}
         @rm -f x.c          @rm -f x.c
 .endif  
   
 .if defined(PROG)  .cc.o:
 .if defined(SRCS)          ${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c -
           @mv -f x.c x.cc
 OBJS+=  ${SRCS:R:S/$/.o/g}          @${CXX} ${CXXFLAGS} -c x.cc -o ${.TARGET}
           @rm -f x.cc
 .if defined(LDONLY)  
   .C.o:
 ${PROG}: ${LIBCRT0} ${LIBC} ${OBJS} ${DPADD}          ${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c -
         ${LD} ${LDFLAGS} -o ${.TARGET} ${LIBCRT0} ${OBJS} ${LIBC} ${LDADD}          @mv -f x.c x.C
           @${CXX} ${CXXFLAGS} -c x.C -o ${.TARGET}
 .else defined(LDONLY)          @rm -f x.C
   .endif
   
 ${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  .endif
   
 .else defined(PROG)  .if defined(OBJS) && !empty(OBJS)
   .if defined(DESTDIR)
   
 SRCS= ${PROG}.c  ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
           ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostdlib -L${DESTDIR}/usr/lib ${LIBCRT0} ${LIBCRTBEGIN} ${OBJS} ${LDADD} -lgcc -lc -lgcc ${LIBCRTEND}
   
 ${PROG}: ${SRCS} ${LIBC} ${DPADD}  .else
         ${CC} ${CFLAGS} -o ${.TARGET} ${.CURDIR}/${SRCS} ${LDADD}  
   
 MKDEP=  -p  ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
           ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD}
   
 .endif  .endif  # defined(DESTDIR)
   .endif  # defined(OBJS) && !empty(OBJS)
 .if     !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \  
         !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \  
         !defined(MAN7) && !defined(MAN8) && !defined(NOMAN)  
 MAN1=   ${PROG}.0  
 .endif  
 .endif  
 MANALL= ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8}  
   
 _PROGSUBDIR: .USE  .if     !defined(MAN)
 .if defined(SUBDIR) && !empty(SUBDIR)  MAN=    ${PROG}.1
         @for entry in ${SUBDIR}; do \  .endif  # !defined(MAN)
                 (echo "===> $$entry"; \  .endif  # defined(PROG)
                 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  
   
 .MAIN: all  all: ${PROG} _SUBDIRUSE
 all: ${PROG} ${MANALL} _PROGSUBDIR  
   
 .if !target(clean)  .if !target(clean)
 clean: _PROGSUBDIR  cleanprog:
         rm -f a.out [Ee]rrs mklog core ${PROG} ${OBJS} ${CLEANFILES}          rm -f a.out [Ee]rrs mklog core *.core \
 .endif              ${PROG} ${OBJS} ${LOBJS} ${CLEANFILES}
   
 .if !target(cleandir)  clean: _SUBDIRUSE cleanprog
 cleandir: _PROGSUBDIR  cleandir: _SUBDIRUSE cleanprog
         rm -f a.out [Ee]rrs mklog core ${PROG} ${OBJS} ${CLEANFILES}  .else
         rm -f .depend ${MANALL}  cleandir: _SUBDIRUSE clean
 .endif  .endif
   
 # some of the rules involve .h sources, so remove them from mkdep line  .if defined(SRCS)
 .if !target(depend)  afterdepend: .depend
 depend: .depend _PROGSUBDIR          @(TMP=/tmp/_depend$$$$; \
 .depend: ${SRCS}              sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.ln:/' \
 .if defined(PROG)                < .depend > $$TMP; \
         mkdep ${MKDEP} ${CFLAGS:M-[ID]*} ${.ALLSRC:M*.c}              mv $$TMP .depend)
 .endif  
 .endif  .endif
   
 .if !target(install)  .if !target(install)
 .if !target(beforeinstall)  .if !target(beforeinstall)
 beforeinstall:  beforeinstall:
         @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)  .if !target(afterinstall)
 afterinstall:  afterinstall:
 .endif  .endif
   
 realinstall: _PROGSUBDIR  .if !target(realinstall)
   
 .if defined(PROG)  .if defined(PROG)
         install -c ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \  PROGNAME?= ${PROG}
             ${PROG} ${DESTDIR}${BINDIR}  proginstall:: ${DESTDIR}${BINDIR}/${PROGNAME}
   .if !defined(UPDATE)
   .PHONY: ${DESTDIR}${BINDIR}/${PROGNAME}
   .endif
   .if !defined(BUILD)
   ${DESTDIR}${BINDIR}/${PROGNAME}: .MADE
   .endif
   
   ${DESTDIR}${BINDIR}/${PROGNAME}: ${PROG}
           ${INSTALL} ${COPY} ${STRIPFLAG} -o ${BINOWN} -g ${BINGRP} \
               -m ${BINMODE} ${.ALLSRC} ${.TARGET}
   .endif
   
   .if defined(SCRIPTS)
   SCRIPTSDIR?=${BINDIR}
   SCRIPTSOWN?=${BINOWN}
   SCRIPTSGRP?=${BINGRP}
   SCRIPTSMODE?=${BINMODE}
   .for S in ${SCRIPTS}
   SCRIPTSDIR_${S}?=${SCRIPTSDIR}
   SCRIPTSOWN_${S}?=${SCRIPTSOWN}
   SCRIPTSGRP_${S}?=${SCRIPTSGRP}
   SCRIPTSMODE_${S}?=${SCRIPTSMODE}
   .if defined(SCRIPTSNAME)
   SCRIPTSNAME_${S} ?= ${SCRIPTSNAME}
   .else
   SCRIPTSNAME_${S} ?= ${S:T:R}
 .endif  .endif
 .if defined(HIDEGAME)  SCRIPTSDIR_${S} ?= ${SCRIPTSDIR}
         (cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG}; \  proginstall:: ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}}
             chown games.bin ${PROG})  .if !defined(UPDATE)
 .endif  .PHONY: ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}}
 .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  .endif
   .if !defined(BUILD)
 install: maninstall  ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}}: .MADE
 maninstall: afterinstall  
 afterinstall: realinstall  
 realinstall: beforeinstall  
 .endif  .endif
   
 .if !target(lint)  ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}}: ${S}
 lint: ${SRCS} _PROGSUBDIR          ${INSTALL} ${COPY} -o ${SCRIPTSOWN_${S}} -g ${SCRIPTSGRP_${S}} \
 .if defined(PROG)                  -m ${SCRIPTSMODE_${S}} ${.ALLSRC} ${.TARGET}
         @${LINT} ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | more 2>&1  .endfor
 .endif  
 .endif  .endif
   
 .if !target(obj)  .if target(proginstall)
 .if defined(NOOBJ)  realinstall: proginstall filesinstall
 obj: _PROGSUBDIR  
 .else  .else
 obj: _PROGSUBDIR  realinstall: filesinstall
         @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 ; \  
                 echo "making $$here/obj" ; \  
                 if test ! -d obj ; then \  
                         mkdir $$here/obj; \  
                 fi ; \  
         fi;  
 .endif  .endif
 .endif  .endif
   
 .if !target(tags)  install: ${MANINSTALL} _SUBDIRUSE linksinstall
 tags: ${SRCS} _PROGSUBDIR  
 .if defined(PROG)  ${MANINSTALL}: afterinstall
         -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC} | \  afterinstall: realinstall
             sed "s;\${.CURDIR}/;;" > tags  realinstall: beforeinstall
   .endif
   
   .if !target(lint)
   lint: ${LOBJS}
   .if defined(LOBJS) && !empty(LOBJS)
           @${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD}
 .endif  .endif
 .endif  .endif
   
 .if !defined(NOMAN)  .if !defined(NOMAN)
 .include <bsd.man.mk>  .include <bsd.man.mk>
 .endif  .endif
   
   .if !defined(NONLS)
   .include <bsd.nls.mk>
   .endif
   
   .include <bsd.obj.mk>
   .include <bsd.links.mk>
   .include <bsd.files.mk>
   .include <bsd.inc.mk>
   .include <bsd.dep.mk>
   .include <bsd.subdir.mk>
   .include <bsd.sys.mk>

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.71

CVSweb <webmaster@jp.NetBSD.org>