[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.167 and 1.213

version 1.167, 2003/05/31 20:33:16 version 1.213, 2006/06/09 19:16:36
Line 7 
Line 7 
 .include <bsd.shlib.mk>  .include <bsd.shlib.mk>
 .include <bsd.gcc.mk>  .include <bsd.gcc.mk>
   
   .if defined(PROG_CXX)
   PROG=   ${PROG_CXX}
   .endif
   
 ##### Basic targets  ##### Basic targets
 .PHONY:         cleanextra cleanobjs cleanprog proginstall scriptsinstall  
 realinstall:    proginstall scriptsinstall  realinstall:    proginstall scriptsinstall
 clean:          cleanprog  clean:          cleanprog
   
   ##### PROG specific flags.
   COPTS+=     ${COPTS.${PROG}}
   CPPFLAGS+=  ${CPPFLAGS.${PROG}}
   CXXFLAGS+=  ${CXXFLAGS.${PROG}}
   OBJCOPTS+=  ${OBJCOPTS.${PROG}}
   LDADD+=     ${LDADD.${PROG}}
   LDFLAGS+=   ${LDFLAGS.${PROG}}
   LDSTATIC+=  ${LDSTATIC.${PROG}}
   
 ##### Default values  ##### Default values
 CPPFLAGS+=      ${DESTDIR:D-nostdinc ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include}  CPPFLAGS+=      ${DESTDIR:D-nostdinc ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include}
 CXXFLAGS+=      ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include/g++}  CXXFLAGS+=      ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEMXX} ${DESTDIR}/usr/include/g++}
 CFLAGS+=        ${COPTS}  CFLAGS+=        ${COPTS}
 .if ${MACHINE_ARCH} == "sparc64"  OBJCFLAGS+=     ${OBJCOPTS}
 CFLAGS+=        -mcmodel=medlow  MKDEP_SUFFIXES?=        .o .ln
 .endif  
   
 # ELF platforms depend on crti.o, crtbegin.o, crtend.o, and crtn.o  # ELF platforms depend on crti.o, crtbegin.o, crtend.o, and crtn.o
 .if ${OBJECT_FMT} == "ELF"  .if ${OBJECT_FMT} == "ELF"
