[BACK]Return to bsd.prog.mk CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / share / mk

Annotation of src/share/mk/bsd.prog.mk, Revision 1.146

1.146   ! thorpej     1: #      $NetBSD: bsd.prog.mk,v 1.145 2002/01/01 00:27:06 thorpej Exp $
1.67      mikel       2: #      @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94
1.1       cgd         3:
1.138     tv          4: .include <bsd.init.mk>
1.74      mycroft     5:
1.138     tv          6: ##### Basic targets
1.74      mycroft     7: .PHONY:                cleanprog proginstall scriptsinstall
1.80      mycroft     8: realinstall:   proginstall scriptsinstall
1.132     tv          9: clean:         cleanprog
1.1       cgd        10:
1.138     tv         11: ##### Default values
1.142     thorpej    12: CPPFLAGS+=     ${DESTDIR:D-nostdinc ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include}
1.143     tv         13: CXXFLAGS+=     ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include/g++}
1.25      mycroft    14: CFLAGS+=       ${COPTS}
1.1       cgd        15:
1.69      thorpej    16: # ELF platforms depend on crtbegin.o and crtend.o
1.100     lukem      17: .if ${OBJECT_FMT} == "ELF"
1.86      cjs        18: LIBCRTBEGIN?=  ${DESTDIR}/usr/lib/crtbegin.o
                     19: LIBCRTEND?=    ${DESTDIR}/usr/lib/crtend.o
1.144     lukem      20: _SHLINKER=     ${SHLINKDIR}/ld.elf_so
1.69      thorpej    21: .else
                     22: LIBCRTBEGIN?=
                     23: LIBCRTEND?=
1.144     lukem      24: _SHLINKER=     ${SHLINKDIR}/ld.so
1.69      thorpej    25: .endif
                     26:
1.86      cjs        27: LIBCRT0?=      ${DESTDIR}/usr/lib/crt0.o
1.95      ross       28:
                     29: LIBBZ2?=       ${DESTDIR}/usr/lib/libbz2.a
1.86      cjs        30: LIBC?=         ${DESTDIR}/usr/lib/libc.a
                     31: LIBC_PIC?=     ${DESTDIR}/usr/lib/libc_pic.a
1.121     garbled    32: LIBCDK?=       ${DESTDIR}/usr/lib/libcdk.a
1.117     thorpej    33: LIBCOM_ERR?=   ${DESTDIR}/usr/lib/libcom_err.a
1.86      cjs        34: LIBCOMPAT?=    ${DESTDIR}/usr/lib/libcompat.a
                     35: LIBCRYPT?=     ${DESTDIR}/usr/lib/libcrypt.a
1.117     thorpej    36: LIBCRYPTO?=    ${DESTDIR}/usr/lib/libcrypto.a
1.123     mrg        37: LIBCRYPTO_RC5?=        ${DESTDIR}/usr/lib/libcrypto_rc5.a
                     38: LIBCRYPTO_IDEA?=${DESTDIR}/usr/lib/libcrypto_idea.a
1.86      cjs        39: LIBCURSES?=    ${DESTDIR}/usr/lib/libcurses.a
                     40: LIBDBM?=       ${DESTDIR}/usr/lib/libdbm.a
                     41: LIBDES?=       ${DESTDIR}/usr/lib/libdes.a
                     42: LIBEDIT?=      ${DESTDIR}/usr/lib/libedit.a
1.121     garbled    43: LIBFORM?=      ${DESTDIR}/usr/lib/libform.a
1.86      cjs        44: LIBGCC?=       ${DESTDIR}/usr/lib/libgcc.a
                     45: LIBGNUMALLOC?= ${DESTDIR}/usr/lib/libgnumalloc.a
1.117     thorpej    46: LIBGSSAPI?=    ${DESTDIR}/usr/lib/libgssapi.a
1.119     deberg     47: LIBHDB?=       ${DESTDIR}/usr/lib/libhdb.a
1.120     itojun     48: LIBINTL?=      ${DESTDIR}/usr/lib/libintl.a
1.101     itojun     49: LIBIPSEC?=     ${DESTDIR}/usr/lib/libipsec.a
1.117     thorpej    50: LIBKADM?=      ${DESTDIR}/usr/lib/libkadm.a
                     51: LIBKADM5CLNT?= ${DESTDIR}/usr/lib/libkadm5clnt.a
                     52: LIBKADM5SRV?=  ${DESTDIR}/usr/lib/libkadm5srv.a
                     53: LIBKAFS?=      ${DESTDIR}/usr/lib/libkafs.a
