[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.24 and 1.167

version 1.24, 1993/08/15 19:26:10 version 1.167, 2003/05/31 20:33:16
Line 1 
Line 1 
 #       @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91  #       $NetBSD$
   #       @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94
   
 .if exists(${.CURDIR}/../Makefile.inc)  .ifndef HOSTPROG
 .include "${.CURDIR}/../Makefile.inc"  
 .endif  
   
 .SUFFIXES: .out .o .c .cc .C .y .l .s .8 .7 .6 .5 .4 .3 .2 .1 .0  
   
 .8.0 .7.0 .6.0 .5.0 .4.0 .3.0 .2.0 .1.0:  .include <bsd.init.mk>
         nroff -mandoc ${.IMPSRC} > ${.TARGET}  .include <bsd.shlib.mk>
   .include <bsd.gcc.mk>
 CFLAGS+=${COPTS}  
   ##### Basic targets
 STRIP?=         -s  .PHONY:         cleanextra cleanobjs cleanprog proginstall scriptsinstall
   realinstall:    proginstall scriptsinstall
 BINGRP?=        bin  clean:          cleanprog
 BINOWN?=        bin  
 BINMODE?=       555  ##### Default values
   CPPFLAGS+=      ${DESTDIR:D-nostdinc ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include}
 LIBCRT0?=       /usr/lib/crt0.o  CXXFLAGS+=      ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include/g++}
 LIBC?=          /usr/lib/libc.a  CFLAGS+=        ${COPTS}
 LIBCOMPAT?=     /usr/lib/libcompat.a  .if ${MACHINE_ARCH} == "sparc64"
 .ifndef EXPORTABLE_SYSTEM  CFLAGS+=        -mcmodel=medlow
 LIBCRYPT?=      /usr/lib/libcrypt.a  .endif
 .endif  
 LIBCURSES?=     /usr/lib/libcurses.a  # ELF platforms depend on crti.o, crtbegin.o, crtend.o, and crtn.o
 LIBDBM?=        /usr/lib/libdbm.a  .if ${OBJECT_FMT} == "ELF"
 LIBDES?=        /usr/lib/libdes.a  .ifndef LIBCRTBEGIN
 LIBL?=          /usr/lib/libl.a  LIBCRTBEGIN=    ${DESTDIR}/usr/lib/crti.o ${_GCC_CRTBEGIN}
 LIBKDB?=        /usr/lib/libkdb.a  .MADE: ${LIBCRTBEGIN}
 LIBKRB?=        /usr/lib/libkrb.a  .endif
 LIBM?=          /usr/lib/libm.a  .ifndef LIBCRTEND
 LIBMP?=         /usr/lib/libmp.a  LIBCRTEND=      ${_GCC_CRTEND} ${DESTDIR}/usr/lib/crtn.o
 LIBPC?=         /usr/lib/libpc.a  .MADE: ${LIBCRTEND}
 LIBPLOT?=       /usr/lib/libplot.a  .endif
 LIBRESOLV?=     /usr/lib/libresolv.a  _SHLINKER=      ${SHLINKDIR}/ld.elf_so
 LIBRPC?=        /usr/lib/librpc.a  .else
 LIBRPCSVC?=     /usr/lib/librpcsvc.a  LIBCRTBEGIN?=
 LIBTERM?=       /usr/lib/libterm.a  LIBCRTEND?=
 LIBUTIL?=       /usr/lib/libutil.a  _SHLINKER=      ${SHLINKDIR}/ld.so
   .endif
   
   .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 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 TELNET 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 50  CLEANFILES+=strings