Line 43  LIBCRT0= ${DESTDIR}/usr/lib/crt0.o
Line 54  LIBCRT0= ${DESTDIR}/usr/lib/crt0.o
 .endif  .endif
   
 ##### Installed system library definitions  ##### Installed system library definitions
 #     E.g. LIBC?=${DESTDIR}/usr/lib/libc.a  
 #     etc..  
 #  #
 __bsd_prog_mk_system_libs?= \  #       E.g.
         BZ2 C C_PIC CDK COM_ERR COMPAT CRYPT CRYPTO CRYPTO_IDEA CRYPTO_MDC2 \  #               LIBC?=${DESTDIR}/usr/lib/libc.a
         CRYPTO_RC5 \  #               LIBX11?=${DESTDIR}/usr/X11R6/lib/libX11.a
         CURSES DBM DES EDIT FORM GCC GNUMALLOC GSSAPI HDB INTL IPSEC \  #       etc..
         KADM KADM5CLNT KADM5SRV KAFS KDB KRB KRB5 KSTREAM KVM L M MENU \  
         OBJC OSSAUDIO PCAP PCI PMC POSIX PTHREAD PTHREAD_DBG RESOLV RMT \  .for _lib in \
         ROKEN RPCSVC RT SKEY SS SSL SL TERMCAP TELNET USBHID UTIL WRAP Y Z          asn1 bsdmalloc bz2 c c_pic cdk com_err compat crypt \
           crypto crypto_idea crypto_mdc2 crypto_rc5 \
 .for _n in ${__bsd_prog_mk_system_libs}          curses dbm des edit event \
 .ifndef LIB${_n}          form fl g2c gcc gnumalloc gssapi hdb intl ipsec \
 LIB${_n}= ${DESTDIR}/usr/lib/lib${_n:tl}.a          kadm5clnt kadm5srv kafs krb5 kvm l \
 # XXX - note that ${DESTDIR} will be expanded in the following rule          m magic menu objc ossaudio pam pcap pci pmc posix pthread pthread_dbg \
 .MADE: ${LIB${_n}}          radius resolv rmt roken rpcsvc rt skey sl ss ssh ssl termcap \
           usbhid util wrap y z
   .ifndef LIB${_lib:tu}
   LIB${_lib:tu}=  ${DESTDIR}/usr/lib/lib${_lib}.a
   .MADE:          ${LIB${_lib:tu}}        # Note: ${DESTDIR} will be expanded
   .endif
   .endfor
   
   # PAM applications, if linked statically, need more libraries
   .if (${MKPIC} == "no")
   .if (${MKCRYPTO} != "no")
   PAM_STATIC_LDADD+= -lssh
   PAM_STATIC_DPADD+= ${LIBSSH}
   .endif
   .if (${MKKERBEROS} != "no")
   PAM_STATIC_LDADD+= -lkafs -lkrb5 -lasn1 -lroken -lcom_err -lcrypto
   PAM_STATIC_DPADD+= ${LIBKAFS} ${LIBKRB5} ${LIBASN1} ${LIBROKEN} \
           ${LIBCOM_ERR} ${LIBCRYPTO}
   .endif
   .if (${MKSKEY} != "no")
   PAM_STATIC_LDADD+= -lskey
   PAM_STATIC_DPADD+= ${LIBSKEY}
   .endif
   PAM_STATIC_LDADD+= -lradius -lcrypt -lrpcsvc -lutil
   PAM_STATIC_DPADD+= ${LIBRADIUS} ${LIBCRYPT} ${LIBRPCSVC} ${LIBUTIL}
   .else
   PAM_STATIC_LDADD=
   PAM_STATIC_DPADD=
   .endif
   
   .ifndef LIBSTDCXX
   LIBSTDCXX=      ${DESTDIR}/usr/lib/libstdc++.a
   .MADE:          ${LIBSTDCXX}
   .endif
   
   .for _lib in \
           dps expat fntstubs fontcache fontconfig fontenc freetype FS \
           GL GLU ICE lbxutil SM X11 Xau Xaw Xdmcp Xext Xfont Xft \
           Xi Xinerama xkbfile Xmu Xmuu Xpm Xrandr Xrender Xss Xt \
           XTrap Xtst Xv Xxf86dga Xxf86misc Xxf86vm
   .ifndef LIB${_lib:tu}
   LIB${_lib:tu}=  ${DESTDIR}/usr/X11R6/lib/lib${_lib}.a
   .MADE:          ${LIB${_lib:tu}}        # Note: ${DESTDIR} will be expanded
 .endif  .endif
 .endfor  .endfor
 .undef __bsd_prog_mk_system_libs  
   
 ##### Build and install rules  ##### Build and install rules
 .if defined(SHAREDSTRINGS)  .if defined(SHAREDSTRINGS)
 CLEANFILES+=strings  CLEANFILES+=strings
 .c.o:  .c.o:
         ${CC} -E ${CFLAGS} ${.IMPSRC} | xstr -c -          ${CC} -E ${CPPFLAGS} ${CFLAGS} ${.IMPSRC} | xstr -c -
         @${CC} ${CFLAGS} -c x.c -o ${.TARGET}          @${CC} ${CPPFLAGS} ${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 ${CPPFLAGS} ${CXXFLAGS} ${.IMPSRC} | xstr -c -
         @mv -f x.c x.cc          @mv -f x.c x.cc
         @${CXX} ${CXXFLAGS} -c x.cc -o ${.TARGET}          @${CXX} ${CPPFLAGS} ${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  
   
 .if defined(PROG_CXX)  
 PROG=   ${PROG_CXX}  
 .endif  .endif
   
 .if defined(PROG)  .if defined(PROG)
Line 95  SRCS?=  ${PROG}.cc
Line 136  SRCS?=  ${PROG}.cc
 SRCS?=          ${PROG}.c  SRCS?=          ${PROG}.c
 .endif  .endif
   
 DPSRCS+=        ${SRCS:M*.[ly]:C/\..$/.c/}  .if defined(RESCUEDIR)
 CLEANFILES+=    ${DPSRCS} ${YHEADER:D${SRCS:M*.y:.y=.h}}  CPPFLAGS+=      -DRESCUEDIR=\"${RESCUEDIR}\"
   .endif
   
   _YPSRCS=        ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
   
   DPSRCS+=        ${_YPSRCS}
   CLEANFILES+=    ${_YPSRCS}
   
 .if !empty(SRCS:N*.h:N*.sh:N*.fth)  .if !empty(SRCS:N*.h:N*.sh:N*.fth)
 OBJS+=          ${SRCS:N*.h:N*.sh:N*.fth:R:S/$/.o/g}  OBJS+=          ${SRCS:N*.h:N*.sh:N*.fth:R:S/$/.o/g}
Line 104  LOBJS+=  ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=
Line 151  LOBJS+=  ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=
 .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}}  .NOPATH: ${OBJS} ${PROG} ${_YPSRCS}
   
 _PROGLDOPTS=  _PROGLDOPTS=
 .if ${SHLINKDIR} != "/usr/libexec"      # XXX: change or remove if ld.so moves  .if ${SHLINKDIR} != "/usr/libexec"      # XXX: change or remove if ld.so moves
 .if ${OBJECT_FMT} == "ELF"  .if ${OBJECT_FMT} == "ELF"
 _PROGLDOPTS+=   -Wl,-dynamic-linker=${_SHLINKER}  _PROGLDOPTS+=   -Wl,-dynamic-linker=${_SHLINKER}
 .endif  .endif
 .if ${OBJECT_FMT} == "a.out"  
 LIBCRT0=        ${DESTDIR}/lib/crt0.o  
 .endif  
 .endif  .endif
 .if ${SHLIBDIR} != ${LIBDIR}  .if ${SHLIBDIR} != "/usr/lib"
 _PROGLDOPTS+=   -Wl,-rpath-link,${DESTDIR}${SHLIBDIR}:${DESTDIR}/usr/lib \  _PROGLDOPTS+=   -Wl,-rpath-link,${DESTDIR}${SHLIBDIR}:${DESTDIR}/usr/lib \
                 -Wl,-rpath,${SHLIBDIR}:/usr/lib \                  -R${SHLIBDIR} \
                 -L${DESTDIR}${SHLIBDIR}                  -L${DESTDIR}${SHLIBDIR}
 .elif ${SHLIBINSTALLDIR} != ${LIBDIR}  .elif ${SHLIBINSTALLDIR} != "/usr/lib"
 _PROGLDOPTS+=   -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR}:${DESTDIR}/usr/lib \  _PROGLDOPTS+=   -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR}:${DESTDIR}/usr/lib \
                 -L${DESTDIR}${SHLIBINSTALLDIR}                  -L${DESTDIR}${SHLIBINSTALLDIR}
 .endif  .endif
   
 .if defined(PROG_CXX)  .if defined(PROG_CXX)
 _CCLINK=        ${CXX}  _CCLINK=        ${CXX}
   .if ${USE_LIBSTDCXX} == "no"
   _SUPCXX=        -lsupc++ -lm
   .else
 _SUPCXX=        -lstdc++ -lm  _SUPCXX=        -lstdc++ -lm
   .endif
 .else  .else
 _CCLINK=        ${CC}  _CCLINK=        ${CC}
 .endif  .endif
