[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.221.4.2 and 1.222

version 1.221.4.2, 2008/01/09 01:39:26 version 1.222, 2007/11/04 23:28:20
Line 7 
Line 7 
 .include <bsd.shlib.mk>  .include <bsd.shlib.mk>
 .include <bsd.gcc.mk>  .include <bsd.gcc.mk>
   
 #  .if defined(PROG_CXX)
 # Definitions and targets shared among all programs built by a single  PROG=   ${PROG_CXX}
 # Makefile.  
 #  
   
 ##### Basic targets  
 realinstall:    proginstall scriptsinstall  
 clean:          cleanprog  
   
 .gdbinit:  
         rm -f .gdbinit  
 .if defined(DESTDIR) && !empty(DESTDIR)  
         echo "set solib-absolute-prefix ${DESTDIR}" > .gdbinit  
 .else  
         touch .gdbinit  
 .endif  .endif
 .for __gdbinit in ${GDBINIT}  
         echo "source ${__gdbinit}" >> .gdbinit  
 .endfor  
   
 cleanextra: .PHONY  .if defined(PAXCTL_FLAGS)
 .if defined(CLEANFILES) && !empty(CLEANFILES)  PAXCTL_FLAGS.${PROG}?= ${PAXCTL_FLAGS}
         rm -f ${CLEANFILES}  
 .endif  .endif
   
 cleanobjs: .PHONY  ##### Basic targets
   realinstall:    proginstall scriptsinstall
 cleanprog: .PHONY cleanobjs cleanextra  clean:          cleanprog
         rm -f a.out [Ee]rrs mklog core *.core .gdbinit  
   
 .if defined(SHAREDSTRINGS)  
 CLEANFILES+=strings  
 .c.o:  
         ${CC} -E ${CPPFLAGS} ${CFLAGS} ${.IMPSRC} | xstr -c -  
         @${CC} ${CPPFLAGS} ${CFLAGS} -c x.c -o ${.TARGET}  
         @rm -f x.c  
   
 .cc.o .cpp.o .cxx.o .C.o:  ##### PROG specific flags.
         ${CXX} -E ${CPPFLAGS} ${CXXFLAGS} ${.IMPSRC} | xstr -c -  COPTS+=     ${COPTS.${PROG}}
         @mv -f x.c x.cc  CPPFLAGS+=  ${CPPFLAGS.${PROG}}
         @${CXX} ${CPPFLAGS} ${CXXFLAGS} -c x.cc -o ${.TARGET}  CXXFLAGS+=  ${CXXFLAGS.${PROG}}
         @rm -f x.cc  OBJCOPTS+=  ${OBJCOPTS.${PROG}}
 .endif  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}
Line 146  LIB${_lib:tu}= ${DESTDIR}/usr/X11R6/lib/
Line 123  LIB${_lib:tu}= ${DESTDIR}/usr/X11R6/lib/
 .endif  .endif
 .endfor  .endfor
   
   
   ##### Build and install rules
   .if defined(SHAREDSTRINGS)
   CLEANFILES+=strings
   .c.o:
           ${CC} -E ${CPPFLAGS} ${CFLAGS} ${.IMPSRC} | xstr -c -
           @${CC} ${CPPFLAGS} ${CFLAGS} -c x.c -o ${.TARGET}
           @rm -f x.c
   
   .cc.o .cpp.o .cxx.o .C.o:
           ${CXX} -E ${CPPFLAGS} ${CXXFLAGS} ${.IMPSRC} | xstr -c -
           @mv -f x.c x.cc
           @${CXX} ${CPPFLAGS} ${CXXFLAGS} -c x.cc -o ${.TARGET}
           @rm -f x.cc
   .endif
   
   .if defined(PROG)                                                       # {
   .if defined(PROG_CXX)
   SRCS?=          ${PROG}.cc
   .else
   SRCS?=          ${PROG}.c
   .endif
   
   PROGNAME?=      ${PROG}
   
 .if defined(RESCUEDIR)  .if defined(RESCUEDIR)
 CPPFLAGS+=      -DRESCUEDIR=\"${RESCUEDIR}\"  CPPFLAGS+=      -DRESCUEDIR=\"${RESCUEDIR}\"
 .endif  .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)
   OBJS+=          ${SRCS:N*.h:N*.sh:N*.fth:R:S/$/.o/g}
   LOBJS+=         ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
   .endif
   
   .if defined(OBJS) && !empty(OBJS)                                       # {
   .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"