1.119     deberg     54: LIBKDB?=       ${DESTDIR}/usr/lib/libkdb.a
1.86      cjs        55: LIBKRB?=       ${DESTDIR}/usr/lib/libkrb.a
1.117     thorpej    56: LIBKRB5?=      ${DESTDIR}/usr/lib/libkrb5.a
                     57: LIBKSTREAM?=   ${DESTDIR}/usr/lib/libkstream.a
1.86      cjs        58: LIBKVM?=       ${DESTDIR}/usr/lib/libkvm.a
                     59: LIBL?=         ${DESTDIR}/usr/lib/libl.a
                     60: LIBM?=         ${DESTDIR}/usr/lib/libm.a
1.105     blymn      61: LIBMENU?=      ${DESTDIR}/usr/lib/libmenu.a
1.89      lukem      62: LIBOBJC?=      ${DESTDIR}/usr/lib/libobjc.a
1.117     thorpej    63: LIBOSSAUDIO?=  ${DESTDIR}/usr/lib/libossaudio.a
1.86      cjs        64: LIBPCAP?=      ${DESTDIR}/usr/lib/libpcap.a
1.133     thorpej    65: LIBPCI?=       ${DESTDIR}/usr/lib/libpci.a
1.86      cjs        66: LIBPOSIX?=     ${DESTDIR}/usr/lib/libposix.a
                     67: LIBRESOLV?=    ${DESTDIR}/usr/lib/libresolv.a
1.117     thorpej    68: LIBRMT?=       ${DESTDIR}/usr/lib/librmt.a
                     69: LIBROKEN?=     ${DESTDIR}/usr/lib/libroken.a
1.86      cjs        70: LIBRPCSVC?=    ${DESTDIR}/usr/lib/librpcsvc.a
                     71: LIBSKEY?=      ${DESTDIR}/usr/lib/libskey.a
1.117     thorpej    72: LIBSS?=                ${DESTDIR}/usr/lib/libss.a
1.128     itojun     73: LIBSSL?=       ${DESTDIR}/usr/lib/libssl.a
1.117     thorpej    74: LIBSL?=                ${DESTDIR}/usr/lib/libsl.a
1.86      cjs        75: LIBTERMCAP?=   ${DESTDIR}/usr/lib/libtermcap.a
                     76: LIBTELNET?=    ${DESTDIR}/usr/lib/libtelnet.a
1.117     thorpej    77: LIBUSB?=       ${DESTDIR}/usr/lib/libusb.a
1.86      cjs        78: LIBUTIL?=      ${DESTDIR}/usr/lib/libutil.a
                     79: LIBWRAP?=      ${DESTDIR}/usr/lib/libwrap.a
                     80: LIBY?=         ${DESTDIR}/usr/lib/liby.a
                     81: LIBZ?=         ${DESTDIR}/usr/lib/libz.a
1.1       cgd        82:
1.138     tv         83: ##### Build and install rules
1.1       cgd        84: .if defined(SHAREDSTRINGS)
                     85: CLEANFILES+=strings
                     86: .c.o:
                     87:        ${CC} -E ${CFLAGS} ${.IMPSRC} | xstr -c -
                     88:        @${CC} ${CFLAGS} -c x.c -o ${.TARGET}
                     89:        @rm -f x.c