Line 142  _CCLINK= ${CC}
Line 190  _CCLINK= ${CC}
         echo "source ${__gdbinit}" >> .gdbinit          echo "source ${__gdbinit}" >> .gdbinit
 .endfor  .endfor
   
 .if defined(DESTDIR)  ${OBJS} ${LOBJS}: ${DPSRCS}
   
 ${PROG}: .gdbinit ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}  ${PROG}: .gdbinit ${LIBCRT0} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
 .if !commands(${PROG})  .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}          ${_MKTARGET_LINK}
 .endif  .if defined(DESTDIR)
           ${_CCLINK} -Wl,-nostdlib \
               ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${_PROGLDOPTS} \
               -B${_GCC_CRTDIR}/ -B${DESTDIR}/usr/lib/  \
               ${OBJS} ${LDADD} \
               -L${_GCC_LIBGCCDIR} -L${DESTDIR}/usr/lib
 .else  .else
   
 ${PROG}: .gdbinit ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}  
 .if !commands(${PROG})  
         ${_CCLINK} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${_PROGLDOPTS} ${OBJS} ${LDADD}          ${_CCLINK} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${_PROGLDOPTS} ${OBJS} ${LDADD}
 .endif  
   
 .endif  # defined(DESTDIR)  .endif  # defined(DESTDIR)
   .endif  # !commands(${PROG})
   
   ${PROG}.ro: ${OBJS} ${DPADD}
           ${_MKTARGET_LINK}
           ${LD} -r -dc -o ${.TARGET} ${OBJS}
   
 .endif  # defined(OBJS) && !empty(OBJS)  .endif  # defined(OBJS) && !empty(OBJS)
   
 .if !defined(MAN)  .if !defined(MAN)
