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

1.285   ! christos    1: #      $NetBSD: bsd.prog.mk,v 1.284 2013/05/31 06:48:43 mrg Exp $
1.67      mikel       2: #      @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94
1.1       cgd         3:
1.166     lukem       4: .ifndef HOSTPROG
                      5:
1.138     tv          6: .include <bsd.init.mk>
1.159     thorpej     7: .include <bsd.shlib.mk>
1.167     thorpej     8: .include <bsd.gcc.mk>
1.74      mycroft     9:
1.223     jmmv       10: #
                     11: # Definitions and targets shared among all programs built by a single
                     12: # Makefile.
                     13: #
                     14:
                     15: ##### Basic targets
                     16: realinstall:   proginstall scriptsinstall
                     17:
                     18: .gdbinit:
                     19:        rm -f .gdbinit
                     20: .if defined(DESTDIR) && !empty(DESTDIR)
                     21:        echo "set solib-absolute-prefix ${DESTDIR}" > .gdbinit
                     22: .else
                     23:        touch .gdbinit
1.185     erh        24: .endif
1.223     jmmv       25: .for __gdbinit in ${GDBINIT}
                     26:        echo "source ${__gdbinit}" >> .gdbinit
                     27: .endfor
1.185     erh        28:
1.267     apb        29: CLEANFILES+= a.out [Ee]rrs mklog core *.core .gdbinit
1.223     jmmv       30:
                     31: .if defined(SHAREDSTRINGS)
                     32: CLEANFILES+=strings
                     33: .c.o:
                     34:        ${CC} -E ${CPPFLAGS} ${CFLAGS} ${.IMPSRC} | xstr -c -
                     35:        @${CC} ${CPPFLAGS} ${CFLAGS} -c x.c -o ${.TARGET}
1.280     christos   36: .if defined(CTFCONVERT)
                     37:        ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
                     38: .endif
1.223     jmmv       39:        @rm -f x.c
1.1       cgd        40:
1.223     jmmv       41: .cc.o .cpp.o .cxx.o .C.o:
                     42:        ${CXX} -E ${CPPFLAGS} ${CXXFLAGS} ${.IMPSRC} | xstr -c -
                     43:        @mv -f x.c x.cc
                     44:        @${CXX} ${CPPFLAGS} ${CXXFLAGS} -c x.cc -o ${.TARGET}
1.280     christos   45: .if defined(CTFCONVERT)
                     46:        ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
                     47: .endif
1.223     jmmv       48:        @rm -f x.cc
                     49: .endif
1.185     erh        50:
1.237     christos   51: .if defined(MKPIE) && (${MKPIE} != "no")
1.238     christos   52: CFLAGS+=       ${PIE_CFLAGS}
1.239     christos   53: AFLAGS+=       ${PIE_AFLAGS}
1.238     christos   54: LDFLAGS+=      ${PIE_LDFLAGS}
1.237     christos   55: .endif
                     56:
1.25      mycroft    57: CFLAGS+=       ${COPTS}
1.279     christos   58: .if defined(MKDEBUG) && (${MKDEBUG} != "no")
                     59: CFLAGS+=       -g
                     60: .endif
1.212     mrg        61: OBJCFLAGS+=    ${OBJCOPTS}
1.193     dsl        62: MKDEP_SUFFIXES?=       .o .ln
1.1       cgd        63:
1.247     darran     64: # CTF preserve debug symbols
                     65: .if defined(MKDTRACE) && (${MKDTRACE} != "no") && (${CFLAGS:M-g} != "")
                     66: CTFFLAGS+= -g
                     67: CTFMFLAGS+= -g
                     68: .endif
                     69:
1.162     thorpej    70: # ELF platforms depend on crti.o, crtbegin.o, crtend.o, and crtn.o
1.153     pk         71: .ifndef LIBCRTBEGIN
1.167     thorpej    72: LIBCRTBEGIN=   ${DESTDIR}/usr/lib/crti.o ${_GCC_CRTBEGIN}
1.152     christos   73: .MADE: ${LIBCRTBEGIN}
1.153     pk         74: .endif
                     75: .ifndef LIBCRTEND
1.167     thorpej    76: LIBCRTEND=     ${_GCC_CRTEND} ${DESTDIR}/usr/lib/crtn.o
1.152     christos   77: .MADE: ${LIBCRTEND}
1.153     pk         78: .endif
1.144     lukem      79: _SHLINKER=     ${SHLINKDIR}/ld.elf_so
1.69      thorpej    80:
1.153     pk         81: .ifndef LIBCRT0
                     82: LIBCRT0=       ${DESTDIR}/usr/lib/crt0.o