1.18      mycroft    90:
                     91: .cc.o:
                     92:        ${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c -
                     93:        @mv -f x.c x.cc
                     94:        @${CXX} ${CXXFLAGS} -c x.cc -o ${.TARGET}
1.26      mycroft    95:        @rm -f x.cc
1.18      mycroft    96:
                     97: .C.o:
                     98:        ${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c -
                     99:        @mv -f x.c x.C
                    100:        @${CXX} ${CXXFLAGS} -c x.C -o ${.TARGET}
1.26      mycroft   101:        @rm -f x.C
1.1       cgd       102: .endif
                    103:
1.146   ! thorpej   104: .if defined(PROG_CXX)
        !           105: PROG=  ${PROG_CXX}
        !           106: .endif
1.38      jtc       107:
1.1       cgd       108: .if defined(PROG)
1.146   ! thorpej   109: .if defined(PROG_CXX)
        !           110: SRCS?=         ${PROG}.cc
        !           111: .else
1.80      mycroft   112: SRCS?=         ${PROG}.c
1.146   ! thorpej   113: .endif
1.80      mycroft   114:
1.141     tv        115: DPSRCS+=       ${SRCS:M*.[ly]:C/\..$/.c/}
1.137     tv        116: CLEANFILES+=   ${DPSRCS} ${YHEADER:D${SRCS:M*.y:.y=.h}}
1.80      mycroft   117:
1.108     eeh       118: .if !empty(SRCS:N*.h:N*.sh:N*.fth)
                    119: OBJS+=         ${SRCS:N*.h:N*.sh:N*.fth:R:S/$/.o/g}
1.80      mycroft   120: LOBJS+=                ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
1.45      cgd       121: .endif
1.1       cgd       122:
1.47      cgd       123: .if defined(OBJS) && !empty(OBJS)
1.141     tv        124: .NOPATH: ${OBJS} ${PROG} ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
1.137     tv        125:
1.144     lukem     126: _PROGLDOPTS=
                    127: .if ${SHLINKDIR} != "/usr/libexec"     # XXX: change or remove if ld.so moves
                    128: _PROGLDOPTS+=  -Wl,-dynamic-linker=${_SHLINKER}
                    129: .endif
                    130: .if ${SHLIBDIR} != ${LIBDIR}
                    131: _PROGLDOPTS+=  -Wl,-rpath-link,${DESTDIR}${SHLIBDIR}:${DESTDIR}/usr/lib \
                    132:                -Wl,-rpath,${SHLIBDIR}:/usr/lib \
                    133:                -L${DESTDIR}${SHLIBDIR}
                    134: .endif
                    135:
1.145     thorpej   136: .if defined(PROG_CXX)
                    137: _CCLINK=       ${CXX}
                    138: .if defined(HAVE_GCC3)
                    139: _SUPCXX=       -lstdc++ -lm
                    140: .endif
                    141: .else
                    142: _CCLINK=       ${CC}
                    143: .endif
                    144:
1.86      cjs       145: .if defined(DESTDIR)
                    146:
1.80      mycroft   147: ${PROG}: ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
1.127     christos  148: .if !commands(${PROG})
1.145     thorpej   149:        ${_CCLINK} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostdlib ${_PROGLDOPTS} ${LIBCRT0} ${LIBCRTBEGIN} ${OBJS} ${LDADD} -L${DESTDIR}/usr/lib ${_SUPCXX} -lgcc -lc -lgcc ${LIBCRTEND}
1.125     christos  150: .endif
1.4       nate      151:
1.46      mycroft   152: .else
1.86      cjs       153:
1.80      mycroft   154: ${PROG}: ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
1.127     christos  155: .if !commands(${PROG})
1.145     thorpej   156:        ${_CCLINK} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${_PROGLDOPTS} ${OBJS} ${LDADD}
1.125     christos  157: .endif
1.1       cgd       158:
1.86      cjs       159: .endif # defined(DESTDIR)
1.47      cgd       160: .endif # defined(OBJS) && !empty(OBJS)
1.1       cgd       161:
1.100     lukem     162: .if !defined(MAN)
1.49      cgd       163: MAN=   ${PROG}.1
                    164: .endif # !defined(MAN)
                    165: .endif # defined(PROG)
1.11      mycroft   166:
1.107     mycroft   167: realall: ${PROG} ${SCRIPTS}
1.1       cgd       168:
1.134     tls       169: cleanprog: cleanobjs cleanextra
                    170:        rm -f a.out [Ee]rrs mklog core *.core ${PROG}
                    171:
                    172: cleanobjs:
1.135     lukem     173: .if defined(OBJS) && !empty(OBJS)
1.134     tls       174:        rm -f ${OBJS} ${LOBJS}
1.135     lukem     175: .endif
1.134     tls       176:
                    177: cleanextra:
1.135     lukem     178: .if defined(CLEANFILES) && !empty(CLEANFILES)
1.134     tls       179:        rm -f ${CLEANFILES}
1.135     lukem     180: .endif
1.1       cgd       181:
1.129     jmc       182: .if defined(SRCS) && !target(afterdepend)
1.59      cgd       183: afterdepend: .depend
                    184:        @(TMP=/tmp/_depend$$$$; \
                    185:            sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.ln:/' \
                    186:              < .depend > $$TMP; \
                    187:            mv $$TMP .depend)
                    188: .endif
1.27      mycroft   189:
1.74      mycroft   190: .if defined(PROG) && !target(proginstall)
1.114     mycroft   191: PROGNAME?=${PROG}
                    192:
1.63      christos  193: proginstall:: ${DESTDIR}${BINDIR}/${PROGNAME}
1.114     mycroft   194: .PRECIOUS: ${DESTDIR}${BINDIR}/${PROGNAME}
1.63      christos  195: .if !defined(UPDATE)
                    196: .PHONY: ${DESTDIR}${BINDIR}/${PROGNAME}
                    197: .endif
1.114     mycroft   198:
1.115     mycroft   199: __proginstall: .USE
1.139     tv        200:        ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
                    201:                ${STRIPFLAG} ${.ALLSRC} ${.TARGET}
1.115     mycroft   202:
1.103     fredb     203: .if !defined(BUILD) && !make(all) && !make(${PROG})
1.63      christos  204: ${DESTDIR}${BINDIR}/${PROGNAME}: .MADE
                    205: .endif
1.115     mycroft   206: ${DESTDIR}${BINDIR}/${PROGNAME}: ${PROG} __proginstall
1.23      mycroft   207: .endif
                    208:
1.74      mycroft   209: .if !target(proginstall)
                    210: proginstall::
                    211: .endif
                    212:
                    213: .if defined(SCRIPTS) && !target(scriptsinstall)
1.65      mycroft   214: SCRIPTSDIR?=${BINDIR}
                    215: SCRIPTSOWN?=${BINOWN}
                    216: SCRIPTSGRP?=${BINGRP}
                    217: SCRIPTSMODE?=${BINMODE}
1.113     mycroft   218:
                    219: scriptsinstall:: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
1.114     mycroft   220: .PRECIOUS: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
1.63      christos  221: .if !defined(UPDATE)
1.113     mycroft   222: .PHONY: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
1.63      christos  223: .endif
1.113     mycroft   224:
1.115     mycroft   225: __scriptinstall: .USE
1.139     tv        226:        ${INSTALL_FILE} \
1.116     mycroft   227:            -o ${SCRIPTSOWN_${.ALLSRC:T}:U${SCRIPTSOWN}} \
                    228:            -g ${SCRIPTSGRP_${.ALLSRC:T}:U${SCRIPTSGRP}} \
                    229:            -m ${SCRIPTSMODE_${.ALLSRC:T}:U${SCRIPTSMODE}} \
1.115     mycroft   230:            ${.ALLSRC} ${.TARGET}
                    231:
1.130     sommerfe  232: .for S in ${SCRIPTS:O:u}
1.103     fredb     233: .if !defined(BUILD) && !make(all) && !make(${S})
1.113     mycroft   234: ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: .MADE
1.63      christos  235: .endif
1.115     mycroft   236: ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: ${S} __scriptinstall
1.63      christos  237: .endfor
1.14      mycroft   238: .endif
1.1       cgd       239:
1.74      mycroft   240: .if !target(scriptsinstall)
                    241: scriptsinstall::
1.1       cgd       242: .endif
                    243:
1.52      cgd       244: lint: ${LOBJS}
                    245: .if defined(LOBJS) && !empty(LOBJS)
1.90      cgd       246:        ${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD}
1.1       cgd       247: .endif
                    248:
1.138     tv        249: ##### Pull in related .mk logic
1.1       cgd       250: .include <bsd.man.mk>
1.50      jtc       251: .include <bsd.nls.mk>
1.66      christos  252: .include <bsd.files.mk>
1.63      christos  253: .include <bsd.inc.mk>
1.83      mycroft   254: .include <bsd.links.mk>
1.26      mycroft   255: .include <bsd.dep.mk>
1.54      christos  256: .include <bsd.sys.mk>
1.88      mycroft   257:
1.138     tv        258: ${TARGETS}:    # ensure existence

CVSweb <webmaster@jp.NetBSD.org>