Line 166  MAN= ${PROG}.1
Line 219  MAN= ${PROG}.1
   
 realall: ${PROG} ${SCRIPTS}  realall: ${PROG} ${SCRIPTS}
   
 cleanprog: cleanobjs cleanextra  cleanprog: .PHONY cleanobjs cleanextra
         rm -f a.out [Ee]rrs mklog core *.core .gdbinit ${PROG}          rm -f a.out [Ee]rrs mklog core *.core .gdbinit ${PROG}
   
 cleanobjs:  cleanobjs: .PHONY
 .if defined(OBJS) && !empty(OBJS)  .if defined(OBJS) && !empty(OBJS)
         rm -f ${OBJS} ${LOBJS}          rm -f ${OBJS} ${LOBJS}
 .endif  .endif
   
 cleanextra:  cleanextra: .PHONY
 .if defined(CLEANFILES) && !empty(CLEANFILES)  .if defined(CLEANFILES) && !empty(CLEANFILES)
         rm -f ${CLEANFILES}          rm -f ${CLEANFILES}
 .endif  .endif
   
 .if defined(SRCS) && !target(afterdepend)  
 afterdepend: .depend  
         @(TMP=/tmp/_depend$$$$; \  
             sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.ln:/' \  
               < .depend > $$TMP; \  
             mv $$TMP .depend)  
 .endif  
   
 .if defined(PROG) && !target(proginstall)  .if defined(PROG) && !target(proginstall)
 PROGNAME?=${PROG}  PROGNAME?=${PROG}
   