1.152     christos   83: .MADE: ${LIBCRT0}
1.153     pk         84: .endif
1.95      ross       85:
1.202     lukem      86: ##### Installed system library definitions
                     87: #
                     88: #      E.g.
                     89: #              LIBC?=${DESTDIR}/usr/lib/libc.a
1.234     mrg        90: #              LIBX11?=${DESTDIR}/usr/X11R7/lib/libX11.a
1.202     lukem      91: #      etc..
1.269     christos   92: #      NB:     If you are a library here, add it in bsd.README
1.202     lukem      93:
                     94: .for _lib in \
1.268     christos   95:        archive \
                     96:        asn1 \
1.269     christos   97:        atf_c \
                     98:        atf_cxx \
1.268     christos   99:        bind9 \
                    100:        bluetooth \
                    101:        bsdmalloc \
                    102:        bz2 \
                    103:        c \
                    104:        c_pic \
                    105:        com_err \
                    106:        compat \
                    107:        crt0 \
                    108:        crypt \
                    109:        crypto \
                    110:        crypto_idea \
                    111:        crypto_mdc2 \
                    112:        crypto_rc5 \
                    113:        curses \
                    114:        dbm \
                    115:        des \
                    116:        dns \
                    117:        edit \
                    118:        event \
1.274     tron      119:        expat \
1.268     christos  120:        fetch \
                    121:        fl \
                    122:        form \
                    123:        g2c \
                    124:        gcc \
                    125:        gnumalloc \
                    126:        gssapi \
                    127:        hdb \
                    128:        heimbase \
                    129:        heimntlm \
                    130:        hx509 \
                    131:        intl \
                    132:        ipsec \
                    133:        isc \
                    134:        isccc \
                    135:        isccfg \
                    136:        kadm5clnt \
                    137:        kadm5srv \
                    138:        kafs \
                    139:        krb5 \
                    140:        kvm \
                    141:        l \
                    142:        lber \
                    143:        ldap \
                    144:        ldap_r \
                    145:        lua \
                    146:        lwres \
                    147:        m \
                    148:        magic \
                    149:        menu \
                    150:        objc \
                    151:        ossaudio \
                    152:        pam \
                    153:        pcap \
                    154:        pci \
                    155:        pmc \
                    156:        posix \
                    157:        pthread \
                    158:        pthread_dbg \
                    159:        puffs \
                    160:        quota \
                    161:        radius \
                    162:        resolv \
                    163:        rmt \
                    164:        roken \
                    165:        rpcsvc \
                    166:        rt \
                    167:        rump \
                    168:        rumpfs_cd9660fs \
                    169:        rumpfs_efs \
                    170:        rumpfs_ext2fs \
                    171:        rumpfs_ffs \
                    172:        rumpfs_hfs \
                    173:        rumpfs_lfs \
                    174:        rumpfs_msdosfs \
                    175:        rumpfs_nfs \
                    176:        rumpfs_ntfs \
                    177:        rumpfs_syspuffs \
                    178:        rumpfs_tmpfs \
                    179:        rumpfs_udf \
                    180:        rumpfs_ufs \
                    181:        rumpuser \
                    182:        saslc \
                    183:        skey \
                    184:        sl \
                    185:        sqlite3 \
                    186:        ss \
                    187:        ssh \
                    188:        ssl \
                    189:        ssp \
1.269     christos  190:        stdcxx \
                    191:        supcxx \
1.268     christos  192:        terminfo \
1.270     christos  193:        tre \
1.268     christos  194:        usbhid \
                    195:        util \
                    196:        wind \
                    197:        wrap \
                    198:        y \
                    199:        z
1.202     lukem     200: .ifndef LIB${_lib:tu}
1.269     christos  201: LIB${_lib:tu}= ${DESTDIR}/usr/lib/lib${_lib:S/xx/++/:S/atf_c/atf-c/}.a
1.202     lukem     202: .MADE:         ${LIB${_lib:tu}}        # Note: ${DESTDIR} will be expanded
                    203: .endif
                    204: .endfor
1.269     christos  205:
1.206     he        206: # PAM applications, if linked statically, need more libraries
                    207: .if (${MKPIC} == "no")
1.208     christos  208: .if (${MKCRYPTO} != "no")
                    209: PAM_STATIC_LDADD+= -lssh
                    210: PAM_STATIC_DPADD+= ${LIBSSH}
                    211: .endif
                    212: .if (${MKKERBEROS} != "no")
