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

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

CVSweb <webmaster@jp.NetBSD.org>