[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.43 and 1.167

version 1.43, 1994/06/30 05:21:32 version 1.167, 2003/05/31 20:33:16
Line 1 
Line 1 
 #       from: @(#)bsd.prog.mk   5.26 (Berkeley) 6/25/91  #       $NetBSD$
 #       $Id$  #       @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94
   
 .if exists(${.CURDIR}/../Makefile.inc)  .ifndef HOSTPROG
 .include "${.CURDIR}/../Makefile.inc"  
 .endif  
   
 .SUFFIXES: .out .o .c .cc .C .y .l .s .8 .7 .6 .5 .4 .3 .2 .1 .0  
   
   .include <bsd.init.mk>
   .include <bsd.shlib.mk>
   .include <bsd.gcc.mk>
   
   ##### Basic targets
   .PHONY:         cleanextra cleanobjs cleanprog proginstall scriptsinstall
   realinstall:    proginstall scriptsinstall
   clean:          cleanprog
   
   ##### Default values
   CPPFLAGS+=      ${DESTDIR:D-nostdinc ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include}
   CXXFLAGS+=      ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include/g++}
 CFLAGS+=        ${COPTS}  CFLAGS+=        ${COPTS}
   .if ${MACHINE_ARCH} == "sparc64"
   CFLAGS+=        -mcmodel=medlow
   .endif
   
 LIBCRT0?=       /usr/lib/crt0.o  # ELF platforms depend on crti.o, crtbegin.o, crtend.o, and crtn.o
 LIBC?=          /usr/lib/libc.a  .if ${OBJECT_FMT} == "ELF"
 LIBCOMPAT?=     /usr/lib/libcompat.a  .ifndef LIBCRTBEGIN
 LIBCRYPT?=      /usr/lib/libcrypt.a  LIBCRTBEGIN=    ${DESTDIR}/usr/lib/crti.o ${_GCC_CRTBEGIN}
 LIBCURSES?=     /usr/lib/libcurses.a  .MADE: ${LIBCRTBEGIN}
 LIBDBM?=        /usr/lib/libdbm.a  .endif
 LIBDES?=        /usr/lib/libdes.a  .ifndef LIBCRTEND
 LIBL?=          /usr/lib/libl.a  LIBCRTEND=      ${_GCC_CRTEND} ${DESTDIR}/usr/lib/crtn.o
 LIBKDB?=        /usr/lib/libkdb.a  .MADE: ${LIBCRTEND}
 LIBKRB?=        /usr/lib/libkrb.a  .endif
 LIBKVM?=        /usr/lib/libkvm.a  _SHLINKER=      ${SHLINKDIR}/ld.elf_so
 LIBM?=          /usr/lib/libm.a  .else
 LIBMP?=         /usr/lib/libmp.a  LIBCRTBEGIN?=
 LIBPC?=         /usr/lib/libpc.a  LIBCRTEND?=
 LIBPLOT?=       /usr/lib/libplot.a  _SHLINKER=      ${SHLINKDIR}/ld.so
 LIBRESOLV?=     /usr/lib/libresolv.a  .endif
 LIBRPCSVC?=     /usr/lib/librpcsvc.a  
 LIBSKEY?=       /usr/lib/libskey.a  .ifndef LIBCRT0
 LIBTERMCAP?=    /usr/lib/libtermcap.a  LIBCRT0=        ${DESTDIR}/usr/lib/crt0.o
 LIBUTIL?=       /usr/lib/libutil.a  .MADE: ${LIBCRT0}
   .endif
   
   ##### Installed system library definitions
   #     E.g. LIBC?=${DESTDIR}/usr/lib/libc.a
   #     etc..
   #
   __bsd_prog_mk_system_libs?= \
           BZ2 C C_PIC CDK COM_ERR COMPAT CRYPT CRYPTO CRYPTO_IDEA CRYPTO_MDC2 \
           CRYPTO_RC5 \
           CURSES DBM DES EDIT FORM GCC GNUMALLOC GSSAPI HDB INTL IPSEC \
           KADM KADM5CLNT KADM5SRV KAFS KDB KRB KRB5 KSTREAM KVM L M MENU \
           OBJC OSSAUDIO PCAP PCI PMC POSIX PTHREAD PTHREAD_DBG RESOLV RMT \
           ROKEN RPCSVC RT SKEY SS SSL SL TERMCAP TELNET USBHID UTIL WRAP Y Z
   
   .for _n in ${__bsd_prog_mk_system_libs}
   .ifndef LIB${_n}
   LIB${_n}= ${DESTDIR}/usr/lib/lib${_n:tl}.a
   # XXX - note that ${DESTDIR} will be expanded in the following rule
   .MADE: ${LIB${_n}}
   .endif
   .endfor
   .undef __bsd_prog_mk_system_libs
   
   ##### Build and install rules
 .if defined(SHAREDSTRINGS)  .if defined(SHAREDSTRINGS)
 CLEANFILES+=strings  CLEANFILES+=strings
 .c.o:  .c.o:
Line 50  CLEANFILES+=strings
Line 84  CLEANFILES+=strings
         @rm -f x.C          @rm -f x.C
 .endif  .endif
   
   .if defined(PROG_CXX)
   PROG=   ${PROG_CXX}
   .endif
   
 .if defined(PROG)  .if defined(PROG)
 SRCS?=  ${PROG}.c  .if defined(PROG_CXX)
 OBJS+=  ${SRCS:N*.h:N*.sh:R:S/$/.o/g}  SRCS?=          ${PROG}.cc
   .else
   SRCS?=          ${PROG}.c
   .endif
   
 .if defined(LDONLY)  DPSRCS+=        ${SRCS:M*.[ly]:C/\..$/.c/}
   CLEANFILES+=    ${DPSRCS} ${YHEADER:D${SRCS:M*.y:.y=.h}}
   
 ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD}  .if !empty(SRCS:N*.h:N*.sh:N*.fth)
         ${LD} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${LIBCRT0} ${OBJS} ${LIBC} ${LDADD}  OBJS+=          ${SRCS:N*.h:N*.sh:N*.fth:R:S/$/.o/g}
   LOBJS+=         ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
   .endif
   
 .else defined(LDONLY)  .if defined(OBJS) && !empty(OBJS)
   .NOPATH: ${OBJS} ${PROG} ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
   
 ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD}  _PROGLDOPTS=
         ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD}  .if ${SHLINKDIR} != "/usr/libexec"      # XXX: change or remove if ld.so moves
   .if ${OBJECT_FMT} == "ELF"
   _PROGLDOPTS+=   -Wl,-dynamic-linker=${_SHLINKER}
   .endif
   .if ${OBJECT_FMT} == "a.out"
   LIBCRT0=        ${DESTDIR}/lib/crt0.o
   .endif
   .endif
   .if ${SHLIBDIR} != ${LIBDIR}
   _PROGLDOPTS+=   -Wl,-rpath-link,${DESTDIR}${SHLIBDIR}:${DESTDIR}/usr/lib \
                   -Wl,-rpath,${SHLIBDIR}:/usr/lib \
                   -L${DESTDIR}${SHLIBDIR}
   .elif ${SHLIBINSTALLDIR} != ${LIBDIR}
   _PROGLDOPTS+=   -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR}:${DESTDIR}/usr/lib \
                   -L${DESTDIR}${SHLIBINSTALLDIR}
   .endif
   
   .if defined(PROG_CXX)
   _CCLINK=        ${CXX}
   _SUPCXX=        -lstdc++ -lm
   .else
   _CCLINK=        ${CC}
 .endif  .endif
   
 .if     !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \  .gdbinit:
         !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \          rm -f .gdbinit
         !defined(MAN7) && !defined(MAN8)  .if defined(DESTDIR) && !empty(DESTDIR)
 MAN1=   ${PROG}.0          echo "set solib-absolute-prefix ${DESTDIR}" > .gdbinit
   .else
           touch .gdbinit
 .endif  .endif
   .for __gdbinit in ${GDBINIT}
           echo "source ${__gdbinit}" >> .gdbinit
   .endfor
   
   .if defined(DESTDIR)
   
   ${PROG}: .gdbinit ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
   .if !commands(${PROG})
           ${_CCLINK} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostdlib ${_PROGLDOPTS} ${LIBCRT0} ${LIBCRTBEGIN} ${OBJS} ${LDADD} -L${_GCC_LIBGCCDIR} -L${DESTDIR}/usr/lib ${_SUPCXX} -lgcc -lc -lgcc ${LIBCRTEND}
 .endif  .endif
   
 .MAIN: all  .else
 all: ${PROG} _SUBDIRUSE  
   
 .if !target(clean)  ${PROG}: .gdbinit ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
 clean: _SUBDIRUSE  .if !commands(${PROG})
         rm -f a.out [Ee]rrs mklog core *.core ${PROG} ${OBJS} ${CLEANFILES}          ${_CCLINK} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${_PROGLDOPTS} ${OBJS} ${LDADD}
 .endif  .endif
   
 cleandir: _SUBDIRUSE clean  .endif  # defined(DESTDIR)
   .endif  # defined(OBJS) && !empty(OBJS)
   
   .if !defined(MAN)
   MAN=    ${PROG}.1
   .endif  # !defined(MAN)
   .endif  # defined(PROG)
   
 .if !target(install)  realall: ${PROG} ${SCRIPTS}
 .if !target(beforeinstall)  
 beforeinstall:  cleanprog: cleanobjs cleanextra
           rm -f a.out [Ee]rrs mklog core *.core .gdbinit ${PROG}
   
   cleanobjs:
   .if defined(OBJS) && !empty(OBJS)
           rm -f ${OBJS} ${LOBJS}
 .endif  .endif
 .if !target(afterinstall)  
 afterinstall:  cleanextra:
   .if defined(CLEANFILES) && !empty(CLEANFILES)
           rm -f ${CLEANFILES}
 .endif  .endif
   
 .if !target(realinstall)  .if defined(SRCS) && !target(afterdepend)
 realinstall:  afterdepend: .depend
 .if defined(PROG)          @(TMP=/tmp/_depend$$$$; \
         install ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \              sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.ln:/' \
             ${PROG} ${DESTDIR}${BINDIR}                < .depend > $$TMP; \
               mv $$TMP .depend)
 .endif  .endif
 .if defined(HIDEGAME)  
         (cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG})  .if defined(PROG) && !target(proginstall)
   PROGNAME?=${PROG}
   
   proginstall:: ${DESTDIR}${BINDIR}/${PROGNAME}
   .PRECIOUS: ${DESTDIR}${BINDIR}/${PROGNAME}
   
   __proginstall: .USE
           ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
                   ${STRIPFLAG} ${SYSPKGTAG} ${.ALLSRC} ${.TARGET}
   
   .if !defined(UPDATE)
   ${DESTDIR}${BINDIR}/${PROGNAME}! ${PROG} __proginstall
   .if !defined(BUILD) && !make(all) && !make(${PROG})
   ${DESTDIR}${BINDIR}/${PROGNAME}! .MADE
   .endif
   .else
   ${DESTDIR}${BINDIR}/${PROGNAME}: ${PROG} __proginstall
   .if !defined(BUILD) && !make(all) && !make(${PROG})
   ${DESTDIR}${BINDIR}/${PROGNAME}: .MADE
 .endif  .endif
 .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  .endif
   
 maninstall: afterinstall  .if !target(proginstall)
 afterinstall: realinstall  proginstall::
 realinstall: beforeinstall  
 .endif  .endif
   
 .if !target(lint)  .if defined(SCRIPTS) && !target(scriptsinstall)
 lint: ${SRCS} _SUBDIRUSE  SCRIPTSDIR?=${BINDIR}
 .if defined(PROG)  SCRIPTSOWN?=${BINOWN}
         @${LINT} ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | more 2>&1  SCRIPTSGRP?=${BINGRP}
   SCRIPTSMODE?=${BINMODE}
   
   scriptsinstall:: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
   .PRECIOUS: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
   
   __scriptinstall: .USE
           ${INSTALL_FILE} \
               -o ${SCRIPTSOWN_${.ALLSRC:T}:U${SCRIPTSOWN}} \
               -g ${SCRIPTSGRP_${.ALLSRC:T}:U${SCRIPTSGRP}} \
               -m ${SCRIPTSMODE_${.ALLSRC:T}:U${SCRIPTSMODE}} \
               ${SYSPKGTAG} ${.ALLSRC} ${.TARGET}
   
   .for S in ${SCRIPTS:O:u}
   .if !defined(UPDATE)
   ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! ${S} __scriptinstall
   .if !defined(BUILD) && !make(all) && !make(${S})
   ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! .MADE
   .endif
   .else
   ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: ${S} __scriptinstall
   .if !defined(BUILD) && !make(all) && !make(${S})
   ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: .MADE
   .endif
 .endif  .endif
   .endfor
 .endif  .endif
   
 .if !defined(NOMAN)  .if !target(scriptsinstall)
 .include <bsd.man.mk>  scriptsinstall::
 .endif  .endif
   
 .include <bsd.obj.mk>  lint: ${LOBJS}
   .if defined(LOBJS) && !empty(LOBJS)
           ${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD}
   .endif
   
   ##### Pull in related .mk logic
   .include <bsd.man.mk>
   .include <bsd.nls.mk>
   .include <bsd.files.mk>
   .include <bsd.inc.mk>
   .include <bsd.links.mk>
 .include <bsd.dep.mk>  .include <bsd.dep.mk>
 .include <bsd.subdir.mk>  .include <bsd.sys.mk>
   
   ${TARGETS}:     # ensure existence
   
   .endif  # HOSTPROG

Legend:
Removed from v.1.43  
changed lines
  Added in v.1.167

CVSweb <webmaster@jp.NetBSD.org>