1.265     he        213: PAM_STATIC_LDADD+= -lkafs -lkrb5 -lhx509 -lwind -lasn1 \
                    214:        -lroken -lcom_err -lheimbase -lcrypto
                    215: PAM_STATIC_DPADD+= ${LIBKAFS} ${LIBKRB5} ${LIBHX509} ${LIBWIND} ${LIBASN1} \
                    216:        ${LIBROKEN} ${LIBCOM_ERR} ${LIBHEIMBASE} ${LIBCRYPTO}
1.208     christos  217: .endif
                    218: .if (${MKSKEY} != "no")
                    219: PAM_STATIC_LDADD+= -lskey
                    220: PAM_STATIC_DPADD+= ${LIBSKEY}
                    221: .endif
                    222: PAM_STATIC_LDADD+= -lradius -lcrypt -lrpcsvc -lutil
                    223: PAM_STATIC_DPADD+= ${LIBRADIUS} ${LIBCRYPT} ${LIBRPCSVC} ${LIBUTIL}
1.206     he        224: .else
                    225: PAM_STATIC_LDADD=
                    226: PAM_STATIC_DPADD=
                    227: .endif
                    228:
1.269     christos  229: #      NB:     If you are a library here, add it in bsd.README
1.202     lukem     230: .for _lib in \
1.268     christos  231:        FS \
                    232:        GL \
                    233:        GLU \
                    234:        ICE \
                    235:        SM \
                    236:        X11 \
                    237:        XTrap \
                    238:        Xau \
                    239:        Xaw \
                    240:        Xdmcp \
                    241:        Xext \
                    242:        Xfont \
                    243:        Xft \
                    244:        Xi \
                    245:        Xinerama \
                    246:        Xmu \
                    247:        Xmuu \
                    248:        Xpm \
                    249:        Xrandr \
                    250:        Xrender \
                    251:        Xss \
                    252:        Xt \
                    253:        Xtst \
                    254:        Xv \
                    255:        Xxf86dga \
                    256:        Xxf86misc \
                    257:        Xxf86vm \
                    258:        dps \
                    259:        fntstubs \
                    260:        fontcache \
                    261:        fontconfig \
                    262:        fontenc \
                    263:        freetype \
                    264:        lbxutil \
                    265:        xkbfile
1.202     lukem     266: .ifndef LIB${_lib:tu}
1.233     rtr       267: LIB${_lib:tu}= ${DESTDIR}${X11USRLIBDIR}/lib${_lib}.a
1.202     lukem     268: .MADE:         ${LIB${_lib:tu}}        # Note: ${DESTDIR} will be expanded
                    269: .endif
                    270: .endfor
                    271:
1.284     mrg       272: # Ugly one-offs
                    273: LIBX11_XCB=    ${DESTDIR}${X11USRLIBDIR}/libX11-xcb.a
1.285   ! christos  274: LIBXCB=        ${DESTDIR}${X11USRLIBDIR}/libxcb.a
1.284     mrg       275:
1.204     lukem     276: .if defined(RESCUEDIR)
                    277: CPPFLAGS+=     -DRESCUEDIR=\"${RESCUEDIR}\"
                    278: .endif
                    279:
1.144     lukem     280: _PROGLDOPTS=
                    281: .if ${SHLINKDIR} != "/usr/libexec"     # XXX: change or remove if ld.so moves
                    282: _PROGLDOPTS+=  -Wl,-dynamic-linker=${_SHLINKER}
1.161     itohy     283: .endif
1.187     lukem     284: .if ${SHLIBDIR} != "/usr/lib"
1.264     joerg     285: _PROGLDOPTS+=  -Wl,-rpath,${SHLIBDIR} \
1.263     joerg     286:                -L=${SHLIBDIR}
1.277     joerg     287: .elif ${SHLIBINSTALLDIR} != "/usr/lib"
                    288: _PROGLDOPTS+=  -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \
                    289:                -L=${SHLIBINSTALLDIR}
1.144     lukem     290: .endif
                    291:
1.223     jmmv      292: __proginstall: .USE
                    293:        ${_MKTARGET_INSTALL}
                    294:        ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
                    295:                ${STRIPFLAG} ${.ALLSRC} ${.TARGET}
                    296:
1.255     pooka     297: __progrumpinstall: .USE
                    298:        ${_MKTARGET_INSTALL}
                    299:        ${INSTALL_FILE} -o ${RUMPBINOWN} -g ${RUMPBINGRP} -m ${RUMPBINMODE} \
                    300:                ${STRIPFLAG} ${.ALLSRC} ${.TARGET}
                    301:
