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

1.155.2.1! he          1: #      $NetBSD: bsd.prog.mk,v 1.155 2002/03/27 05:40:54 eeh 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.155     eeh        15: .if ${MACHINE_ARCH} == "sparc64"
                     16: CFLAGS+=       -mcmodel=medlow
                     17: .endif
1.1       cgd        18:
1.69      thorpej    19: # ELF platforms depend on crtbegin.o and crtend.o
1.100     lukem      20: .if ${OBJECT_FMT} == "ELF"
1.153     pk         21: .ifndef LIBCRTBEGIN
                     22: LIBCRTBEGIN=   ${DESTDIR}/usr/lib/crtbegin.o
1.152     christos   23: .MADE: ${LIBCRTBEGIN}
1.153     pk         24: .endif
                     25: .ifndef LIBCRTEND
                     26: LIBCRTEND=     ${DESTDIR}/usr/lib/crtend.o
1.152     christos   27: .MADE: ${LIBCRTEND}
1.153     pk         28: .endif
1.144     lukem      29: _SHLINKER=     ${SHLINKDIR}/ld.elf_so
1.69      thorpej    30: .else
                     31: LIBCRTBEGIN?=
                     32: LIBCRTEND?=
1.144     lukem      33: _SHLINKER=     ${SHLINKDIR}/ld.so
1.69      thorpej    34: .endif
                     35:
1.153     pk         36: .ifndef LIBCRT0
                     37: LIBCRT0=       ${DESTDIR}/usr/lib/crt0.o
1.152     christos   38: .MADE: ${LIBCRT0}
1.153     pk         39: .endif
1.95      ross       40:
1.153     pk         41: ##### Installed system library definitions
                     42: #     E.g. LIBC?=${DESTDIR}/usr/lib/libc.a
                     43: #     etc..
                     44: #
                     45: __bsd_prog_mk_system_libs?= \
1.155.2.1! he         46:        BZ2 C C_PIC CDK COM_ERR COMPAT CRYPT CRYPTO CRYPTO_IDEA CRYPTO_MDC2 \
        !            47:        CRYPTO_RC5 \
1.153     pk         48:        CURSES DBM DES EDIT FORM GCC GNUMALLOC GSSAPI HDB INTL IPSEC \
                     49:        KADM KADM5CLNT KADM5SRV KAFS KDB KRB KRB5 KSTREAM KVM L M MENU \
                     50:        OBJC OSSAUDIO PCAP PCI POSIX RESOLV RMT ROKEN RPCSVC SKEY SS SSL SL \
                     51:        TERMCAP TELNET USBHID UTIL WRAP Y Z
                     52:
                     53: .for _n in ${__bsd_prog_mk_system_libs}
                     54: .ifndef LIB${_n}
                     55: LIB${_n}= ${DESTDIR}/usr/lib/lib${_n:tl}.a
                     56: # XXX - note that ${DESTDIR} will expanded in the following rule
                     57: .MADE: ${LIB${_n}}
                     58: .endif
                     59: .endfor
                     60: .undef __bsd_prog_mk_system_libs
1.1       cgd        61:
1.138     tv         62: ##### Build and install rules
1.1       cgd        63: .if defined(SHAREDSTRINGS)
                     64: CLEANFILES+=strings
                     65: .c.o:
                     66:        ${CC} -E ${CFLAGS} ${.IMPSRC} | xstr -c -
                     67:        @${CC} ${CFLAGS} -c x.c -o ${.TARGET}
                     68:        @rm -f x.c
