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

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

CVSweb <webmaster@jp.NetBSD.org>