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

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

CVSweb <webmaster@jp.NetBSD.org>