[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.50 and 1.177

version 1.50, 1995/04/21 20:29:42 version 1.177, 2003/07/28 08:53:55
Line 1 
Line 1 
 #       $NetBSD$  #       $NetBSD$
 #       @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91  #       @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94
   
 .if exists(${.CURDIR}/../Makefile.inc)  .ifndef HOSTPROG
 .include "${.CURDIR}/../Makefile.inc"  
 .endif  
   
 .include <bsd.own.mk>  
   
 .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_ISYSTEMXX} ${DESTDIR}/usr/include/g++}
 CFLAGS+=        ${COPTS}  CFLAGS+=        ${COPTS}
   .if ${MACHINE_ARCH} == "sparc64"
   CFLAGS+=        -mcmodel=medlow
   .endif
   
 LIBCRT0?=       ${DESTDIR}/usr/lib/crt0.o  # ELF platforms depend on crti.o, crtbegin.o, crtend.o, and crtn.o
 LIBC?=          ${DESTDIR}/usr/lib/libc.a  .if ${OBJECT_FMT} == "ELF"
 LIBCOMPAT?=     ${DESTDIR}/usr/lib/libcompat.a  .ifndef LIBCRTBEGIN
 LIBCRYPT?=      ${DESTDIR}/usr/lib/libcrypt.a  LIBCRTBEGIN=    ${DESTDIR}/usr/lib/crti.o ${_GCC_CRTBEGIN}
 LIBCURSES?=     ${DESTDIR}/usr/lib/libcurses.a  .MADE: ${LIBCRTBEGIN}
 LIBDBM?=        ${DESTDIR}/usr/lib/libdbm.a  .endif
 LIBDES?=        ${DESTDIR}/usr/lib/libdes.a  .ifndef LIBCRTEND
 LIBGCC?=        ${DESTDIR}/usr/lib/libgcc.a  LIBCRTEND=      ${_GCC_CRTEND} ${DESTDIR}/usr/lib/crtn.o
 LIBL?=          ${DESTDIR}/usr/lib/libl.a  .MADE: ${LIBCRTEND}
 LIBKDB?=        ${DESTDIR}/usr/lib/libkdb.a  .endif
 LIBKRB?=        ${DESTDIR}/usr/lib/libkrb.a  _SHLINKER=      ${SHLINKDIR}/ld.elf_so
 LIBKVM?=        ${DESTDIR}/usr/lib/libkvm.a  .else
 LIBM?=          ${DESTDIR}/usr/lib/libm.a  LIBCRTBEGIN?=
 LIBMP?=         ${DESTDIR}/usr/lib/libmp.a  LIBCRTEND?=
 LIBPC?=         ${DESTDIR}/usr/lib/libpc.a  _SHLINKER=      ${SHLINKDIR}/ld.so
 LIBPLOT?=       ${DESTDIR}/usr/lib/libplot.a  .endif
 LIBRESOLV?=     ${DESTDIR}/usr/lib/libresolv.a  
 LIBRPCSVC?=     ${DESTDIR}/usr/lib/librpcsvc.a  .ifndef LIBCRT0
 LIBSKEY?=       ${DESTDIR}/usr/lib/libskey.a  LIBCRT0=        ${DESTDIR}/usr/lib/crt0.o
 LIBTERMCAP?=    ${DESTDIR}/usr/lib/libtermcap.a  .MADE: ${LIBCRT0}
 LIBUTIL?=       ${DESTDIR}/usr/lib/libutil.a  .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 EVENT 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 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 40  CLEANFILES+=strings
