[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.144

1.144   ! lukem       1: #      $NetBSD: bsd.prog.mk,v 1.143 2001/11/28 04:38:29 tv 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.38      jtc       104:
1.1       cgd       105: .if defined(PROG)
1.80      mycroft   106: SRCS?=         ${PROG}.c
                    107:
1.141     tv        108: DPSRCS+=       ${SRCS:M*.[ly]:C/\..$/.c/}
1.137     tv        109: CLEANFILES+=   ${DPSRCS} ${YHEADER:D${SRCS:M*.y:.y=.h}}
1.80      mycroft   110:
1.108     eeh       111: .if !empty(SRCS:N*.h:N*.sh:N*.fth)
                    112: OBJS+=         ${SRCS:N*.h:N*.sh:N*.fth:R:S/$/.o/g}
1.80      mycroft   113: LOBJS+=                ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
1.45      cgd       114: .endif
1.1       cgd       115:
1.47      cgd       116: .if defined(OBJS) && !empty(OBJS)
1.141     tv        117: .NOPATH: ${OBJS} ${PROG} ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
1.137     tv        118:
1.144   ! lukem     119: _PROGLDOPTS=
        !           120: .if ${SHLINKDIR} != "/usr/libexec"     # XXX: change or remove if ld.so moves
        !           121: _PROGLDOPTS+=  -Wl,-dynamic-linker=${_SHLINKER}
        !           122: .endif
        !           123: .if ${SHLIBDIR} != ${LIBDIR}
        !           124: _PROGLDOPTS+=  -Wl,-rpath-link,${DESTDIR}${SHLIBDIR}:${DESTDIR}/usr/lib \
        !           125:                -Wl,-rpath,${SHLIBDIR}:/usr/lib \
        !           126:                -L${DESTDIR}${SHLIBDIR}
        !           127: .endif
        !           128:
1.86      cjs       129: .if defined(DESTDIR)
                    130:
1.80      mycroft   131: ${PROG}: ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
1.127     christos  132: .if !commands(${PROG})
1.144   ! lukem     133:        ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostdlib ${_PROGLDOPTS} ${LIBCRT0} ${LIBCRTBEGIN} ${OBJS} ${LDADD} -L${DESTDIR}/usr/lib -lgcc -lc -lgcc ${LIBCRTEND}
1.125     christos  134: .endif
1.4       nate      135:
1.46      mycroft   136: .else
1.86      cjs       137:
1.80      mycroft   138: ${PROG}: ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
1.127     christos  139: .if !commands(${PROG})
1.144   ! lukem     140:        ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${_PROGLDOPTS} ${OBJS} ${LDADD}
1.125     christos  141: .endif
1.1       cgd       142:
1.86      cjs       143: .endif # defined(DESTDIR)
1.47      cgd       144: .endif # defined(OBJS) && !empty(OBJS)
1.1       cgd       145:
1.100     lukem     146: .if !defined(MAN)
1.49      cgd       147: MAN=   ${PROG}.1
                    148: .endif # !defined(MAN)
                    149: .endif # defined(PROG)
1.11      mycroft   150:
1.107     mycroft   151: realall: ${PROG} ${SCRIPTS}
1.1       cgd       152:
1.134     tls       153: cleanprog: cleanobjs cleanextra
                    154:        rm -f a.out [Ee]rrs mklog core *.core ${PROG}
                    155:
                    156: cleanobjs:
1.135     lukem     157: .if defined(OBJS) && !empty(OBJS)
1.134     tls       158:        rm -f ${OBJS} ${LOBJS}
1.135     lukem     159: .endif
1.134     tls       160:
                    161: cleanextra:
1.135     lukem     162: .if defined(CLEANFILES) && !empty(CLEANFILES)
1.134     tls       163:        rm -f ${CLEANFILES}
1.135     lukem     164: .endif
1.1       cgd       165:
1.129     jmc       166: .if defined(SRCS) && !target(afterdepend)
1.59      cgd       167: afterdepend: .depend
                    168:        @(TMP=/tmp/_depend$$$$; \
                    169:            sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.ln:/' \
                    170:              < .depend > $$TMP; \
                    171:            mv $$TMP .depend)
                    172: .endif
1.27      mycroft   173:
1.74      mycroft   174: .if defined(PROG) && !target(proginstall)
1.114     mycroft   175: PROGNAME?=${PROG}
                    176:
1.63      christos  177: proginstall:: ${DESTDIR}${BINDIR}/${PROGNAME}
1.114     mycroft   178: .PRECIOUS: ${DESTDIR}${BINDIR}/${PROGNAME}
1.63      christos  179: .if !defined(UPDATE)
                    180: .PHONY: ${DESTDIR}${BINDIR}/${PROGNAME}
                    181: .endif
1.114     mycroft   182:
1.115     mycroft   183: __proginstall: .USE
1.139     tv        184:        ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
                    185:                ${STRIPFLAG} ${.ALLSRC} ${.TARGET}
1.115     mycroft   186:
1.103     fredb     187: .if !defined(BUILD) && !make(all) && !make(${PROG})
1.63      christos  188: ${DESTDIR}${BINDIR}/${PROGNAME}: .MADE
                    189: .endif
1.115     mycroft   190: ${DESTDIR}${BINDIR}/${PROGNAME}: ${PROG} __proginstall
1.23      mycroft   191: .endif
                    192:
1.74      mycroft   193: .if !target(proginstall)
                    194: proginstall::
                    195: .endif
                    196:
                    197: .if defined(SCRIPTS) && !target(scriptsinstall)
1.65      mycroft   198: SCRIPTSDIR?=${BINDIR}
                    199: SCRIPTSOWN?=${BINOWN}
                    200: SCRIPTSGRP?=${BINGRP}
                    201: SCRIPTSMODE?=${BINMODE}
1.113     mycroft   202:
                    203: scriptsinstall:: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
1.114     mycroft   204: .PRECIOUS: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
1.63      christos  205: .if !defined(UPDATE)
1.113     mycroft   206: .PHONY: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
1.63      christos  207: .endif
1.113     mycroft   208:
1.115     mycroft   209: __scriptinstall: .USE
1.139     tv        210:        ${INSTALL_FILE} \
1.116     mycroft   211:            -o ${SCRIPTSOWN_${.ALLSRC:T}:U${SCRIPTSOWN}} \
                    212:            -g ${SCRIPTSGRP_${.ALLSRC:T}:U${SCRIPTSGRP}} \
                    213:            -m ${SCRIPTSMODE_${.ALLSRC:T}:U${SCRIPTSMODE}} \
1.115     mycroft   214:            ${.ALLSRC} ${.TARGET}
                    215:
1.130     sommerfe  216: .for S in ${SCRIPTS:O:u}
1.103     fredb     217: .if !defined(BUILD) && !make(all) && !make(${S})
1.113     mycroft   218: ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: .MADE
1.63      christos  219: .endif
1.115     mycroft   220: ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: ${S} __scriptinstall
1.63      christos  221: .endfor
1.14      mycroft   222: .endif
1.1       cgd       223:
1.74      mycroft   224: .if !target(scriptsinstall)
                    225: scriptsinstall::
1.1       cgd       226: .endif
                    227:
1.52      cgd       228: lint: ${LOBJS}
                    229: .if defined(LOBJS) && !empty(LOBJS)
1.90      cgd       230:        ${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD}
1.1       cgd       231: .endif
                    232:
1.138     tv        233: ##### Pull in related .mk logic
1.1       cgd       234: .include <bsd.man.mk>
1.50      jtc       235: .include <bsd.nls.mk>
1.66      christos  236: .include <bsd.files.mk>
1.63      christos  237: .include <bsd.inc.mk>
1.83      mycroft   238: .include <bsd.links.mk>
1.26      mycroft   239: .include <bsd.dep.mk>
1.54      christos  240: .include <bsd.sys.mk>
1.88      mycroft   241:
1.138     tv        242: ${TARGETS}:    # ensure existence

CVSweb <webmaster@jp.NetBSD.org>