1.18      mycroft    69:
                     70: .cc.o:
                     71:        ${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c -
                     72:        @mv -f x.c x.cc
                     73:        @${CXX} ${CXXFLAGS} -c x.cc -o ${.TARGET}
1.26      mycroft    74:        @rm -f x.cc
1.18      mycroft    75:
                     76: .C.o:
                     77:        ${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c -
                     78:        @mv -f x.c x.C
                     79:        @${CXX} ${CXXFLAGS} -c x.C -o ${.TARGET}
1.26      mycroft    80:        @rm -f x.C
1.1       cgd        81: .endif
                     82:
1.146     thorpej    83: .if defined(PROG_CXX)
                     84: PROG=  ${PROG_CXX}
                     85: .endif
1.38      jtc        86:
1.1       cgd        87: .if defined(PROG)
1.146     thorpej    88: .if defined(PROG_CXX)
                     89: SRCS?=         ${PROG}.cc
                     90: .else
1.80      mycroft    91: SRCS?=         ${PROG}.c
1.146     thorpej    92: .endif
1.80      mycroft    93:
1.141     tv         94: DPSRCS+=       ${SRCS:M*.[ly]:C/\..$/.c/}
1.137     tv         95: CLEANFILES+=   ${DPSRCS} ${YHEADER:D${SRCS:M*.y:.y=.h}}
1.80      mycroft    96:
1.108     eeh        97: .if !empty(SRCS:N*.h:N*.sh:N*.fth)
                     98: OBJS+=         ${SRCS:N*.h:N*.sh:N*.fth:R:S/$/.o/g}
1.80      mycroft    99: LOBJS+=                ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
1.45      cgd       100: .endif
1.1       cgd       101:
1.47      cgd       102: .if defined(OBJS) && !empty(OBJS)
1.141     tv        103: .NOPATH: ${OBJS} ${PROG} ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
1.137     tv        104:
1.144     lukem     105: _PROGLDOPTS=
                    106: .if ${SHLINKDIR} != "/usr/libexec"     # XXX: change or remove if ld.so moves
                    107: _PROGLDOPTS+=  -Wl,-dynamic-linker=${_SHLINKER}
                    108: .endif
                    109: .if ${SHLIBDIR} != ${LIBDIR}
                    110: _PROGLDOPTS+=  -Wl,-rpath-link,${DESTDIR}${SHLIBDIR}:${DESTDIR}/usr/lib \
                    111:                -Wl,-rpath,${SHLIBDIR}:/usr/lib \
                    112:                -L${DESTDIR}${SHLIBDIR}
                    113: .endif
                    114:
1.145     thorpej   115: .if defined(PROG_CXX)
                    116: _CCLINK=       ${CXX}
                    117: _SUPCXX=       -lstdc++ -lm
                    118: .else
                    119: _CCLINK=       ${CC}
                    120: .endif
                    121:
1.86      cjs       122: .if defined(DESTDIR)
                    123:
1.80      mycroft   124: ${PROG}: ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
1.127     christos  125: .if !commands(${PROG})
1.145     thorpej   126:        ${_CCLINK} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostdlib ${_PROGLDOPTS} ${LIBCRT0} ${LIBCRTBEGIN} ${OBJS} ${LDADD} -L${DESTDIR}/usr/lib ${_SUPCXX} -lgcc -lc -lgcc ${LIBCRTEND}
1.125     christos  127: .endif
1.4       nate      128:
1.46      mycroft   129: .else
1.86      cjs       130:
1.80      mycroft   131: ${PROG}: ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
1.127     christos  132: .if !commands(${PROG})
1.145     thorpej   133:        ${_CCLINK} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${_PROGLDOPTS} ${OBJS} ${LDADD}
1.125     christos  134: .endif
1.1       cgd       135:
1.86      cjs       136: .endif # defined(DESTDIR)
1.47      cgd       137: .endif # defined(OBJS) && !empty(OBJS)
1.1       cgd       138:
1.100     lukem     139: .if !defined(MAN)
1.49      cgd       140: MAN=   ${PROG}.1
                    141: .endif # !defined(MAN)
                    142: .endif # defined(PROG)
1.11      mycroft   143:
1.107     mycroft   144: realall: ${PROG} ${SCRIPTS}
1.1       cgd       145:
1.134     tls       146: cleanprog: cleanobjs cleanextra
                    147:        rm -f a.out [Ee]rrs mklog core *.core ${PROG}
                    148:
                    149: cleanobjs:
1.135     lukem     150: .if defined(OBJS) && !empty(OBJS)
1.134     tls       151:        rm -f ${OBJS} ${LOBJS}
1.135     lukem     152: .endif
1.134     tls       153:
                    154: cleanextra:
1.135     lukem     155: .if defined(CLEANFILES) && !empty(CLEANFILES)
1.134     tls       156:        rm -f ${CLEANFILES}
1.135     lukem     157: .endif
1.1       cgd       158:
1.129     jmc       159: .if defined(SRCS) && !target(afterdepend)
1.59      cgd       160: afterdepend: .depend
                    161:        @(TMP=/tmp/_depend$$$$; \
                    162:            sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.ln:/' \
                    163:              < .depend > $$TMP; \
                    164:            mv $$TMP .depend)
                    165: .endif
1.27      mycroft   166:
1.74      mycroft   167: .if defined(PROG) && !target(proginstall)
1.114     mycroft   168: PROGNAME?=${PROG}
                    169:
1.63      christos  170: proginstall:: ${DESTDIR}${BINDIR}/${PROGNAME}
1.114     mycroft   171: .PRECIOUS: ${DESTDIR}${BINDIR}/${PROGNAME}
                    172:
1.115     mycroft   173: __proginstall: .USE
1.139     tv        174:        ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
                    175:                ${STRIPFLAG} ${.ALLSRC} ${.TARGET}
1.115     mycroft   176:
1.154     mycroft   177: .if !defined(UPDATE)
                    178: ${DESTDIR}${BINDIR}/${PROGNAME}! ${PROG} __proginstall
                    179: .if !defined(BUILD) && !make(all) && !make(${PROG})
                    180: ${DESTDIR}${BINDIR}/${PROGNAME}! .MADE
                    181: .endif
                    182: .else
                    183: ${DESTDIR}${BINDIR}/${PROGNAME}: ${PROG} __proginstall
1.103     fredb     184: .if !defined(BUILD) && !make(all) && !make(${PROG})
1.63      christos  185: ${DESTDIR}${BINDIR}/${PROGNAME}: .MADE
                    186: .endif
1.154     mycroft   187: .endif
1.23      mycroft   188: .endif
                    189:
1.74      mycroft   190: .if !target(proginstall)
                    191: proginstall::
                    192: .endif
                    193:
                    194: .if defined(SCRIPTS) && !target(scriptsinstall)
1.65      mycroft   195: SCRIPTSDIR?=${BINDIR}
                    196: SCRIPTSOWN?=${BINOWN}
                    197: SCRIPTSGRP?=${BINGRP}
                    198: SCRIPTSMODE?=${BINMODE}
1.113     mycroft   199:
                    200: scriptsinstall:: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
1.114     mycroft   201: .PRECIOUS: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
1.113     mycroft   202:
1.115     mycroft   203: __scriptinstall: .USE
1.139     tv        204:        ${INSTALL_FILE} \
1.116     mycroft   205:            -o ${SCRIPTSOWN_${.ALLSRC:T}:U${SCRIPTSOWN}} \
                    206:            -g ${SCRIPTSGRP_${.ALLSRC:T}:U${SCRIPTSGRP}} \
                    207:            -m ${SCRIPTSMODE_${.ALLSRC:T}:U${SCRIPTSMODE}} \
1.115     mycroft   208:            ${.ALLSRC} ${.TARGET}
                    209:
1.130     sommerfe  210: .for S in ${SCRIPTS:O:u}
1.154     mycroft   211: .if !defined(UPDATE)
                    212: ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! ${S} __scriptinstall
                    213: .if !defined(BUILD) && !make(all) && !make(${S})
                    214: ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! .MADE
                    215: .endif
                    216: .else
                    217: ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: ${S} __scriptinstall
1.103     fredb     218: .if !defined(BUILD) && !make(all) && !make(${S})
1.113     mycroft   219: ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: .MADE
1.63      christos  220: .endif
1.154     mycroft   221: .endif
1.63      christos  222: .endfor
1.14      mycroft   223: .endif
1.1       cgd       224:
1.74      mycroft   225: .if !target(scriptsinstall)
                    226: scriptsinstall::
1.1       cgd       227: .endif
                    228:
1.52      cgd       229: lint: ${LOBJS}
                    230: .if defined(LOBJS) && !empty(LOBJS)
1.90      cgd       231:        ${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD}
1.1       cgd       232: .endif
                    233:
1.138     tv        234: ##### Pull in related .mk logic
1.1       cgd       235: .include <bsd.man.mk>
1.50      jtc       236: .include <bsd.nls.mk>
1.66      christos  237: .include <bsd.files.mk>
1.63      christos  238: .include <bsd.inc.mk>
1.83      mycroft   239: .include <bsd.links.mk>
1.26      mycroft   240: .include <bsd.dep.mk>
1.54      christos  241: .include <bsd.sys.mk>
1.88      mycroft   242:
1.138     tv        243: ${TARGETS}:    # ensure existence

CVSweb <webmaster@jp.NetBSD.org>