Line 71  CLEANFILES+=strings
         @${CC} ${CFLAGS} -c x.c -o ${.TARGET}          @${CC} ${CFLAGS} -c x.c -o ${.TARGET}
         @rm -f x.c          @rm -f x.c
   
 .cc.o:  .cc.o .cpp.o .cxx.o .C.o:
         ${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c -          ${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c -
         @mv -f x.c x.cc          @mv -f x.c x.cc
         @${CXX} ${CXXFLAGS} -c x.cc -o ${.TARGET}          @${CXX} ${CXXFLAGS} -c x.cc -o ${.TARGET}
         @rm -f x.cc          @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  .endif
   
   .if defined(PROG_CXX)
   PROG=   ${PROG_CXX}
   .endif
   
 .if defined(PROG)  .if defined(PROG)
 SRCS?=  ${PROG}.c  .if defined(PROG_CXX)
 .if !empty(SRCS:N*.h:N*.sh)  SRCS?=          ${PROG}.cc
 OBJS+=  ${SRCS:N*.h:N*.sh:R:S/$/.o/g}  .else
   SRCS?=          ${PROG}.c
   .endif
   
   DPSRCS+=        ${SRCS:M*.[ly]:C/\..$/.c/}
   CLEANFILES+=    ${DPSRCS} ${YHEADER:D${SRCS:M*.y:.y=.h}}
   
   .if !empty(SRCS:N*.h:N*.sh:N*.fth)
   OBJS+=          ${SRCS:N*.h:N*.sh:N*.fth:R:S/$/.o/g}
   LOBJS+=         ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
 .endif  .endif
   
 .if defined(OBJS) && !empty(OBJS)  .if defined(OBJS) && !empty(OBJS)
   .NOPATH: ${OBJS} ${PROG} ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
   
   _PROGLDOPTS=
   .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 \
                   -R${SHLIBDIR} -R/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}
   .if ${USE_LIBSTDCXX} == "no"
   _SUPCXX=        -lsupc++ -lm
   .else
   _SUPCXX=        -lstdc++ -lm
   .endif
   .else
   _CCLINK=        ${CC}
   .endif
   
   .gdbinit:
           rm -f .gdbinit
   .if defined(DESTDIR) && !empty(DESTDIR)
           echo "set solib-absolute-prefix ${DESTDIR}" > .gdbinit
   .else
           touch .gdbinit
   .endif
   .for __gdbinit in ${GDBINIT}
           echo "source ${__gdbinit}" >> .gdbinit
   .endfor
   
 .if defined(DESTDIR)  .if defined(DESTDIR)
   
 ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD}  ${PROG}: .gdbinit ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
         ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostdlib -L${DESTDIR}/usr/lib ${LIBCRT0} ${OBJS} ${LDADD} -lgcc -lc -lgcc  .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
   
 .else  .else
   
 ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD}  ${PROG}: .gdbinit ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
         ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD}  .if !commands(${PROG})
           ${_CCLINK} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${_PROGLDOPTS} ${OBJS} ${LDADD}
   .endif
   
 .endif  # defined(DESTDIR)  .endif  # defined(DESTDIR)
 .endif  # defined(OBJS) && !empty(OBJS)  .endif  # defined(OBJS) && !empty(OBJS)
   
 .if     !defined(MAN)  .if !defined(MAN)
 MAN=    ${PROG}.1  MAN=    ${PROG}.1
 .endif  # !defined(MAN)  .endif  # !defined(MAN)
 .endif  # defined(PROG)  .endif  # defined(PROG)
   
 .MAIN: all  realall: ${PROG} ${SCRIPTS}
 all: ${PROG} _SUBDIRUSE  
   
 .if !target(clean)  cleanprog: cleanobjs cleanextra
 clean: _SUBDIRUSE          rm -f a.out [Ee]rrs mklog core *.core .gdbinit ${PROG}
         rm -f a.out [Ee]rrs mklog core *.core ${PROG} ${OBJS} ${CLEANFILES}  
 .endif  
   
 cleandir: _SUBDIRUSE clean  cleanobjs:
   .if defined(OBJS) && !empty(OBJS)
           rm -f ${OBJS} ${LOBJS}
   .endif
   
 .if !target(install)  cleanextra:
 .if !target(beforeinstall)  .if defined(CLEANFILES) && !empty(CLEANFILES)
 beforeinstall:          rm -f ${CLEANFILES}
 .endif  .endif
 .if !target(afterinstall)  
 afterinstall:  .if defined(SRCS) && !target(afterdepend)
   afterdepend: .depend
           @(TMP=/tmp/_depend$$$$; trap 'rm -f $$TMP ; exit 1' 1 2 3 13 15; \
               sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.ln:/' \
                 < .depend > $$TMP; \
               mv $$TMP .depend)
 .endif  .endif
   
 .if !target(realinstall)  .if defined(PROG) && !target(proginstall)
 realinstall:  PROGNAME?=${PROG}
 .if defined(PROG)  
         install ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \  proginstall:: ${DESTDIR}${BINDIR}/${PROGNAME}
             ${PROG} ${DESTDIR}${BINDIR}  .PRECIOUS: ${DESTDIR}${BINDIR}/${PROGNAME}
   
   __proginstall: .USE
           ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
                   ${STRIPFLAG} ${SYSPKGTAG} ${.ALLSRC} ${.TARGET}
   
   .if ${MKUPDATE} == "no"
   ${DESTDIR}${BINDIR}/${PROGNAME}! ${PROG} __proginstall
   .if !defined(BUILD) && !make(all) && !make(${PROG})
   ${DESTDIR}${BINDIR}/${PROGNAME}! .MADE
 .endif  .endif
 .if defined(HIDEGAME)  .else
         (cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG})  ${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 ${MKUPDATE} == "no"
   ${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
   
 .if !defined(NONLS)  lint: ${LOBJS}
 .include <bsd.nls.mk>  .if defined(LOBJS) && !empty(LOBJS)
           ${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD}
 .endif  .endif
   
 .include <bsd.obj.mk>  ##### 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.50  
changed lines
  Added in v.1.177

CVSweb <webmaster@jp.NetBSD.org>