Line 194  proginstall:: ${DESTDIR}${BINDIR}/${PROG
Line 239  proginstall:: ${DESTDIR}${BINDIR}/${PROG
 .PRECIOUS: ${DESTDIR}${BINDIR}/${PROGNAME}  .PRECIOUS: ${DESTDIR}${BINDIR}/${PROGNAME}
   
 __proginstall: .USE  __proginstall: .USE
           ${_MKTARGET_INSTALL}
         ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \          ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
                 ${STRIPFLAG} ${SYSPKGTAG} ${.ALLSRC} ${.TARGET}                  ${STRIPFLAG} ${.ALLSRC} ${.TARGET}
   
 .if !defined(UPDATE)  .if ${MKUPDATE} == "no"
 ${DESTDIR}${BINDIR}/${PROGNAME}! ${PROG} __proginstall  ${DESTDIR}${BINDIR}/${PROGNAME}! ${PROG} __proginstall
 .if !defined(BUILD) && !make(all) && !make(${PROG})  .if !defined(BUILD) && !make(all) && !make(${PROG})
 ${DESTDIR}${BINDIR}/${PROGNAME}! .MADE  ${DESTDIR}${BINDIR}/${PROGNAME}! .MADE
Line 213  ${DESTDIR}${BINDIR}/${PROGNAME}: .MADE
Line 259  ${DESTDIR}${BINDIR}/${PROGNAME}: .MADE
 .if !target(proginstall)  .if !target(proginstall)
 proginstall::  proginstall::
 .endif  .endif
   .PHONY:         proginstall
   
 .if defined(SCRIPTS) && !target(scriptsinstall)  .if defined(SCRIPTS) && !target(scriptsinstall)
 SCRIPTSDIR?=${BINDIR}  SCRIPTSDIR?=${BINDIR}
Line 224  scriptsinstall:: ${SCRIPTS:@S@${DESTDIR}
Line 271  scriptsinstall:: ${SCRIPTS:@S@${DESTDIR}
 .PRECIOUS: ${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  __scriptinstall: .USE
           ${_MKTARGET_INSTALL}
         ${INSTALL_FILE} \          ${INSTALL_FILE} \
             -o ${SCRIPTSOWN_${.ALLSRC:T}:U${SCRIPTSOWN}} \              -o ${SCRIPTSOWN_${.ALLSRC:T}:U${SCRIPTSOWN}} \
             -g ${SCRIPTSGRP_${.ALLSRC:T}:U${SCRIPTSGRP}} \              -g ${SCRIPTSGRP_${.ALLSRC:T}:U${SCRIPTSGRP}} \
             -m ${SCRIPTSMODE_${.ALLSRC:T}:U${SCRIPTSMODE}} \              -m ${SCRIPTSMODE_${.ALLSRC:T}:U${SCRIPTSMODE}} \
             ${SYSPKGTAG} ${.ALLSRC} ${.TARGET}              ${.ALLSRC} ${.TARGET}
   
 .for S in ${SCRIPTS:O:u}  .for S in ${SCRIPTS:O:u}
 .if !defined(UPDATE)  .if ${MKUPDATE} == "no"
 ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! ${S} __scriptinstall  ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! ${S} __scriptinstall
 .if !defined(BUILD) && !make(all) && !make(${S})  .if !defined(BUILD) && !make(all) && !make(${S})
 ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! .MADE  ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! .MADE
Line 248  ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDI
Line 296  ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDI
 .if !target(scriptsinstall)  .if !target(scriptsinstall)
 scriptsinstall::  scriptsinstall::
 .endif  .endif
   .PHONY:         scriptsinstall
   
 lint: ${LOBJS}  lint: ${LOBJS}
 .if defined(LOBJS) && !empty(LOBJS)  .if defined(LOBJS) && !empty(LOBJS)
         ${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD}          ${LINT} ${LINTFLAGS} ${LDFLAGS:C/-L[  ]*/-L/Wg:M-L*} ${LOBJS} ${LDADD}
 .endif  .endif
   
 ##### Pull in related .mk logic  ##### Pull in related .mk logic
Line 260  lint: ${LOBJS}
Line 309  lint: ${LOBJS}
 .include <bsd.files.mk>  .include <bsd.files.mk>
 .include <bsd.inc.mk>  .include <bsd.inc.mk>
 .include <bsd.links.mk>  .include <bsd.links.mk>
 .include <bsd.dep.mk>  
 .include <bsd.sys.mk>  .include <bsd.sys.mk>
   .include <bsd.dep.mk>
   
 ${TARGETS}:     # ensure existence  ${TARGETS}:     # ensure existence
   

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

CVSweb <webmaster@jp.NetBSD.org>