1.223     jmmv      302: __progdebuginstall: .USE
                    303:        ${_MKTARGET_INSTALL}
                    304:        ${INSTALL_FILE} -o ${DEBUGOWN} -g ${DEBUGGRP} -m ${DEBUGMODE} \
                    305:                ${.ALLSRC} ${.TARGET}
                    306:
                    307:
                    308:
                    309: #
                    310: # Backwards compatibility with Makefiles that assume that bsd.prog.mk
                    311: # can only build a single binary.
                    312: #
                    313:
                    314: _APPEND_MANS=yes
                    315: _APPEND_SRCS=yes
                    316:
1.231     lukem     317: _CCLINKFLAGS=
                    318:
1.145     thorpej   319: .if defined(PROG_CXX)
1.223     jmmv      320: PROG=          ${PROG_CXX}
1.231     lukem     321: _CCLINK=       ${CXX} ${_CCLINKFLAGS}
1.223     jmmv      322: .endif
                    323:
1.255     pooka     324: .if defined(RUMPPRG)
                    325: PROG=                  ${RUMPPRG}
1.275     christos  326: . ifndef CRUNCHEDPROG
                    327: .  if (${MKRUMP} != "no")
1.255     pooka     328: PROGS=                 ${RUMPPRG} rump.${RUMPPRG}
1.275     christos  329: .  else
                    330: PROGS=                 ${RUMPPRG}
                    331: .  endif
                    332: .  if defined(SRCS)
                    333: .   if (${MKRUMP} != "no")
1.255     pooka     334: SRCS.rump.${PROG}:=    ${SRCS} ${PROG}_rumpops.c ${RUMPSRCS}
1.275     christos  335: .   endif
1.255     pooka     336: SRCS+=                 ${PROG}_hostops.c
1.275     christos  337: .  else
1.255     pooka     338: SRCS=                  ${PROG}.c ${PROG}_hostops.c
1.275     christos  339: .   if (${MKRUMP} != "no")
1.255     pooka     340: SRCS.rump.${PROG}=     ${PROG}.c ${PROG}_rumpops.c ${RUMPSRCS}
1.275     christos  341: .   endif
                    342: .  endif
                    343: .   if (${MKRUMP} != "no")
1.257     pooka     344: DPSRCS+=               ${PROG}_rumpops.c ${RUMPSRCS}
1.255     pooka     345: LDADD.rump.${PROG}+=   -lrumpclient
                    346: DPADD.rump.${PROG}+=   ${LIBRUMPCLIENT}
                    347: MAN.rump.${PROG}=      # defined but feeling empty
                    348: _RUMPINSTALL.rump.${PROG}=# defined
1.275     christos  349: .   endif
                    350: . else # CRUNCHEDPROG
1.256     pooka     351: PROGS=                 ${PROG}
                    352: CPPFLAGS+=             -DCRUNCHOPS
1.275     christos  353: . endif
1.255     pooka     354: .endif
                    355:
1.223     jmmv      356: .if defined(PROG)
1.231     lukem     357: _CCLINK?=      ${CC} ${_CCLINKFLAGS}
1.223     jmmv      358: .  if defined(MAN)
                    359: MAN.${PROG}=   ${MAN}
                    360: _APPEND_MANS=  no
                    361: .  endif
                    362: .  if !defined(OBJS)
                    363: OBJS=          ${OBJS.${PROG}}
                    364: .  endif
                    365: .  if defined(PROGNAME)
                    366: PROGNAME.${PROG}=      ${PROGNAME}
                    367: .  endif
                    368: .  if defined(SRCS)
                    369: SRCS.${PROG}=  ${SRCS}
                    370: _APPEND_SRCS=  no
                    371: .  endif
                    372: .endif
                    373:
                    374: # Turn the single-program PROG and PROG_CXX variables into their multi-word
                    375: # counterparts, PROGS and PROGS_CXX.
1.255     pooka     376: .if !defined(RUMPPRG)
                    377: .  if defined(PROG_CXX) && !defined(PROGS_CXX)
1.223     jmmv      378: PROGS_CXX=     ${PROG_CXX}
1.262     jmmv      379: .  elif defined(PROG) && !defined(PROGS)
1.223     jmmv      380: PROGS=         ${PROG}
1.255     pooka     381: .  endif
1.223     jmmv      382: .endif
                    383:
1.281     christos  384: ##### Libraries that this may depend upon.
                    385: .if defined(PROGDPLIBS)                                                # {
                    386: .for _lib _dir in ${PROGDPLIBS}
                    387: .if !defined(BINDO.${_lib})
