[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.98 and 1.188

version 1.98, 1999/02/04 11:58:31 version 1.188, 2003/09/19 16:32:10
Line 1 
Line 1 
 #       $NetBSD$  #       $NetBSD$
 #       @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94  #       @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94
   
 .if !target(__initialized__)  .ifndef HOSTPROG
 __initialized__:  
 .if exists(${.CURDIR}/../Makefile.inc)  .include <bsd.init.mk>
 .include "${.CURDIR}/../Makefile.inc"  .include <bsd.shlib.mk>
 .endif  .include <bsd.gcc.mk>
 .include <bsd.own.mk>  
 .include <bsd.obj.mk>  .if defined(PROG_CXX)
 .MAIN:          all  PROG=   ${PROG_CXX}
 .endif  .endif
   
 .PHONY:         cleanprog proginstall scriptsinstall  ##### Basic targets
   .PHONY:         cleanextra cleanobjs cleanprog proginstall scriptsinstall
 realinstall:    proginstall scriptsinstall  realinstall:    proginstall scriptsinstall
 clean cleandir distclean: cleanprog  clean:          cleanprog
   
   ##### PROG specific flags.
   COPTS+=     ${COPTS.${PROG}}
   CPPFLAGS+=  ${CPPFLAGS.${PROG}}
   CXXFLAGS+=  ${CXXFLAGS.${PROG}}
   LDADD+=     ${LDADD.${PROG}}
   LDFLAGS+=   ${LDFLAGS.${PROG}}
   LDSTATIC+=  ${LDSTATIC.${PROG}}
   
   ##### 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}
   
 # ELF platforms depend on crtbegin.o and crtend.o  # ELF platforms depend on crti.o, crtbegin.o, crtend.o, and crtn.o
 .if (${OBJECT_FMT} == "ELF")  .if ${OBJECT_FMT} == "ELF"
 LIBCRTBEGIN?=   ${DESTDIR}/usr/lib/crtbegin.o  .ifndef LIBCRTBEGIN
 LIBCRTEND?=     ${DESTDIR}/usr/lib/crtend.o  LIBCRTBEGIN=    ${DESTDIR}/usr/lib/crti.o ${_GCC_CRTBEGIN}
   .MADE: ${LIBCRTBEGIN}
   .endif
   .ifndef LIBCRTEND
   LIBCRTEND=      ${_GCC_CRTEND} ${DESTDIR}/usr/lib/crtn.o
   .MADE: ${LIBCRTEND}
   .endif
   _SHLINKER=      ${SHLINKDIR}/ld.elf_so
 .else  .else
 LIBCRTBEGIN?=  LIBCRTBEGIN?=
 LIBCRTEND?=  LIBCRTEND?=
   _SHLINKER=      ${SHLINKDIR}/ld.so
 .endif  .endif
   
 LIBCRT0?=       ${DESTDIR}/usr/lib/crt0.o  .ifndef LIBCRT0
   LIBCRT0=        ${DESTDIR}/usr/lib/crt0.o
   .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 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
   # Note: ${DESTDIR} will be expanded in the following rule
   .MADE: ${LIB${_n}}
   .endif
   .endfor
   .undef __bsd_prog_mk_system_libs
   
 LIBBFD?=        ${DESTDIR}/usr/lib/libbfd.a  ##### Installed X11R6 library definitions
 LIBBZ2?=        ${DESTDIR}/usr/lib/libbz2.a  #     E.g. LIBX11?=${DESTDIR}/usr/X11R6/lib/libX11.a
 LIBC?=          ${DESTDIR}/usr/lib/libc.a  #     etc..
 LIBC_PIC?=      ${DESTDIR}/usr/lib/libc_pic.a  #
 LIBCOMPAT?=     ${DESTDIR}/usr/lib/libcompat.a  __bsd_prog_mk_x11r6_libs?= \
 LIBCRYPT?=      ${DESTDIR}/usr/lib/libcrypt.a          dps expat fntstubs fontcache fontconfig fontenc freetype FS \
 LIBCURSES?=     ${DESTDIR}/usr/lib/libcurses.a          GL GLU ICE lbxutil SM X11 Xau Xaw Xdmcp Xext Xfont Xft \
 LIBDBM?=        ${DESTDIR}/usr/lib/libdbm.a          Xi Xinerama xkbfile Xmu Xmuu Xpm Xrandr Xrender Xss Xt \
 LIBDES?=        ${DESTDIR}/usr/lib/libdes.a          XTrap Xtst Xv Xxf86dga Xxf86misc Xxf86vm
 LIBEDIT?=       ${DESTDIR}/usr/lib/libedit.a  
 LIBGCC?=        ${DESTDIR}/usr/lib/libgcc.a  .for _n in ${__bsd_prog_mk_x11r6_libs}
 LIBGNUMALLOC?=  ${DESTDIR}/usr/lib/libgnumalloc.a  .ifndef LIB${_n:tu}
 LIBKDB?=        ${DESTDIR}/usr/lib/libkdb.a  LIB${_n:tu}= ${DESTDIR}/usr/X11R6/lib/lib${_n}.a
 LIBKRB?=        ${DESTDIR}/usr/lib/libkrb.a  # Note: ${DESTDIR} will be expanded in the following rule
 LIBKVM?=        ${DESTDIR}/usr/lib/libkvm.a  .MADE: ${LIB${_n:tu}}
 LIBL?=          ${DESTDIR}/usr/lib/libl.a  .endif
 LIBM?=          ${DESTDIR}/usr/lib/libm.a  .endfor
 LIBMP?=         ${DESTDIR}/usr/lib/libmp.a  .undef __bsd_prog_mk_x11r6_libs
 LIBNTP?=        ${DESTDIR}/usr/lib/libntp.a  
 LIBOBJC?=       ${DESTDIR}/usr/lib/libobjc.a  
 LIBPC?=         ${DESTDIR}/usr/lib/libpc.a  
 LIBPCAP?=       ${DESTDIR}/usr/lib/libpcap.a  
 LIBPLOT?=       ${DESTDIR}/usr/lib/libplot.a  
 LIBPOSIX?=      ${DESTDIR}/usr/lib/libposix.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  
   
   ##### Build and install rules
 .if defined(SHAREDSTRINGS)  .if defined(SHAREDSTRINGS)
 CLEANFILES+=strings  CLEANFILES+=strings
 .c.o:  .c.o:
Line 69  CLEANFILES+=strings
Line 99  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)  .if defined(PROG)
   .if defined(PROG_CXX)
   SRCS?=          ${PROG}.cc
   .else
 SRCS?=          ${PROG}.c  SRCS?=          ${PROG}.c
   .endif
   
 DPSRCS+=        ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}  DPSRCS+=        ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
 CLEANFILES+=    ${DPSRCS}  DPSRCS+=        ${YHEADER:D${SRCS:M*.y:.y=.h}}
 .if defined(YHEADER)  CLEANFILES+=    ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
 CLEANFILES+=    ${SRCS:M*.y:.y=.h}  CLEANFILES+=    ${YHEADER:D${SRCS:M*.y:.y=.h}}
 .endif  
   
 .if !empty(SRCS:N*.h:N*.sh)  .if !empty(SRCS:N*.h:N*.sh:N*.fth)
 OBJS+=          ${SRCS:N*.h:N*.sh:R:S/$/.o/g}  OBJS+=          ${SRCS:N*.h:N*.sh:N*.fth:R:S/$/.o/g}
 LOBJS+=         ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}  LOBJS+=         ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
 .endif  .endif
   
 .if defined(OBJS) && !empty(OBJS)  .if defined(OBJS) && !empty(OBJS)
 .NOPATH: ${OBJS}  .NOPATH: ${OBJS} ${PROG} ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
 .if defined(DESTDIR)  
   
 ${PROG}: ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}  _PROGLDOPTS=
         ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostdlib -L${DESTDIR}/usr/lib ${LIBCRT0} ${LIBCRTBEGIN} ${OBJS} ${LDADD} -lgcc -lc -lgcc ${LIBCRTEND}  .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} != "/usr/lib"
   _PROGLDOPTS+=   -Wl,-rpath-link,${DESTDIR}${SHLIBDIR}:${DESTDIR}/usr/lib \
                   -R${SHLIBDIR} \
                   -L${DESTDIR}${SHLIBDIR}
   .elif ${SHLIBINSTALLDIR} != "/usr/lib"
   _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  .else
           touch .gdbinit
   .endif
   .for __gdbinit in ${GDBINIT}
           echo "source ${__gdbinit}" >> .gdbinit
   .endfor
   
 ${PROG}: ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}  ${OBJS} ${LOBJS}: ${DPSRCS}
         ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD}  
   
   ${PROG}: .gdbinit ${LIBCRT0} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
   .if !commands(${PROG})
   .if defined(DESTDIR)
           ${_CCLINK} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostdlib ${_PROGLDOPTS} ${LIBCRT0} ${LIBCRTBEGIN} ${OBJS} ${LDADD} -L${_GCC_LIBGCCDIR} -L${DESTDIR}/usr/lib ${_SUPCXX} -lgcc -lc -lgcc ${LIBCRTEND}
   .else
           ${_CCLINK} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${_PROGLDOPTS} ${OBJS} ${LDADD}
 .endif  # defined(DESTDIR)  .endif  # defined(DESTDIR)
   .endif  # !commands(${PROG})
   
   ${PROG}.ro: ${OBJS} ${DPADD}
           ${LD} -r -dc -o ${.TARGET} ${OBJS}
   
 .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)
   
 all: ${PROG}  realall: ${PROG} ${SCRIPTS}
   
   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
   
 cleanprog:  cleanextra:
         rm -f a.out [Ee]rrs mklog core *.core \  .if defined(CLEANFILES) && !empty(CLEANFILES)
             ${PROG} ${OBJS} ${LOBJS} ${CLEANFILES}          rm -f ${CLEANFILES}
   .endif
   
 .if defined(SRCS)  .if defined(SRCS) && !target(afterdepend)
 afterdepend: .depend  afterdepend: .depend
         @(TMP=/tmp/_depend$$$$; \          @(TMP=/tmp/_depend$$$$; trap 'rm -f $$TMP ; exit 1' 1 2 3 13 15; \
             sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.ln:/' \              sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.ln:/' \
               < .depend > $$TMP; \                < .depend > $$TMP; \
             mv $$TMP .depend)              mv $$TMP .depend)
 .endif  .endif
   
 .if defined(PROG) && !target(proginstall)  .if defined(PROG) && !target(proginstall)
 PROGNAME?= ${PROG}  PROGNAME?=${PROG}
   
 proginstall:: ${DESTDIR}${BINDIR}/${PROGNAME}  proginstall:: ${DESTDIR}${BINDIR}/${PROGNAME}
 .if !defined(UPDATE)  .PRECIOUS: ${DESTDIR}${BINDIR}/${PROGNAME}
 .PHONY: ${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(BUILD)  .else
   ${DESTDIR}${BINDIR}/${PROGNAME}: ${PROG} __proginstall
   .if !defined(BUILD) && !make(all) && !make(${PROG})
 ${DESTDIR}${BINDIR}/${PROGNAME}: .MADE  ${DESTDIR}${BINDIR}/${PROGNAME}: .MADE
 .endif  .endif
   .endif
 .PRECIOUS: ${DESTDIR}${BINDIR}/${PROGNAME}  
 ${DESTDIR}${BINDIR}/${PROGNAME}: ${PROG}  
         ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${STRIPFLAG} -o ${BINOWN} \  
             -g ${BINGRP} -m ${BINMODE} ${.ALLSRC} ${.TARGET}  
 .endif  .endif
   
 .if !target(proginstall)  .if !target(proginstall)
Line 156  SCRIPTSDIR?=${BINDIR}
Line 242  SCRIPTSDIR?=${BINDIR}
 SCRIPTSOWN?=${BINOWN}  SCRIPTSOWN?=${BINOWN}
 SCRIPTSGRP?=${BINGRP}  SCRIPTSGRP?=${BINGRP}
 SCRIPTSMODE?=${BINMODE}  SCRIPTSMODE?=${BINMODE}
 .for S in ${SCRIPTS}  
 SCRIPTSDIR_${S}?=${SCRIPTSDIR}  scriptsinstall:: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
 SCRIPTSOWN_${S}?=${SCRIPTSOWN}  .PRECIOUS: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
 SCRIPTSGRP_${S}?=${SCRIPTSGRP}  
 SCRIPTSMODE_${S}?=${SCRIPTSMODE}  __scriptinstall: .USE
 .if defined(SCRIPTSNAME)          ${INSTALL_FILE} \
 SCRIPTSNAME_${S} ?= ${SCRIPTSNAME}              -o ${SCRIPTSOWN_${.ALLSRC:T}:U${SCRIPTSOWN}} \
 .else              -g ${SCRIPTSGRP_${.ALLSRC:T}:U${SCRIPTSGRP}} \
 SCRIPTSNAME_${S} ?= ${S:T:R}              -m ${SCRIPTSMODE_${.ALLSRC:T}:U${SCRIPTSMODE}} \
 .endif              ${SYSPKGTAG} ${.ALLSRC} ${.TARGET}
 SCRIPTSDIR_${S} ?= ${SCRIPTSDIR}  
 scriptsinstall:: ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}}  .for S in ${SCRIPTS:O:u}
 .if !defined(UPDATE)  .if ${MKUPDATE} == "no"
 .PHONY: ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}}  ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! ${S} __scriptinstall
 .endif  .if !defined(BUILD) && !make(all) && !make(${S})
 .if !defined(BUILD)  ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! .MADE
 ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}}: .MADE  .endif
 .endif  .else
   ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: ${S} __scriptinstall
 .PRECIOUS: ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}}  .if !defined(BUILD) && !make(all) && !make(${S})
 ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}}: ${S}  ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: .MADE
         ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} -o ${SCRIPTSOWN_${S}} -g \  .endif
             ${SCRIPTSGRP_${S}} -m ${SCRIPTSMODE_${S}} ${.ALLSRC} ${.TARGET}  .endif
 .endfor  .endfor
 .endif  .endif
   
Line 191  lint: ${LOBJS}
Line 277  lint: ${LOBJS}
         ${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD}          ${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD}
 .endif  .endif
   
   ##### Pull in related .mk logic
 .include <bsd.man.mk>  .include <bsd.man.mk>
 .include <bsd.nls.mk>  .include <bsd.nls.mk>
 .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
   
 # Make sure all of the standard targets are defined, even if they do nothing.  .endif  # HOSTPROG
 regress:  

Legend:
Removed from v.1.98  
changed lines
  Added in v.1.188

CVSweb <webmaster@jp.NetBSD.org>