[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.44 and 1.266

version 1.44, 1994/06/30 05:31:21 version 1.266, 2011/08/27 18:35:20
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"  
 .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>
   # Definitions and targets shared among all programs built by a single
   # Makefile.
   ##### Basic targets
   realinstall:    proginstall scriptsinstall
   clean:          cleanprog
           rm -f .gdbinit
   .if defined(DESTDIR) && !empty(DESTDIR)
           echo "set solib-absolute-prefix ${DESTDIR}" > .gdbinit
           touch .gdbinit
   .for __gdbinit in ${GDBINIT}
           echo "source ${__gdbinit}" >> .gdbinit
 CFLAGS+=        ${COPTS}  cleanobjs: .PHONY
 LIBCRT0?=       /usr/lib/crt0.o  cleanprog: .PHONY cleanobjs cleanextra
 LIBC?=          /usr/lib/libc.a          rm -f a.out [Ee]rrs mklog core *.core .gdbinit
 LIBCOMPAT?=     /usr/lib/libcompat.a  
 LIBCRYPT?=      /usr/lib/libcrypt.a  
 LIBCURSES?=     /usr/lib/libcurses.a  
 LIBDBM?=        /usr/lib/libdbm.a  
 LIBDES?=        /usr/lib/libdes.a  
 LIBL?=          /usr/lib/libl.a  
 LIBKDB?=        /usr/lib/libkdb.a  
 LIBKRB?=        /usr/lib/libkrb.a  
 LIBKVM?=        /usr/lib/libkvm.a  
 LIBM?=          /usr/lib/libm.a  
 LIBMP?=         /usr/lib/libmp.a  
 LIBPC?=         /usr/lib/libpc.a  
 LIBPLOT?=       /usr/lib/libplot.a  
 LIBRESOLV?=     /usr/lib/libresolv.a  
 LIBRPCSVC?=     /usr/lib/librpcsvc.a  
 LIBSKEY?=       /usr/lib/libskey.a  
 LIBTERMCAP?=    /usr/lib/libtermcap.a  
 LIBUTIL?=       /usr/lib/libutil.a  
 .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:  .if defined(MKPIE) && (${MKPIE} != "no")
         ${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c -  CFLAGS+=        ${PIE_CFLAGS}
         @mv -f x.c x.C  AFLAGS+=        ${PIE_AFLAGS}
         @${CXX} ${CXXFLAGS} -c x.C -o ${.TARGET}  LDFLAGS+=       ${PIE_LDFLAGS}
         @rm -f x.C  
 .endif  .endif
   CFLAGS+=        ${COPTS}
   MKDEP_SUFFIXES?=        .o .ln
   # CTF preserve debug symbols
   .if defined(MKDTRACE) && (${MKDTRACE} != "no") && (${CFLAGS:M-g} != "")
   CTFFLAGS+= -g
   # ELF platforms depend on crti.o, crtbegin.o, crtend.o, and crtn.o
   .ifndef LIBCRTBEGIN
   LIBCRTBEGIN=    ${DESTDIR}/usr/lib/crti.o ${_GCC_CRTBEGIN}
   .ifndef LIBCRTEND
   LIBCRTEND=      ${_GCC_CRTEND} ${DESTDIR}/usr/lib/crtn.o
   _SHLINKER=      ${SHLINKDIR}/ld.elf_so
   .ifndef LIBCRT0
   LIBCRT0=        ${DESTDIR}/usr/lib/crt0.o
   .MADE: ${LIBCRT0}
   ##### Installed system library definitions
   #       E.g.
   #               LIBC?=${DESTDIR}/usr/lib/libc.a
   #               LIBX11?=${DESTDIR}/usr/X11R7/lib/libX11.a
   #       etc..
   .for _lib in \
           archive asn1 bluetooth bsdmalloc bz2 c c_pic cdk com_err compat \
           crypt crypto crypto_idea crypto_mdc2 crypto_rc5 \
           curses dbm des edit event \
           fetch form fl g2c gcc gnumalloc gssapi hdb heimbase heimntlm hx509 \
           intl ipsec \
           kadm5clnt kadm5srv kafs krb5 kvm l lber ldap ldap_r lua \
           m magic menu objc ossaudio pam pcap pci pmc posix pthread pthread_dbg \
           puffs radius resolv rmt roken rpcsvc rt rump rumpuser saslc skey sl ss \
           ssh ssl termcap usbhid util wrap y z bind9 dns lwres isccfg isccc isc \
           rumpfs_cd9660fs rumpfs_efs rumpfs_ext2fs rumpfs_ffs rumpfs_hfs \
           rumpfs_lfs rumpfs_msdosfs rumpfs_nfs rumpfs_ntfs rumpfs_syspuffs \
           rumpfs_tmpfs rumpfs_udf rumpfs_ufs \
   .ifndef LIB${_lib:tu}
   LIB${_lib:tu}=  ${DESTDIR}/usr/lib/lib${_lib}.a
   .MADE:          ${LIB${_lib:tu}}        # Note: ${DESTDIR} will be expanded
   # atf-c and atf-c++ are special cases because we cannot use [-+] as part of
   # make(1) variable names.  Just define them here.
   LIBATF_C=       ${DESTDIR}/usr/lib/libatf-c.a
   LIBATF_CXX=     ${DESTDIR}/usr/lib/libatf-c++.a
   .MADE:          ${LIBATF_C} ${LIBATF_CXX}
   # PAM applications, if linked statically, need more libraries
   .if (${MKPIC} == "no")
   .if (${MKCRYPTO} != "no")
   .if (${MKKERBEROS} != "no")
   PAM_STATIC_LDADD+= -lkafs -lkrb5 -lhx509 -lwind -lasn1 \
           -lroken -lcom_err -lheimbase -lcrypto
   .if (${MKSKEY} != "no")
   PAM_STATIC_LDADD+= -lskey
   PAM_STATIC_LDADD+= -lradius -lcrypt -lrpcsvc -lutil
   # These need + -> X transformations
   .ifndef LIBSTDCXX
   LIBSTDCXX=      ${DESTDIR}/usr/lib/libstdc++.a
   .MADE:          ${LIBSTDCXX}
   .ifndef LIBSUPCXX
   LIBSUPCXX=      ${DESTDIR}/usr/lib/libsupc++.a
   .MADE:          ${LIBSUPCXX}
   .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}${X11USRLIBDIR}/lib${_lib}.a
   .MADE:          ${LIB${_lib:tu}}        # Note: ${DESTDIR} will be expanded
   .if defined(RESCUEDIR)
   .if ${SHLINKDIR} != "/usr/libexec"      # XXX: change or remove if ld.so moves
   _PROGLDOPTS+=   -Wl,-dynamic-linker=${_SHLINKER}
   .if ${SHLIBDIR} != "/usr/lib"
   _PROGLDOPTS+=   -Wl,-rpath,${SHLIBDIR} \
   .elif ${SHLIBINSTALLDIR} != "/usr/lib"
   __proginstall: .USE
           ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
                   ${STRIPFLAG} ${.ALLSRC} ${.TARGET}
   __progrumpinstall: .USE
                   ${STRIPFLAG} ${.ALLSRC} ${.TARGET}
   __progdebuginstall: .USE
           ${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.
   .if defined(PROG_CXX)
   PROG=           ${PROG_CXX}
   _CCLINK=        ${CXX} ${_CCLINKFLAGS}
   .if defined(RUMPPRG)
   PROG=                   ${RUMPPRG}
   PROGS=                  ${RUMPPRG} rump.${RUMPPRG}
   . if defined(SRCS)
   SRCS.rump.${PROG}:=     ${SRCS} ${PROG}_rumpops.c ${RUMPSRCS}
   SRCS+=                  ${PROG}_hostops.c
   . else
   SRCS=                   ${PROG}.c ${PROG}_hostops.c
   SRCS.rump.${PROG}=      ${PROG}.c ${PROG}_rumpops.c ${RUMPSRCS}
   . endif
   DPSRCS+=                ${PROG}_rumpops.c ${RUMPSRCS}
   LDADD.rump.${PROG}+=    -lrumpclient
   MAN.rump.${PROG}=       # defined but feeling empty
   _RUMPINSTALL.rump.${PROG}=# defined
   PROGS=                  ${PROG}
   CPPFLAGS+=              -DCRUNCHOPS
 .if defined(PROG)  .if defined(PROG)
 SRCS?=  ${PROG}.c  _CCLINK?=       ${CC} ${_CCLINKFLAGS}
 OBJS+=  ${SRCS:N*.h:N*.sh:R:S/$/.o/g}  .  if defined(MAN)
   MAN.${PROG}=    ${MAN}
   _APPEND_MANS=   no
   .  endif
   .  if !defined(OBJS)
   OBJS=           ${OBJS.${PROG}}
   .  endif
   .  if defined(PROGNAME)
   .  endif
   .  if defined(SRCS)
   SRCS.${PROG}=   ${SRCS}
   _APPEND_SRCS=   no
   .  endif
   # Turn the single-program PROG and PROG_CXX variables into their multi-word
   # counterparts, PROGS and PROGS_CXX.
   .if !defined(RUMPPRG)
   .  if defined(PROG_CXX) && !defined(PROGS_CXX)
   PROGS_CXX=      ${PROG_CXX}
   .  elif defined(PROG) && !defined(PROGS)
   PROGS=          ${PROG}
   .  endif
 .if defined(LDONLY)  #
   # Per-program definitions and targets.
 ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD}  # Definitions specific to C programs.
         ${LD} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${LIBCRT0} ${OBJS} ${LIBC} ${LDADD}  .for _P in ${PROGS}
   SRCS.${_P}?=    ${_P}.c
   _CCLINK.${_P}=  ${CC} ${_CCLINKFLAGS}
 .else defined(LDONLY)  # Definitions specific to C++ programs.
   .for _P in ${PROGS_CXX}
   SRCS.${_P}?=    ${_P}.cc
 ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD}  # Language-independent definitions.
         ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD}  .for _P in ${PROGS} ${PROGS_CXX}                                        # {
   BINDIR.${_P}?=          ${BINDIR}
   PROGNAME.${_P}?=        ${_P}
   .if ${MKDEBUG} != "no" && !commands(${_P})
   _PROGDEBUG.${_P}:=      ${PROGNAME.${_P}}.debug
 .endif  .endif
 .if     !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \  .if defined(PAXCTL_FLAGS)
         !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \  PAXCTL_FLAGS.${_P}?= ${PAXCTL_FLAGS}
         !defined(MAN7) && !defined(MAN8)  
 MAN1=   ${PROG}.0  
 .endif  .endif
   ##### PROG specific flags.
   _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
 .MAIN: all  _YPSRCS.${_P}=  ${SRCS.${_P}:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS.${_P}:M*.y:.y=.h}}
 all: ${PROG} _SUBDIRUSE  
   DPSRCS+=                ${_YPSRCS.${_P}}
   CLEANFILES+=            ${_YPSRCS.${_P}}
 .if !target(clean)  .if !empty(SRCS.${_P}:N*.h:N*.sh:N*.fth)
 clean: _SUBDIRUSE  OBJS.${_P}+=    ${SRCS.${_P}:N*.h:N*.sh:N*.fth:R:S/$/.o/g}
         rm -f a.out [Ee]rrs mklog core *.core ${PROG} ${OBJS} ${CLEANFILES}  LOBJS.${_P}+=   ${LSRCS:.c=.ln} ${SRCS.${_P}:M*.c:.c=.ln}
 .endif  .endif
 cleandir: _SUBDIRUSE clean  .if defined(OBJS.${_P}) && !empty(OBJS.${_P})                   # {
   .NOPATH: ${OBJS.${_P}} ${_P} ${_YPSRCS.${_P}}
   ${OBJS.${_P}} ${LOBJS.${_P}}: ${DPSRCS}
 .if !target(install)  ${_P}: .gdbinit ${LIBCRT0} ${OBJS.${_P}} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
 .if !target(beforeinstall)  .if !commands(${_P})
 beforeinstall:          ${_MKTARGET_LINK}
           ${_CCLINK.${_P}} \
               ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} \
               ${OBJS.${_P}} ${_LDADD.${_P}} \
   .if defined(CTFMERGE)
           ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${_P}}
 .endif  .endif
 .if !target(afterinstall)  .if defined(PAXCTL_FLAGS.${_P})
 afterinstall:          ${PAXCTL} ${PAXCTL_FLAGS.${_P}} ${.TARGET}
 .endif  .endif
   .if ${MKSTRIPIDENT} != "no"
           ${OBJCOPY} -R .ident ${.TARGET}
   .endif  # !commands(${_P})
 .if !target(realinstall)  ${_P}.ro: ${OBJS.${_P}} ${DPADD}
 realinstall:          ${_MKTARGET_LINK}
 .if defined(PROG)          ${CC} ${LDFLAGS} -nostdlib -r -Wl,-dc -o ${.TARGET} ${OBJS.${_P}}
         install ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \  
             ${PROG} ${DESTDIR}${BINDIR}  .if defined(_PROGDEBUG.${_P})
   ${_PROGDEBUG.${_P}}: ${_P}
           (  ${OBJCOPY} --only-keep-debug ${_P} ${_PROGDEBUG.${_P}} \
           && ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \
                   --add-gnu-debuglink=${_PROGDEBUG.${_P}} ${_P} \
           ) || (rm -f ${_PROGDEBUG.${_P}}; false)
   .endif  # defined(OBJS.${_P}) && !empty(OBJS.${_P})                     # }
   .if !defined(MAN.${_P})
   MAN.${_P}=      ${_P}.1
   .endif  # !defined(MAN.${_P})
   .if !empty(_APPEND_MANS:M[Yy][Ee][Ss])
   MAN+=           ${MAN.${_P}}
   realall: ${_P} ${_PROGDEBUG.${_P}}
   cleanprog: cleanprog-${_P}
           rm -f ${_P} ${_PROGDEBUG.${_P}}
   .if defined(OBJS.${_P}) && !empty(OBJS.${_P})
   cleanobjs: cleanobjs-${_P}
           rm -f ${OBJS.${_P}} ${LOBJS.${_P}}
   _PROG_INSTALL+= proginstall-${_P}
   .if !target(proginstall-${_P})                                          # {
   proginstall-${_P}::     ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}} \
   .PRECIOUS:      ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}} \
   .if ${MKUPDATE} == "no"
   .if defined(_RUMPINSTALL.${_P})
   ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! ${_P} __progrumpinstall
   ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! ${_P} __proginstall
   .if !defined(BUILD) && !make(all) && !make(${_P})
   .if defined(_PROGDEBUG.${_P})
   ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}! ${_PROGDEBUG.${_P}} __progdebuginstall
   .if !defined(BUILD) && !make(all) && !make(${_P})
 .endif  .endif
 .if defined(HIDEGAME)  .endif  #  define(_PROGDEBUG.${_P})
         (cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG})  .else   # MKUPDATE != no
   .if defined(_RUMPINSTALL.${_P})
   ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: ${_P} __progrumpinstall
   ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: ${_P} __proginstall
 .endif  .endif
   .if !defined(BUILD) && !make(all) && !make(${_P})
 .endif  .endif
   .if defined(_PROGDEBUG.${_P})
   ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}: ${_PROGDEBUG.${_P}} __progdebuginstall
   .if !defined(BUILD) && !make(all) && !make(${_P})
   .endif  #  defined(_PROGDEBUG.${_P})
   .endif  # MKUPDATE != no
   .endif  # !target(proginstall-${_P})                                    # }
 install: maninstall _SUBDIRUSE  lint: lint-${_P}
 .if defined(LINKS) && !empty(LINKS)  lint-${_P}: ${LOBJS.${_P}}
         @set ${LINKS}; \  .if defined(LOBJS.${_P}) && !empty(LOBJS.${_P})
         while test $$# -ge 2; do \          ${LINT} ${LINTFLAGS} ${_LDFLAGS.${_P}:C/-L[  ]*/-L/Wg:M-L*} ${LOBJS.${_P}} ${_LDADD.${_P}}
                 l=${DESTDIR}$$1; \  
                 shift; \  
                 t=${DESTDIR}$$1; \  
                 shift; \  
                 echo $$t -\> $$l; \  
                 rm -f $$t; \  
                 ln $$l $$t; \  
         done; true  
 .endif  .endif
 maninstall: afterinstall  .endfor # _P in ${PROGS} ${PROGS_CXX}                                   # }
 afterinstall: realinstall  
 realinstall: beforeinstall  .if defined(OBJS) && !empty(OBJS) && \
       (empty(PROGS) && empty(PROGS_CXX))
   cleanobjs: cleanobjs-plain
           rm -f ${OBJS} ${LOBJS}
 .endif  .endif
 .if !target(lint)  .if !target(proginstall)
 lint: ${SRCS} _SUBDIRUSE  proginstall:: ${_PROG_INSTALL}
 .if defined(PROG)  .endif
         @${LINT} ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | more 2>&1  .PHONY:         proginstall
   realall: ${SCRIPTS}
   .if defined(SCRIPTS) && !target(scriptsinstall)                         # {
   __scriptinstall: .USE
           ${INSTALL_FILE} \
               -o ${SCRIPTSOWN_${.ALLSRC:T}:U${SCRIPTSOWN}} \
               -g ${SCRIPTSGRP_${.ALLSRC:T}:U${SCRIPTSGRP}} \
               -m ${SCRIPTSMODE_${.ALLSRC:T}:U${SCRIPTSMODE}} \
               ${.ALLSRC} ${.TARGET}
   .for S in ${SCRIPTS:O:u}
   .if ${MKUPDATE} == "no"
   .if !defined(BUILD) && !make(all) && !make(${S})
   .if !defined(BUILD) && !make(all) && !make(${S})
 .endif  .endif
 .endif  .endif
   .endif                                                                  # }
 .if !defined(NOMAN)  .if !target(scriptsinstall)
 .include <bsd.man.mk>  scriptsinstall::
 .endif  .endif
   .PHONY:         scriptsinstall
 .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.sys.mk>
 .include <bsd.dep.mk>  .include <bsd.dep.mk>
 .include <bsd.subdir.mk>  .include <bsd.clang-analyze.mk>
   cleanextra: .PHONY
   .if defined(CLEANFILES) && !empty(CLEANFILES)
           rm -f ${CLEANFILES}
   ${TARGETS}:     # ensure existence
   .endif  # HOSTPROG

Removed from v.1.44  
changed lines
  Added in v.1.266

CVSweb <webmaster@jp.NetBSD.org>