1.282     christos  388: PROGDO.${_lib}!=       cd "${_dir}" && ${PRINTOBJDIR}
                    389: .MAKEOVERRIDES+=PROGDO.${_lib}
1.281     christos  390: .endif
1.282     christos  391: LDADD+=                -L${PROGDO.${_lib}} -l${_lib}
                    392: .if exists(${PROGDO.${_lib}}/lib${_lib}_pic.a)
                    393: DPADD+=                ${PROGDO.${_lib}}/lib${_lib}_pic.a
                    394: .elif exists(${PROGDO.${_lib}}/lib${_lib}.so)
                    395: DPADD+=                ${PROGDO.${_lib}}/lib${_lib}.so
1.281     christos  396: .else
1.282     christos  397: DPADD+=                ${PROGDO.${_lib}}/lib${_lib}.a
1.281     christos  398: .endif
                    399: .endfor
                    400: .endif                                                                 # }
1.223     jmmv      401: #
                    402: # Per-program definitions and targets.
                    403: #
                    404:
1.271     matt      405: _CCLINK.CDEFAULT= ${CC} ${_CCLINKFLAGS}
1.223     jmmv      406: # Definitions specific to C programs.
                    407: .for _P in ${PROGS}
                    408: SRCS.${_P}?=   ${_P}.c
1.231     lukem     409: _CCLINK.${_P}= ${CC} ${_CCLINKFLAGS}
1.271     matt      410: _CFLAGS.${_P}= ${CFLAGS} ${CPUFLAGS}
                    411: _CPPFLAGS.${_P}=       ${CPPFLAGS}
                    412: _COPTS.${_P}=  ${COPTS}
1.223     jmmv      413: .endfor
                    414:
1.271     matt      415: _CCLINK.CXXDEFAULT= ${CXX} ${_CCLINKFLAGS}
1.223     jmmv      416: # Definitions specific to C++ programs.
                    417: .for _P in ${PROGS_CXX}
                    418: SRCS.${_P}?=   ${_P}.cc
1.231     lukem     419: _CCLINK.${_P}= ${CXX} ${_CCLINKFLAGS}
1.223     jmmv      420: .endfor
                    421:
                    422: # Language-independent definitions.
                    423: .for _P in ${PROGS} ${PROGS_CXX}                                       # {
                    424:
                    425: BINDIR.${_P}?=         ${BINDIR}
                    426: PROGNAME.${_P}?=       ${_P}
                    427:
1.249     mrg       428: .if ${MKDEBUG} != "no" && !commands(${_P})
1.223     jmmv      429: _PROGDEBUG.${_P}:=     ${PROGNAME.${_P}}.debug
1.145     thorpej   430: .endif
                    431:
1.223     jmmv      432: .if defined(PAXCTL_FLAGS)
                    433: PAXCTL_FLAGS.${_P}?= ${PAXCTL_FLAGS}
1.215     lukem     434: .endif
                    435:
1.223     jmmv      436: ##### PROG specific flags.
1.244     uebayasi  437:
1.278     jmmv      438: _DPADD.${_P}=          ${DPADD}    ${DPADD.${_P}}
1.223     jmmv      439: _LDADD.${_P}=          ${LDADD}    ${LDADD.${_P}}
                    440: _LDFLAGS.${_P}=                ${LDFLAGS}  ${LDFLAGS.${_P}}
                    441: _LDSTATIC.${_P}=       ${LDSTATIC} ${LDSTATIC.${_P}}
                    442:
                    443: ##### Build and install rules
                    444: .if !empty(_APPEND_SRCS:M[Yy][Ee][Ss])
1.271     matt      445: SRCS+=         ${SRCS.${_P}}   # For bsd.dep.mk
1.223     jmmv      446: .endif
                    447:
                    448: _YPSRCS.${_P}= ${SRCS.${_P}:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS.${_P}:M*.y:.y=.h}}
                    449:
                    450: DPSRCS+=               ${_YPSRCS.${_P}}
                    451: CLEANFILES+=           ${_YPSRCS.${_P}}
                    452:
                    453: .if !empty(SRCS.${_P}:N*.h:N*.sh:N*.fth)
                    454: OBJS.${_P}+=   ${SRCS.${_P}:N*.h:N*.sh:N*.fth:R:S/$/.o/g}
                    455: LOBJS.${_P}+=  ${LSRCS:.c=.ln} ${SRCS.${_P}:M*.c:.c=.ln}
1.157     thorpej   456: .endif
                    457:
1.223     jmmv      458: .if defined(OBJS.${_P}) && !empty(OBJS.${_P})                  # {
                    459: .NOPATH: ${OBJS.${_P}} ${_P} ${_YPSRCS.${_P}}
                    460:
1.271     matt      461: .if (defined(USE_COMBINE) && ${USE_COMBINE} != "no" && !commands(${_P}) \
                    462:    && (${_CCLINK.${_P}} == ${_CCLINK.CDEFAULT} \
                    463:        || ${_CCLINK.${_P}} == ${_CCLINK.CXXDEFAULT}) \
                    464:    && !defined(NOCOMBINE.${_P}) && !defined(NOCOMBINE))
                    465: .for f in ${SRCS.${_P}:N*.h:N*.sh:N*.fth:C/\.[yl]$/.c/g}
                    466: #_XFLAGS.$f := ${CPPFLAGS.$f:D1} ${CPUFLAGS.$f:D2} \
                    467: #     ${COPTS.$f:D3} ${OBJCOPTS.$f:D4} ${CXXFLAGS.$f:D5}
                    468: .if (${CPPFLAGS.$f:D1} == "1" || ${CPUFLAGS.$f:D2} == "2" \
                    469:      || ${COPTS.$f:D3} == "3" || ${OBJCOPTS.$f:D4} == "4" \
                    470:      || ${CXXFLAGS.$f:D5} == "5") \
                    471:     || ("${f:M*.[cyl]}" == "" || commands(${f:R:S/$/.o/}))
                    472: XOBJS.${_P}+=  ${f:R:S/$/.o/}
                    473: .else
                    474: XSRCS.${_P}+=  ${f}
                    475: NODPSRCS+=     ${f}
                    476: .endif
                    477: .endfor
                    478:
1.278     jmmv      479: ${_P}: .gdbinit ${LIBCRT0} ${XOBJS.${_P}} ${SRCS.${_P}} ${DPSRCS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${_DPADD.${_P}}
1.271     matt      480:        ${_MKTARGET_LINK}
                    481: .if defined(DESTDIR)
                    482:        ${_CCLINK.${_P}} -Wl,-nostdlib \
                    483:            ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} ${_PROGLDOPTS} \
                    484:            -B${_GCC_CRTDIR}/ -B${DESTDIR}/usr/lib/ \
                    485:            -MD --combine ${_CPPFLAGS.${_P}} ${_CFLAGS.${_P}} ${_COPTS.${_P}} \
                    486:            ${XSRCS.${_P}:@.SRC.@${.ALLSRC:M*.c:M*${.SRC.}}@:O:u} ${XOBJS.${_P}} \
                    487:            ${_LDADD.${_P}} -L${_GCC_LIBGCCDIR} -L${DESTDIR}/usr/lib
                    488: .else
                    489:        ${_CCLINK.${_P}} ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} ${_PROGLDOPTS} \
                    490:            -MD --combine ${_CPPFLAGS.${_P}} ${_COPTS.${_P}}
                    491:            ${XSRCS.${_P}:@.SRC.@${.ALLSRC:M*.c:M*${.SRC.}}@:O:u} ${XOBJS.${_P}} \
                    492:            ${_LDADD.${_P}}
                    493: .endif # defined(DESTDIR)
                    494: .if defined(CTFMERGE)
                    495:        ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${_P}}
                    496: .endif
                    497: .if defined(PAXCTL_FLAGS.${_P})
                    498:        ${PAXCTL} ${PAXCTL_FLAGS.${_P}} ${.TARGET}
                    499: .endif
                    500: .if ${MKSTRIPIDENT} != "no"
                    501:        ${OBJCOPY} -R .ident ${.TARGET}
                    502: .endif
                    503:
                    504: CLEANFILES+=   ${_P}.d
                    505: .if exists(${_P}.d)
                    506: .include "${_P}.d"             # include -MD depend for program.
                    507: .endif
                    508: .else  # USE_COMBINE
                    509:
1.223     jmmv      510: ${OBJS.${_P}} ${LOBJS.${_P}}: ${DPSRCS}
1.182     lukem     511:
1.278     jmmv      512: ${_P}: .gdbinit ${LIBCRT0} ${OBJS.${_P}} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${_DPADD.${_P}}
1.223     jmmv      513: .if !commands(${_P})
1.194     lukem     514:        ${_MKTARGET_LINK}
1.231     lukem     515:        ${_CCLINK.${_P}} \
1.232     lukem     516:            ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} \
1.283     christos  517:            ${OBJS.${_P}} ${_PROGLDOPTS} ${_LDADD.${_P}}
1.247     darran    518: .if defined(CTFMERGE)
                    519:        ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${_P}}
                    520: .endif