Line 165  _PROGLDOPTS+= -Wl,-rpath-link,${DESTDIR}
Line 180  _PROGLDOPTS+= -Wl,-rpath-link,${DESTDIR}
                 -L${DESTDIR}${SHLIBINSTALLDIR}                  -L${DESTDIR}${SHLIBINSTALLDIR}
 .endif  .endif
   
 __proginstall: .USE  
         ${_MKTARGET_INSTALL}  
         ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \  
                 ${STRIPFLAG} ${.ALLSRC} ${.TARGET}  
   
 __progdebuginstall: .USE  
         ${_MKTARGET_INSTALL}  
         ${INSTALL_FILE} -o ${DEBUGOWN} -g ${DEBUGGRP} -m ${DEBUGMODE} \  
                 ${.ALLSRC} ${.TARGET}  
   
   
   
 #  
 # Backwards compatibility with Makefiles that assume that bsd.prog.mk  
 # can only build a single binary.  
 #  
   
 _APPEND_MANS=yes  
 _APPEND_SRCS=yes  
   
 .if defined(PROG_CXX)  .if defined(PROG_CXX)
 PROG=           ${PROG_CXX}  _CCLINK=        ${CXX}
 _CCLINK=        ${CXX} # XXX Some Makefiles rely on this being public.  .else
 .endif  _CCLINK=        ${CC}
   
 .if defined(PROG)  
 _CCLINK?=       ${CC} # XXX Some Makefiles rely on this being public.  
 .  if defined(MAN)  
 MAN.${PROG}=    ${MAN}  
 _APPEND_MANS=   no  
 .  endif  
 .  if !defined(OBJS)  
 OBJS=           ${OBJS.${PROG}}  
 .  endif  
 .  if defined(PROGNAME)  
 PROGNAME.${PROG}=       ${PROGNAME}  
 .  endif  
 .  if defined(SRCS)  
 SRCS.${PROG}=   ${SRCS}  
 _APPEND_SRCS=   no  
 .  endif  
 .endif  
   
 # Turn the single-program PROG and PROG_CXX variables into their multi-word  
 # counterparts, PROGS and PROGS_CXX.  
 .if defined(PROG_CXX) && !defined(PROGS_CXX)  
 PROGS_CXX=      ${PROG_CXX}  
 .elif defined(PROG) && !defined(PROGS)  
 PROGS=          ${PROG}  
 .endif  
   
   
   
 #  
 # Per-program definitions and targets.  
 #  
   
 # Definitions specific to C programs.  
 .for _P in ${PROGS}  
 SRCS.${_P}?=    ${_P}.c  
 _CCLINK.${_P}=  ${CC}  
 .endfor  
   
 # Definitions specific to C++ programs.  
 .for _P in ${PROGS_CXX}  
 SRCS.${_P}?=    ${_P}.cc  
 _CCLINK.${_P}=  ${CXX}  
 .endfor  
   
 # Language-independent definitions.  
 .for _P in ${PROGS} ${PROGS_CXX}                                        # {  
   
 BINDIR.${_P}?=          ${BINDIR}  
 PROGNAME.${_P}?=        ${_P}  
   
 .if ${MKDEBUG} != "no" && ${OBJECT_FMT} == "ELF" && !commands(${_P})  
 _PROGDEBUG.${_P}:=      ${PROGNAME.${_P}}.debug  
 .endif  
   
 .if defined(PAXCTL_FLAGS)  
 PAXCTL_FLAGS.${_P}?= ${PAXCTL_FLAGS}  
 .endif  .endif
   
 ##### PROG specific flags.  .if ${MKDEBUG} != "no" && ${OBJECT_FMT} == "ELF" && !commands(${PROG})
 COPTS+=     ${COPTS.${_P}}  _PROGDEBUG=     ${PROGNAME}.debug
 CPPFLAGS+=  ${CPPFLAGS.${_P}}  
 CXXFLAGS+=  ${CXXFLAGS.${_P}}  
 OBJCOPTS+=  ${OBJCOPTS.${_P}}  
 LDADD+=     ${LDADD.${_P}}  
 LDFLAGS+=   ${LDFLAGS.${_P}}  
 LDSTATIC+=  ${LDSTATIC.${_P}}  
   
 _COPTS.${_P}=           ${COPTS}    ${COPTS.${_P}}  
 _CPPFLAGS.${_P}=        ${CPPFLAGS} ${CPPFLAGS.${_P}}  
 _CXXFLAGS.${_P}=        ${CXXFLAGS} ${CXXFLAGS.${_P}}  
 _OBJCOPTS.${_P}=        ${OBJCOPTS} ${OBJCOPTS.${_P}}  
 _LDADD.${_P}=           ${LDADD}    ${LDADD.${_P}}  
 _LDFLAGS.${_P}=         ${LDFLAGS}  ${LDFLAGS.${_P}}  
 _LDSTATIC.${_P}=        ${LDSTATIC} ${LDSTATIC.${_P}}  
   
 ##### Build and install rules  
 .if !empty(_APPEND_SRCS:M[Yy][Ee][Ss])  
 SRCS+=          ${SRCS.${_P}} # For bsd.dep.mk  
 .endif  .endif
   
 _YPSRCS.${_P}=  ${SRCS.${_P}:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS.${_P}:M*.y:.y=.h}}  .gdbinit:
           rm -f .gdbinit
 DPSRCS+=                ${_YPSRCS.${_P}}  .if defined(DESTDIR) && !empty(DESTDIR)
 CLEANFILES+=            ${_YPSRCS.${_P}}          echo "set solib-absolute-prefix ${DESTDIR}" > .gdbinit
   .else
 .if !empty(SRCS.${_P}:N*.h:N*.sh:N*.fth)          touch .gdbinit
 OBJS.${_P}+=    ${SRCS.${_P}:N*.h:N*.sh:N*.fth:R:S/$/.o/g}  
 LOBJS.${_P}+=   ${LSRCS:.c=.ln} ${SRCS.${_P}:M*.c:.c=.ln}  
 .endif  .endif
   .for __gdbinit in ${GDBINIT}
           echo "source ${__gdbinit}" >> .gdbinit
   .endfor
   
 .if defined(OBJS.${_P}) && !empty(OBJS.${_P})                   # {  ${OBJS} ${LOBJS}: ${DPSRCS}
 .NOPATH: ${OBJS.${_P}} ${_P} ${_YPSRCS.${_P}}  
   
 ${OBJS.${_P}} ${LOBJS.${_P}}: ${DPSRCS}  
   
 ${_P}: .gdbinit ${LIBCRT0} ${OBJS.${_P}} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}  ${PROG}: .gdbinit ${LIBCRT0} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
 .if !commands(${_P})  .if !commands(${PROG})
         ${_MKTARGET_LINK}          ${_MKTARGET_LINK}
 .if defined(DESTDIR)  .if defined(DESTDIR)
         ${_CCLINK.${_P}} -Wl,-nostdlib \          ${_CCLINK} -Wl,-nostdlib \
             ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} ${_PROGLDOPTS} \              ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${_PROGLDOPTS} \
             -B${_GCC_CRTDIR}/ -B${DESTDIR}/usr/lib/  \              -B${_GCC_CRTDIR}/ -B${DESTDIR}/usr/lib/  \
             ${OBJS.${_P}} ${_LDADD.${_P}} \              ${OBJS} ${LDADD} \
             -L${_GCC_LIBGCCDIR} -L${DESTDIR}/usr/lib              -L${_GCC_LIBGCCDIR} -L${DESTDIR}/usr/lib
 .else  .else
         ${_CCLINK.${_P}} ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} ${_PROGLDOPTS} ${OBJS.${_P}} ${_LDADD.${_P}}          ${_CCLINK} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${_PROGLDOPTS} ${OBJS} ${LDADD}
 .endif  # defined(DESTDIR)  .endif  # defined(DESTDIR)
 .if defined(PAXCTL_FLAGS.${_P})  .if defined(PAXCTL_FLAGS.${PROG})
         ${PAXCTL} ${PAXCTL_FLAGS.${_P}} ${.TARGET}          ${PAXCTL} ${PAXCTL_FLAGS.${PROG}} ${.TARGET}
 .endif  .endif
 .endif  # !commands(${_P})  .endif  # !commands(${PROG})
   
 ${_P}.ro: ${OBJS.${_P}} ${DPADD}  ${PROG}.ro: ${OBJS} ${DPADD}
         ${_MKTARGET_LINK}          ${_MKTARGET_LINK}
         ${LD} -r -dc -o ${.TARGET} ${OBJS.${_P}}          ${LD} -r -dc -o ${.TARGET} ${OBJS}
   
 .if defined(_PROGDEBUG.${_P})  .if defined(_PROGDEBUG)
 ${_PROGDEBUG.${_P}}: ${_P}  ${_PROGDEBUG}: ${PROG}
         ${_MKTARGET_CREATE}          ${_MKTARGET_CREATE}
         ${OBJCOPY} --only-keep-debug ${_P} ${_PROGDEBUG.${_P}}          ${OBJCOPY} --only-keep-debug ${PROG} ${_PROGDEBUG}
         ${OBJCOPY} -R .gnu_debuglink --add-gnu-debuglink=${_PROGDEBUG.${_P}} ${_P} \          ${OBJCOPY} -R .gnu_debuglink --add-gnu-debuglink=${_PROGDEBUG} ${PROG} \
             || rm -f ${_PROGDEBUG.${_P}}              || rm -f ${_PROGDEBUG}
 .endif  .endif
   
 .endif  # defined(OBJS.${_P}) && !empty(OBJS.${_P})                     # }  .endif  # defined(OBJS) && !empty(OBJS)                                 # }
   
 .if !defined(MAN.${_P})  .if !defined(MAN)
 MAN.${_P}=      ${_P}.1  MAN=    ${PROG}.1
 .endif  # !defined(MAN.${_P})  .endif  # !defined(MAN)
 .if !empty(_APPEND_MANS:M[Yy][Ee][Ss])  .endif  # defined(PROG)                                                 # }
 MAN+=           ${MAN.${_P}}  
 .endif  realall: ${PROG} ${_PROGDEBUG} ${SCRIPTS}
   
 realall: ${_P} ${_PROGDEBUG.${_P}}  cleanprog: .PHONY cleanobjs cleanextra
           rm -f a.out [Ee]rrs mklog core *.core .gdbinit ${PROG} ${_PROGDEBUG}
   
 cleanprog: cleanprog-${_P}  cleanobjs: .PHONY
 cleanprog-${_P}:  .if defined(OBJS) && !empty(OBJS)
         rm -f ${_P} ${_PROGDEBUG.${_P}}          rm -f ${OBJS} ${LOBJS}
   .endif
   
 .if defined(OBJS.${_P}) && !empty(OBJS.${_P})  cleanextra: .PHONY
 cleanobjs: cleanobjs-${_P}  .if defined(CLEANFILES) && !empty(CLEANFILES)
 cleanobjs-${_P}:          rm -f ${CLEANFILES}
         rm -f ${OBJS.${_P}} ${LOBJS.${_P}}  
 .endif  .endif
   
 _PROG_INSTALL+= proginstall-${_P}  .if defined(PROG) && !target(proginstall)                               # {
   
   proginstall::   ${DESTDIR}${BINDIR}/${PROGNAME} ${_PROGDEBUG:D${DESTDIR}${DEBUGDIR}${BINDIR}/${_PROGDEBUG}}
   .PRECIOUS:      ${DESTDIR}${BINDIR}/${PROGNAME} ${_PROGDEBUG:D${DESTDIR}${DEBUGDIR}${BINDIR}/${_PROGDEBUG}}
   
   __proginstall: .USE
           ${_MKTARGET_INSTALL}
           ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
                   ${STRIPFLAG} ${.ALLSRC} ${.TARGET}
   
 .if !target(proginstall-${_P})                                          # {  __progdebuginstall: .USE
 proginstall-${_P}::     ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}} \          ${_MKTARGET_INSTALL}
                 ${_PROGDEBUG.${_P}:D${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}}          ${INSTALL_FILE} -o ${DEBUGOWN} -g ${DEBUGGRP} -m ${DEBUGMODE} \
 .PRECIOUS:      ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}} \                  ${.ALLSRC} ${.TARGET}
                 ${_PROGDEBUG.${_P}:D${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}}  
   
 .if ${MKUPDATE} == "no"  .if ${MKUPDATE} == "no"
 ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! ${_P} __proginstall  ${DESTDIR}${BINDIR}/${PROGNAME}! ${PROG} __proginstall
 .if !defined(BUILD) && !make(all) && !make(${_P})  .if !defined(BUILD) && !make(all) && !make(${PROG})
 ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! .MADE  ${DESTDIR}${BINDIR}/${PROGNAME}! .MADE
 .endif  .endif
 .if defined(_PROGDEBUG.${_P})  .if defined(_PROGDEBUG)
 ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}! ${_PROGDEBUG.${_P}} __progdebuginstall  ${DESTDIR}${DEBUGDIR}${BINDIR}/${_PROGDEBUG}! ${_PROGDEBUG} __progdebuginstall
 .if !defined(BUILD) && !make(all) && !make(${_P})  .if !defined(BUILD) && !make(all) && !make(${PROG})
 ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}! .MADE  ${DESTDIR}${DEBUGDIR}${BINDIR}/${_PROGDEBUG}! .MADE
 .endif  .endif
 .endif  #  define(_PROGDEBUG.${_P})  .endif  #  define(_PROGDEBUG)
 .else   # MKUPDATE != no  .else   # MKUPDATE != no
 ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: ${_P} __proginstall  ${DESTDIR}${BINDIR}/${PROGNAME}: ${PROG} __proginstall
 .if !defined(BUILD) && !make(all) && !make(${_P})  .if !defined(BUILD) && !make(all) && !make(${PROG})
 ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: .MADE  ${DESTDIR}${BINDIR}/${PROGNAME}: .MADE
 .endif  .endif
 .if defined(_PROGDEBUG.${_P})  .if defined(_PROGDEBUG)
 ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}: ${_PROGDEBUG.${_P}} __progdebuginstall  ${DESTDIR}${DEBUGDIR}${BINDIR}/${_PROGDEBUG}: ${_PROGDEBUG} __progdebuginstall
 .if !defined(BUILD) && !make(all) && !make(${_P})  .if !defined(BUILD) && !make(all) && !make(${PROG})
 ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}: .MADE  ${DESTDIR}${DEBUGDIR}${BINDIR}/${_PROGDEBUG}: .MADE
 .endif  .endif
 .endif  #  defined(_PROGDEBUG.${_P})  .endif  #  defined(_PROGDEBUG)
 .endif  # MKUPDATE != no  .endif  # MKUPDATE != no
   
 .endif  # !target(proginstall-${_P})                                    # }  .endif  # defined(PROG) && !target(proginstall)                         # }
   
 lint: lint-${_P}  
 lint-${_P}: ${LOBJS.${_P}}  
 .if defined(LOBJS.${_P}) && !empty(LOBJS.${_P})  
         ${LINT} ${LINTFLAGS} ${_LDFLAGS.${_P}:C/-L[  ]*/-L/Wg:M-L*} ${LOBJS.${_P}} ${_LDADD.${_P}}  
 .endif  
   
 .endfor # _P in ${PROGS} ${PROGS_CXX}                                   # }  
   
 .if defined(OBJS) && !empty(OBJS) && \  
     (empty(PROGS) && empty(PROGS_CXX))  
 cleanobjs: cleanobjs-plain  
 cleanobjs-plain:  
         rm -f ${OBJS} ${LOBJS}  
 .endif  
   
 .if !target(proginstall)  .if !target(proginstall)
 proginstall:: ${_PROG_INSTALL}  proginstall::
 .endif  .endif
 .PHONY:         proginstall  .PHONY:         proginstall
   
   
   
 realall: ${SCRIPTS}  
 .if defined(SCRIPTS) && !target(scriptsinstall)                         # {  .if defined(SCRIPTS) && !target(scriptsinstall)                         # {
 SCRIPTSDIR?=${BINDIR}  SCRIPTSDIR?=${BINDIR}
 SCRIPTSOWN?=${BINOWN}  SCRIPTSOWN?=${BINOWN}
Line 429  scriptsinstall::
Line 337  scriptsinstall::
 .endif  .endif
 .PHONY:         scriptsinstall  .PHONY:         scriptsinstall
   
   lint: ${LOBJS}
   .if defined(LOBJS) && !empty(LOBJS)
           ${LINT} ${LINTFLAGS} ${LDFLAGS:C/-L[  ]*/-L/Wg:M-L*} ${LOBJS} ${LDADD}
   .endif
   
 ##### Pull in related .mk logic  ##### Pull in related .mk logic
 .include <bsd.man.mk>  .include <bsd.man.mk>
 .include <bsd.nls.mk>  .include <bsd.nls.mk>

Legend:
Removed from v.1.221.4.2  
changed lines
  Added in v.1.222

CVSweb <webmaster@jp.NetBSD.org>