Line 75  CLEANFILES+=strings
         ${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
   
 .C.o:  .C.o:
         ${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c -          ${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c -
         @mv -f x.c x.C          @mv -f x.c x.C
         @${CXX} ${CXXFLAGS} -c x.C -o ${.TARGET}          @${CXX} ${CXXFLAGS} -c x.C -o ${.TARGET}
           @rm -f x.C
 .endif  .endif
   
 .if defined(PROG)  .if defined(PROG_CXX)
 .if defined(SRCS)  PROG=   ${PROG_CXX}
   .endif
   
 OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}  .if defined(PROG)
   .if defined(PROG_CXX)
   SRCS?=          ${PROG}.cc
   .else
   SRCS?=          ${PROG}.c
   .endif
   
 .if defined(LDONLY)  DPSRCS+=        ${SRCS:M*.[ly]:C/\..$/.c/}
   CLEANFILES+=    ${DPSRCS} ${YHEADER:D${SRCS:M*.y:.y=.h}}
   
 ${PROG}: ${LIBCRT0} ${LIBC} ${OBJS} ${DPADD}  .if !empty(SRCS:N*.h:N*.sh:N*.fth)
         ${LD} ${LDFLAGS} -o ${.TARGET} ${LIBCRT0} ${OBJS} ${LIBC} ${LDADD}  OBJS+=          ${SRCS:N*.h:N*.sh:N*.fth:R:S/$/.o/g}
   LOBJS+=         ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
   .endif
   
 .else defined(LDONLY)  .if defined(OBJS) && !empty(OBJS)
   .NOPATH: ${OBJS} ${PROG} ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
   
 ${PROG}: ${OBJS} ${LIBC} ${DPADD}  _PROGLDOPTS=
         ${CC} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}  .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 \
                   -Wl,-rpath,${SHLIBDIR}:/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}
   _SUPCXX=        -lstdc++ -lm
   .else
   _CCLINK=        ${CC}
 .endif  .endif
   
 .else defined(PROG)  .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
   
 SRCS= ${PROG}.c  .if defined(DESTDIR)
   
 ${PROG}: ${SRCS} ${LIBC} ${DPADD}  ${PROG}: .gdbinit ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
         ${CC} ${LDFLAGS} ${CFLAGS} -o ${.TARGET} ${.CURDIR}/${SRCS} ${LDADD}  .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
   
 MKDEP=  -p  .else
   
   ${PROG}: .gdbinit ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
   .if !commands(${PROG})
           ${_CCLINK} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${_PROGLDOPTS} ${OBJS} ${LDADD}
 .endif  .endif
   
 .if     !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \  .endif  # defined(DESTDIR)
         !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \  .endif  # defined(OBJS) && !empty(OBJS)
         !defined(MAN7) && !defined(MAN8)  
 MAN1=   ${PROG}.0  
 .endif  
 .endif  
   
 .if !defined(NOMAN)  .if !defined(MAN)
 MANALL= ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8}  MAN=    ${PROG}.1
 .endif  .endif  # !defined(MAN)
   .endif  # defined(PROG)
   
 _PROGSUBDIR: .USE  realall: ${PROG} ${SCRIPTS}
 .if defined(SUBDIR) && !empty(SUBDIR)  
         @for entry in ${SUBDIR}; do \  
                 (echo "===> $$entry"; \  
                 if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \  
                         cd ${.CURDIR}/$${entry}.${MACHINE}; \  
                 else \  
                         cd ${.CURDIR}/$${entry}; \  
                 fi; \  
                 ${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/}); \  
         done  
 .endif  
   
 .MAIN: all  cleanprog: cleanobjs cleanextra
 all: ${PROG} ${MANALL} _PROGSUBDIR          rm -f a.out [Ee]rrs mklog core *.core .gdbinit ${PROG}
   
 .if !target(clean)  cleanobjs:
 clean: _PROGSUBDIR  .if defined(OBJS) && !empty(OBJS)
         rm -f a.out [Ee]rrs mklog core ${PROG} ${OBJS} ${CLEANFILES}          rm -f ${OBJS} ${LOBJS}
 .endif  .endif
   
 .if !target(cleandir)  cleanextra:
 cleandir: _PROGSUBDIR  .if defined(CLEANFILES) && !empty(CLEANFILES)
         rm -f a.out [Ee]rrs mklog core ${PROG} ${OBJS} ${CLEANFILES}          rm -f ${CLEANFILES}
         rm -f .depend ${MANALL}  
 .endif  .endif
   
 # some of the rules involve .h sources, so remove them from mkdep line  .if defined(SRCS) && !target(afterdepend)
 .if !target(depend)  afterdepend: .depend
 depend: .depend _PROGSUBDIR          @(TMP=/tmp/_depend$$$$; \
 .depend: ${SRCS}              sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.ln:/' \
 .if defined(PROG)                < .depend > $$TMP; \
         rm -f .depend              mv $$TMP .depend)
         files="${.ALLSRC:M*.c}"; \  
         if [ "$$files" != "" ]; then \  
           mkdep -a ${MKDEP} ${CFLAGS:M-[ID]*} $$files; \  
         fi  
         files="${.ALLSRC:M*.cc} ${.ALLSRC:M*.C} ${.ALLSRC:M*.cxx}"; \  
         if [ "$$files" != "  " ]; then \  
           mkdep -a ${MKDEP} -+ ${CXXFLAGS:M-[ID]*} $$files; \  
         fi  
 .endif  
 .endif  .endif
   
 .if !target(install)  .if defined(PROG) && !target(proginstall)
 .if !target(beforeinstall)  PROGNAME?=${PROG}
 beforeinstall:  
 .if defined(DESTDIR) || defined(BINDIR)  
         @install -d -o root -g wheel -m 755 ${DESTDIR}${BINDIR}  
 .endif  
 .endif  
 .if !target(afterinstall)  
 afterinstall:  
 .endif  
   
 .if !target(realinstall)  proginstall:: ${DESTDIR}${BINDIR}/${PROGNAME}
 realinstall: _PROGSUBDIR  .PRECIOUS: ${DESTDIR}${BINDIR}/${PROGNAME}
 .if defined(PROG)  
         install ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \  __proginstall: .USE
             ${PROG} ${DESTDIR}${BINDIR}          ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
                   ${STRIPFLAG} ${SYSPKGTAG} ${.ALLSRC} ${.TARGET}
   
   .if !defined(UPDATE)
   ${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
             chown games.bin ${PROG})  .if !defined(BUILD) && !make(all) && !make(${PROG})
   ${DESTDIR}${BINDIR}/${PROGNAME}: .MADE
 .endif  .endif
 .endif  .endif
   
 install: maninstall  
 .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} _PROGSUBDIR  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 !defined(UPDATE)
   ${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 !target(tags)  .if !target(scriptsinstall)
 tags: ${SRCS} _PROGSUBDIR  scriptsinstall::
 .if defined(PROG)  
         -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC} | \  
             sed "s;\${.CURDIR}/;;" > tags  
 .endif  .endif
   
   lint: ${LOBJS}
   .if defined(LOBJS) && !empty(LOBJS)
           ${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD}
 .endif  .endif
   
 .if !defined(NOMAN)  ##### Pull in related .mk logic
 .include <bsd.man.mk>  .include <bsd.man.mk>
 .endif  .include <bsd.nls.mk>
   .include <bsd.files.mk>
   .include <bsd.inc.mk>
   .include <bsd.links.mk>
   .include <bsd.dep.mk>
   .include <bsd.sys.mk>
   
   ${TARGETS}:     # ensure existence
   
 .include <bsd.obj.mk>  .endif  # HOSTPROG
 obj: _PROGSUBDIR  

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

CVSweb <webmaster@jp.NetBSD.org>