1.223     jmmv      521: .if defined(PAXCTL_FLAGS.${_P})
                    522:        ${PAXCTL} ${PAXCTL_FLAGS.${_P}} ${.TARGET}
1.218     christos  523: .endif
1.235     joerg     524: .if ${MKSTRIPIDENT} != "no"
                    525:        ${OBJCOPY} -R .ident ${.TARGET}
                    526: .endif
1.223     jmmv      527: .endif # !commands(${_P})
1.271     matt      528: .endif # USE_COMBINE
1.183     dsl       529:
1.278     jmmv      530: ${_P}.ro: ${OBJS.${_P}} ${_DPADD.${_P}}
1.207     dsl       531:        ${_MKTARGET_LINK}
1.254     joerg     532:        ${CC} ${LDFLAGS} -nostdlib -r -Wl,-dc -o ${.TARGET} ${OBJS.${_P}}
1.1       cgd       533:
1.223     jmmv      534: .if defined(_PROGDEBUG.${_P})
1.224     jmmv      535: ${_PROGDEBUG.${_P}}: ${_P}
1.215     lukem     536:        ${_MKTARGET_CREATE}
1.251     lukem     537:        (  ${OBJCOPY} --only-keep-debug ${_P} ${_PROGDEBUG.${_P}} \
                    538:        && ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \
                    539:                --add-gnu-debuglink=${_PROGDEBUG.${_P}} ${_P} \
                    540:        ) || (rm -f ${_PROGDEBUG.${_P}}; false)
1.215     lukem     541: .endif
                    542:
1.223     jmmv      543: .endif # defined(OBJS.${_P}) && !empty(OBJS.${_P})                     # }
1.1       cgd       544:
1.223     jmmv      545: .if !defined(MAN.${_P})
                    546: MAN.${_P}=     ${_P}.1
                    547: .endif # !defined(MAN.${_P})
                    548: .if !empty(_APPEND_MANS:M[Yy][Ee][Ss])
                    549: MAN+=          ${MAN.${_P}}
                    550: .endif
1.11      mycroft   551:
1.223     jmmv      552: realall: ${_P} ${_PROGDEBUG.${_P}}
1.1       cgd       553:
1.267     apb       554: CLEANFILES+= ${_P} ${_PROGDEBUG.${_P}}
1.134     tls       555:
1.223     jmmv      556: .if defined(OBJS.${_P}) && !empty(OBJS.${_P})
1.267     apb       557: CLEANFILES+= ${OBJS.${_P}} ${LOBJS.${_P}}
1.59      cgd       558: .endif
1.27      mycroft   559:
1.223     jmmv      560: _PROG_INSTALL+=        proginstall-${_P}
1.114     mycroft   561:
1.223     jmmv      562: .if !target(proginstall-${_P})                                         # {
                    563: proginstall-${_P}::    ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}} \
                    564:                ${_PROGDEBUG.${_P}:D${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}}
                    565: .PRECIOUS:     ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}} \
                    566:                ${_PROGDEBUG.${_P}:D${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}}
1.215     lukem     567:
1.172     lukem     568: .if ${MKUPDATE} == "no"
1.255     pooka     569: .if defined(_RUMPINSTALL.${_P})
                    570: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! ${_P} __progrumpinstall
                    571: .else
1.223     jmmv      572: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! ${_P} __proginstall
1.255     pooka     573: .endif
1.223     jmmv      574: .if !defined(BUILD) && !make(all) && !make(${_P})
                    575: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! .MADE
                    576: .endif
                    577: .if defined(_PROGDEBUG.${_P})
                    578: ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}! ${_PROGDEBUG.${_P}} __progdebuginstall
                    579: .if !defined(BUILD) && !make(all) && !make(${_P})
                    580: ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}! .MADE
1.215     lukem     581: .endif
1.223     jmmv      582: .endif #  define(_PROGDEBUG.${_P})
1.215     lukem     583: .else  # MKUPDATE != no
1.255     pooka     584: .if defined(_RUMPINSTALL.${_P})
                    585: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: ${_P} __progrumpinstall
                    586: .else
1.223     jmmv      587: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: ${_P} __proginstall
1.255     pooka     588: .endif
1.223     jmmv      589: .if !defined(BUILD) && !make(all) && !make(${_P})
                    590: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: .MADE
                    591: .endif
                    592: .if defined(_PROGDEBUG.${_P})
                    593: ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}: ${_PROGDEBUG.${_P}} __progdebuginstall
                    594: .if !defined(BUILD) && !make(all) && !make(${_P})
                    595: ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}: .MADE
1.154     mycroft   596: .endif
1.223     jmmv      597: .endif #  defined(_PROGDEBUG.${_P})
1.215     lukem     598: .endif # MKUPDATE != no
                    599:
1.223     jmmv      600: .endif # !target(proginstall-${_P})                                    # }
                    601:
                    602: lint: lint-${_P}
                    603: lint-${_P}: ${LOBJS.${_P}}
                    604: .if defined(LOBJS.${_P}) && !empty(LOBJS.${_P})
                    605:        ${LINT} ${LINTFLAGS} ${_LDFLAGS.${_P}:C/-L[  ]*/-L/Wg:M-L*} ${LOBJS.${_P}} ${_LDADD.${_P}}
                    606: .endif
                    607:
                    608: .endfor # _P in ${PROGS} ${PROGS_CXX}                                  # }
1.23      mycroft   609:
1.225     jmmv      610: .if defined(OBJS) && !empty(OBJS) && \
                    611:     (empty(PROGS) && empty(PROGS_CXX))
1.267     apb       612: CLEANFILES+= ${OBJS} ${LOBJS}
1.225     jmmv      613: .endif
                    614:
1.74      mycroft   615: .if !target(proginstall)
1.223     jmmv      616: proginstall:: ${_PROG_INSTALL}
1.74      mycroft   617: .endif
1.197     lukem     618: .PHONY:                proginstall
1.74      mycroft   619:
1.223     jmmv      620:
                    621:
                    622: realall: ${SCRIPTS}
1.215     lukem     623: .if defined(SCRIPTS) && !target(scriptsinstall)                                # {
1.65      mycroft   624: SCRIPTSDIR?=${BINDIR}
                    625: SCRIPTSOWN?=${BINOWN}
                    626: SCRIPTSGRP?=${BINGRP}
                    627: SCRIPTSMODE?=${BINMODE}
1.113     mycroft   628:
                    629: scriptsinstall:: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
1.114     mycroft   630: .PRECIOUS: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
1.113     mycroft   631:
1.115     mycroft   632: __scriptinstall: .USE
1.192     lukem     633:        ${_MKTARGET_INSTALL}
1.139     tv        634:        ${INSTALL_FILE} \
1.116     mycroft   635:            -o ${SCRIPTSOWN_${.ALLSRC:T}:U${SCRIPTSOWN}} \
                    636:            -g ${SCRIPTSGRP_${.ALLSRC:T}:U${SCRIPTSGRP}} \
                    637:            -m ${SCRIPTSMODE_${.ALLSRC:T}:U${SCRIPTSMODE}} \
1.209     jwise     638:            ${.ALLSRC} ${.TARGET}
1.115     mycroft   639:
1.130     sommerfe  640: .for S in ${SCRIPTS:O:u}
1.172     lukem     641: .if ${MKUPDATE} == "no"
1.154     mycroft   642: ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! ${S} __scriptinstall
                    643: .if !defined(BUILD) && !make(all) && !make(${S})
                    644: ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! .MADE
                    645: .endif
                    646: .else
                    647: ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: ${S} __scriptinstall
1.103     fredb     648: .if !defined(BUILD) && !make(all) && !make(${S})
1.113     mycroft   649: ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: .MADE
1.63      christos  650: .endif
1.154     mycroft   651: .endif
1.63      christos  652: .endfor
1.215     lukem     653: .endif                                                                 # }
1.1       cgd       654:
1.74      mycroft   655: .if !target(scriptsinstall)
                    656: scriptsinstall::
1.1       cgd       657: .endif
1.197     lukem     658: .PHONY:                scriptsinstall
1.1       cgd       659:
1.138     tv        660: ##### Pull in related .mk logic
1.241     apb       661: LINKSOWN?= ${BINOWN}
                    662: LINKSGRP?= ${BINGRP}
                    663: LINKSMODE?= ${BINMODE}
1.1       cgd       664: .include <bsd.man.mk>
1.50      jtc       665: .include <bsd.nls.mk>
1.66      christos  666: .include <bsd.files.mk>
1.63      christos  667: .include <bsd.inc.mk>
1.83      mycroft   668: .include <bsd.links.mk>
1.180     lukem     669: .include <bsd.sys.mk>
1.26      mycroft   670: .include <bsd.dep.mk>
1.266     joerg     671: .include <bsd.clang-analyze.mk>
1.267     apb       672: .include <bsd.clean.mk>
1.240     cube      673:
1.138     tv        674: ${TARGETS}:    # ensure existence
1.166     lukem     675:
                    676: .endif # HOSTPROG

CVSweb <webmaster@jp.NetBSD.org>