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

1.306   ! riastrad    1: #      $NetBSD: bsd.prog.mk,v 1.305 2017/05/21 14:20:45 riastradh 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:        curses \
1.303     rin       118:        cxx \
1.268     christos  119:        dbm \
                    120:        des \
                    121:        dns \
                    122:        edit \
                    123:        event \
1.274     tron      124:        expat \
1.293     joerg     125:        execinfo \
1.268     christos  126:        fetch \
                    127:        fl \
                    128:        form \
                    129:        g2c \
                    130:        gcc \
                    131:        gnumalloc \
                    132:        gssapi \
                    133:        hdb \
                    134:        heimbase \
                    135:        heimntlm \
                    136:        hx509 \
                    137:        intl \
                    138:        ipsec \
                    139:        isc \
                    140:        isccc \
                    141:        isccfg \
                    142:        kadm5clnt \
                    143:        kadm5srv \
                    144:        kafs \
                    145:        krb5 \
                    146:        kvm \
                    147:        l \
                    148:        lber \
                    149:        ldap \
                    150:        ldap_r \
                    151:        lua \
                    152:        lwres \
                    153:        m \
                    154:        magic \
                    155:        menu \
1.304     joerg     156:        netpgpverify \
1.268     christos  157:        objc \
                    158:        ossaudio \
                    159:        pam \
                    160:        pcap \
                    161:        pci \
                    162:        pmc \
                    163:        posix \
                    164:        pthread \
                    165:        puffs \
                    166:        quota \
                    167:        radius \
                    168:        resolv \
                    169:        rmt \
                    170:        roken \
                    171:        rpcsvc \
                    172:        rt \
                    173:        rump \
                    174:        rumpfs_cd9660fs \
                    175:        rumpfs_efs \
                    176:        rumpfs_ext2fs \
                    177:        rumpfs_ffs \
                    178:        rumpfs_hfs \
                    179:        rumpfs_lfs \
                    180:        rumpfs_msdosfs \
                    181:        rumpfs_nfs \
                    182:        rumpfs_ntfs \
                    183:        rumpfs_syspuffs \
                    184:        rumpfs_tmpfs \
                    185:        rumpfs_udf \
                    186:        rumpfs_ufs \
                    187:        rumpuser \
                    188:        saslc \
                    189:        skey \
                    190:        sl \
                    191:        sqlite3 \
                    192:        ss \
                    193:        ssh \
                    194:        ssl \
                    195:        ssp \
1.269     christos  196:        stdcxx \
                    197:        supcxx \
1.268     christos  198:        terminfo \
1.270     christos  199:        tre \
1.300     christos  200:        unbound \
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 \
1.301     christos  221:        -lroken -lcom_err -lheimbase -lcrypto -lsqlite3
1.265     he        222: PAM_STATIC_DPADD+= ${LIBKAFS} ${LIBKRB5} ${LIBHX509} ${LIBWIND} ${LIBASN1} \
1.301     christos  223:        ${LIBROKEN} ${LIBCOM_ERR} ${LIBHEIMBASE} ${LIBCRYPTO} ${LIBSQLITE3}
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)
1.294     christos  332: CPPFLAGS+=     -D_KERNTYPES
1.255     pooka     333: PROG=                  ${RUMPPRG}
1.275     christos  334: . ifndef CRUNCHEDPROG
                    335: .  if (${MKRUMP} != "no")
1.255     pooka     336: PROGS=                 ${RUMPPRG} rump.${RUMPPRG}
1.275     christos  337: .  else
                    338: PROGS=                 ${RUMPPRG}
                    339: .  endif
                    340: .  if defined(SRCS)
                    341: .   if (${MKRUMP} != "no")
1.255     pooka     342: SRCS.rump.${PROG}:=    ${SRCS} ${PROG}_rumpops.c ${RUMPSRCS}
1.275     christos  343: .   endif
1.255     pooka     344: SRCS+=                 ${PROG}_hostops.c
1.275     christos  345: .  else
1.255     pooka     346: SRCS=                  ${PROG}.c ${PROG}_hostops.c
1.275     christos  347: .   if (${MKRUMP} != "no")
1.255     pooka     348: SRCS.rump.${PROG}=     ${PROG}.c ${PROG}_rumpops.c ${RUMPSRCS}
1.275     christos  349: .   endif
                    350: .  endif
                    351: .   if (${MKRUMP} != "no")
1.257     pooka     352: DPSRCS+=               ${PROG}_rumpops.c ${RUMPSRCS}
1.255     pooka     353: LDADD.rump.${PROG}+=   -lrumpclient
                    354: DPADD.rump.${PROG}+=   ${LIBRUMPCLIENT}
                    355: MAN.rump.${PROG}=      # defined but feeling empty
                    356: _RUMPINSTALL.rump.${PROG}=# defined
1.275     christos  357: .   endif
                    358: . else # CRUNCHEDPROG
1.256     pooka     359: PROGS=                 ${PROG}
                    360: CPPFLAGS+=             -DCRUNCHOPS
1.275     christos  361: . endif
1.255     pooka     362: .endif
                    363:
1.223     jmmv      364: .if defined(PROG)
1.231     lukem     365: _CCLINK?=      ${CC} ${_CCLINKFLAGS}
1.223     jmmv      366: .  if defined(MAN)
                    367: MAN.${PROG}=   ${MAN}
                    368: _APPEND_MANS=  no
                    369: .  endif
                    370: .  if !defined(OBJS)
                    371: OBJS=          ${OBJS.${PROG}}
                    372: .  endif
                    373: .  if defined(PROGNAME)
                    374: PROGNAME.${PROG}=      ${PROGNAME}
                    375: .  endif
                    376: .  if defined(SRCS)
                    377: SRCS.${PROG}=  ${SRCS}
                    378: _APPEND_SRCS=  no
                    379: .  endif
                    380: .endif
                    381:
                    382: # Turn the single-program PROG and PROG_CXX variables into their multi-word
                    383: # counterparts, PROGS and PROGS_CXX.
1.255     pooka     384: .if !defined(RUMPPRG)
                    385: .  if defined(PROG_CXX) && !defined(PROGS_CXX)
1.223     jmmv      386: PROGS_CXX=     ${PROG_CXX}
1.262     jmmv      387: .  elif defined(PROG) && !defined(PROGS)
1.223     jmmv      388: PROGS=         ${PROG}
1.255     pooka     389: .  endif
1.223     jmmv      390: .endif
                    391:
1.281     christos  392: ##### Libraries that this may depend upon.
                    393: .if defined(PROGDPLIBS)                                                # {
                    394: .for _lib _dir in ${PROGDPLIBS}
                    395: .if !defined(BINDO.${_lib})
1.282     christos  396: PROGDO.${_lib}!=       cd "${_dir}" && ${PRINTOBJDIR}
                    397: .MAKEOVERRIDES+=PROGDO.${_lib}
1.281     christos  398: .endif
1.282     christos  399: LDADD+=                -L${PROGDO.${_lib}} -l${_lib}
                    400: .if exists(${PROGDO.${_lib}}/lib${_lib}_pic.a)
                    401: DPADD+=                ${PROGDO.${_lib}}/lib${_lib}_pic.a
                    402: .elif exists(${PROGDO.${_lib}}/lib${_lib}.so)
                    403: DPADD+=                ${PROGDO.${_lib}}/lib${_lib}.so
1.281     christos  404: .else
1.282     christos  405: DPADD+=                ${PROGDO.${_lib}}/lib${_lib}.a
1.281     christos  406: .endif
                    407: .endfor
                    408: .endif                                                                 # }
1.223     jmmv      409: #
                    410: # Per-program definitions and targets.
                    411: #
                    412:
1.271     matt      413: _CCLINK.CDEFAULT= ${CC} ${_CCLINKFLAGS}
1.223     jmmv      414: # Definitions specific to C programs.
                    415: .for _P in ${PROGS}
                    416: SRCS.${_P}?=   ${_P}.c
1.231     lukem     417: _CCLINK.${_P}= ${CC} ${_CCLINKFLAGS}
1.271     matt      418: _CFLAGS.${_P}= ${CFLAGS} ${CPUFLAGS}
                    419: _CPPFLAGS.${_P}=       ${CPPFLAGS}
                    420: _COPTS.${_P}=  ${COPTS}
1.223     jmmv      421: .endfor
                    422:
1.271     matt      423: _CCLINK.CXXDEFAULT= ${CXX} ${_CCLINKFLAGS}
1.223     jmmv      424: # Definitions specific to C++ programs.
                    425: .for _P in ${PROGS_CXX}
                    426: SRCS.${_P}?=   ${_P}.cc
1.231     lukem     427: _CCLINK.${_P}= ${CXX} ${_CCLINKFLAGS}
1.223     jmmv      428: .endfor
                    429:
                    430: # Language-independent definitions.
                    431: .for _P in ${PROGS} ${PROGS_CXX}                                       # {
                    432:
                    433: BINDIR.${_P}?=         ${BINDIR}
                    434: PROGNAME.${_P}?=       ${_P}
                    435:
1.296     christos  436: .if ${MKDEBUG:Uno} != "no" && !defined(NODEBUG) && !commands(${_P})
1.223     jmmv      437: _PROGDEBUG.${_P}:=     ${PROGNAME.${_P}}.debug
1.145     thorpej   438: .endif
                    439:
1.223     jmmv      440: .if defined(PAXCTL_FLAGS)
                    441: PAXCTL_FLAGS.${_P}?= ${PAXCTL_FLAGS}
1.215     lukem     442: .endif
                    443:
1.223     jmmv      444: ##### PROG specific flags.
1.244     uebayasi  445:
1.278     jmmv      446: _DPADD.${_P}=          ${DPADD}    ${DPADD.${_P}}
1.223     jmmv      447: _LDADD.${_P}=          ${LDADD}    ${LDADD.${_P}}
                    448: _LDFLAGS.${_P}=                ${LDFLAGS}  ${LDFLAGS.${_P}}
                    449: _LDSTATIC.${_P}=       ${LDSTATIC} ${LDSTATIC.${_P}}
                    450:
                    451: ##### Build and install rules
                    452: .if !empty(_APPEND_SRCS:M[Yy][Ee][Ss])
1.271     matt      453: SRCS+=         ${SRCS.${_P}}   # For bsd.dep.mk
1.223     jmmv      454: .endif
                    455:
                    456: _YPSRCS.${_P}= ${SRCS.${_P}:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS.${_P}:M*.y:.y=.h}}
                    457:
                    458: DPSRCS+=               ${_YPSRCS.${_P}}
                    459: CLEANFILES+=           ${_YPSRCS.${_P}}
                    460:
                    461: .if !empty(SRCS.${_P}:N*.h:N*.sh:N*.fth)
                    462: OBJS.${_P}+=   ${SRCS.${_P}:N*.h:N*.sh:N*.fth:R:S/$/.o/g}
                    463: LOBJS.${_P}+=  ${LSRCS:.c=.ln} ${SRCS.${_P}:M*.c:.c=.ln}
1.157     thorpej   464: .endif
                    465:
1.223     jmmv      466: .if defined(OBJS.${_P}) && !empty(OBJS.${_P})                  # {
                    467: .NOPATH: ${OBJS.${_P}} ${_P} ${_YPSRCS.${_P}}
                    468:
1.271     matt      469: .if (defined(USE_COMBINE) && ${USE_COMBINE} != "no" && !commands(${_P}) \
                    470:    && (${_CCLINK.${_P}} == ${_CCLINK.CDEFAULT} \
                    471:        || ${_CCLINK.${_P}} == ${_CCLINK.CXXDEFAULT}) \
                    472:    && !defined(NOCOMBINE.${_P}) && !defined(NOCOMBINE))
                    473: .for f in ${SRCS.${_P}:N*.h:N*.sh:N*.fth:C/\.[yl]$/.c/g}
                    474: #_XFLAGS.$f := ${CPPFLAGS.$f:D1} ${CPUFLAGS.$f:D2} \
                    475: #     ${COPTS.$f:D3} ${OBJCOPTS.$f:D4} ${CXXFLAGS.$f:D5}
                    476: .if (${CPPFLAGS.$f:D1} == "1" || ${CPUFLAGS.$f:D2} == "2" \
                    477:      || ${COPTS.$f:D3} == "3" || ${OBJCOPTS.$f:D4} == "4" \
                    478:      || ${CXXFLAGS.$f:D5} == "5") \
                    479:     || ("${f:M*.[cyl]}" == "" || commands(${f:R:S/$/.o/}))
                    480: XOBJS.${_P}+=  ${f:R:S/$/.o/}
                    481: .else
                    482: XSRCS.${_P}+=  ${f}
                    483: NODPSRCS+=     ${f}
                    484: .endif
                    485: .endfor
                    486:
1.286     joerg     487: ${_P}: .gdbinit ${LIBCRT0} ${LIBCRTI} ${XOBJS.${_P}} ${SRCS.${_P}} \
                    488:     ${DPSRCS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${_DPADD.${_P}}
1.271     matt      489:        ${_MKTARGET_LINK}
                    490: .if defined(DESTDIR)
                    491:        ${_CCLINK.${_P}} -Wl,-nostdlib \
                    492:            ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} ${_PROGLDOPTS} \
                    493:            -B${_GCC_CRTDIR}/ -B${DESTDIR}/usr/lib/ \
                    494:            -MD --combine ${_CPPFLAGS.${_P}} ${_CFLAGS.${_P}} ${_COPTS.${_P}} \
                    495:            ${XSRCS.${_P}:@.SRC.@${.ALLSRC:M*.c:M*${.SRC.}}@:O:u} ${XOBJS.${_P}} \
                    496:            ${_LDADD.${_P}} -L${_GCC_LIBGCCDIR} -L${DESTDIR}/usr/lib
                    497: .else
                    498:        ${_CCLINK.${_P}} ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} ${_PROGLDOPTS} \
                    499:            -MD --combine ${_CPPFLAGS.${_P}} ${_COPTS.${_P}}
                    500:            ${XSRCS.${_P}:@.SRC.@${.ALLSRC:M*.c:M*${.SRC.}}@:O:u} ${XOBJS.${_P}} \
                    501:            ${_LDADD.${_P}}
                    502: .endif # defined(DESTDIR)
                    503: .if defined(CTFMERGE)
                    504:        ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${_P}}
                    505: .endif
                    506: .if defined(PAXCTL_FLAGS.${_P})
                    507:        ${PAXCTL} ${PAXCTL_FLAGS.${_P}} ${.TARGET}
                    508: .endif
                    509: .if ${MKSTRIPIDENT} != "no"
                    510:        ${OBJCOPY} -R .ident ${.TARGET}
                    511: .endif
                    512:
                    513: CLEANFILES+=   ${_P}.d
                    514: .if exists(${_P}.d)
                    515: .include "${_P}.d"             # include -MD depend for program.
                    516: .endif
                    517: .else  # USE_COMBINE
                    518:
1.223     jmmv      519: ${OBJS.${_P}} ${LOBJS.${_P}}: ${DPSRCS}
1.182     lukem     520:
1.286     joerg     521: ${_P}: .gdbinit ${LIBCRT0} ${LIBCRTI} ${OBJS.${_P}} ${LIBC} ${LIBCRTBEGIN} \
                    522:     ${LIBCRTEND} ${_DPADD.${_P}}
1.223     jmmv      523: .if !commands(${_P})
1.194     lukem     524:        ${_MKTARGET_LINK}
1.231     lukem     525:        ${_CCLINK.${_P}} \
1.232     lukem     526:            ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} \
1.283     christos  527:            ${OBJS.${_P}} ${_PROGLDOPTS} ${_LDADD.${_P}}
1.247     darran    528: .if defined(CTFMERGE)
                    529:        ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${_P}}
                    530: .endif
1.223     jmmv      531: .if defined(PAXCTL_FLAGS.${_P})
                    532:        ${PAXCTL} ${PAXCTL_FLAGS.${_P}} ${.TARGET}
1.218     christos  533: .endif
1.235     joerg     534: .if ${MKSTRIPIDENT} != "no"
                    535:        ${OBJCOPY} -R .ident ${.TARGET}
                    536: .endif
1.223     jmmv      537: .endif # !commands(${_P})
1.271     matt      538: .endif # USE_COMBINE
1.183     dsl       539:
1.278     jmmv      540: ${_P}.ro: ${OBJS.${_P}} ${_DPADD.${_P}}
1.207     dsl       541:        ${_MKTARGET_LINK}
1.298     martin    542:        ${CC} ${LDFLAGS:N-pie} -nostdlib -r -Wl,-dc -o ${.TARGET} ${OBJS.${_P}}
1.1       cgd       543:
1.223     jmmv      544: .if defined(_PROGDEBUG.${_P})
1.224     jmmv      545: ${_PROGDEBUG.${_P}}: ${_P}
1.215     lukem     546:        ${_MKTARGET_CREATE}
1.251     lukem     547:        (  ${OBJCOPY} --only-keep-debug ${_P} ${_PROGDEBUG.${_P}} \
                    548:        && ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \
                    549:                --add-gnu-debuglink=${_PROGDEBUG.${_P}} ${_P} \
                    550:        ) || (rm -f ${_PROGDEBUG.${_P}}; false)
1.215     lukem     551: .endif
                    552:
1.223     jmmv      553: .endif # defined(OBJS.${_P}) && !empty(OBJS.${_P})                     # }
1.1       cgd       554:
1.223     jmmv      555: .if !defined(MAN.${_P})
                    556: MAN.${_P}=     ${_P}.1
                    557: .endif # !defined(MAN.${_P})
                    558: .if !empty(_APPEND_MANS:M[Yy][Ee][Ss])
                    559: MAN+=          ${MAN.${_P}}
                    560: .endif
1.11      mycroft   561:
1.223     jmmv      562: realall: ${_P} ${_PROGDEBUG.${_P}}
1.1       cgd       563:
1.267     apb       564: CLEANFILES+= ${_P} ${_PROGDEBUG.${_P}}
1.134     tls       565:
1.223     jmmv      566: .if defined(OBJS.${_P}) && !empty(OBJS.${_P})
1.267     apb       567: CLEANFILES+= ${OBJS.${_P}} ${LOBJS.${_P}}
1.59      cgd       568: .endif
1.27      mycroft   569:
1.223     jmmv      570: _PROG_INSTALL+=        proginstall-${_P}
1.114     mycroft   571:
1.223     jmmv      572: .if !target(proginstall-${_P})                                         # {
                    573: proginstall-${_P}::    ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}} \
                    574:                ${_PROGDEBUG.${_P}:D${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}}
                    575: .PRECIOUS:     ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}} \
                    576:                ${_PROGDEBUG.${_P}:D${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}}
1.215     lukem     577:
1.172     lukem     578: .if ${MKUPDATE} == "no"
1.255     pooka     579: .if defined(_RUMPINSTALL.${_P})
                    580: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! ${_P} __progrumpinstall
                    581: .else
1.223     jmmv      582: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! ${_P} __proginstall
1.255     pooka     583: .endif
1.223     jmmv      584: .if !defined(BUILD) && !make(all) && !make(${_P})
                    585: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! .MADE
                    586: .endif
                    587: .if defined(_PROGDEBUG.${_P})
                    588: ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}! ${_PROGDEBUG.${_P}} __progdebuginstall
                    589: .if !defined(BUILD) && !make(all) && !make(${_P})
                    590: ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}! .MADE
1.215     lukem     591: .endif
1.223     jmmv      592: .endif #  define(_PROGDEBUG.${_P})
1.215     lukem     593: .else  # MKUPDATE != no
1.255     pooka     594: .if defined(_RUMPINSTALL.${_P})
                    595: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: ${_P} __progrumpinstall
                    596: .else
1.223     jmmv      597: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: ${_P} __proginstall
1.255     pooka     598: .endif
1.223     jmmv      599: .if !defined(BUILD) && !make(all) && !make(${_P})
                    600: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: .MADE
                    601: .endif
                    602: .if defined(_PROGDEBUG.${_P})
                    603: ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}: ${_PROGDEBUG.${_P}} __progdebuginstall
                    604: .if !defined(BUILD) && !make(all) && !make(${_P})
                    605: ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}: .MADE
1.154     mycroft   606: .endif
1.223     jmmv      607: .endif #  defined(_PROGDEBUG.${_P})
1.215     lukem     608: .endif # MKUPDATE != no
                    609:
1.223     jmmv      610: .endif # !target(proginstall-${_P})                                    # }
                    611:
                    612: lint: lint-${_P}
                    613: lint-${_P}: ${LOBJS.${_P}}
                    614: .if defined(LOBJS.${_P}) && !empty(LOBJS.${_P})
                    615:        ${LINT} ${LINTFLAGS} ${_LDFLAGS.${_P}:C/-L[  ]*/-L/Wg:M-L*} ${LOBJS.${_P}} ${_LDADD.${_P}}
                    616: .endif
                    617:
                    618: .endfor # _P in ${PROGS} ${PROGS_CXX}                                  # }
1.23      mycroft   619:
1.225     jmmv      620: .if defined(OBJS) && !empty(OBJS) && \
                    621:     (empty(PROGS) && empty(PROGS_CXX))
1.267     apb       622: CLEANFILES+= ${OBJS} ${LOBJS}
1.225     jmmv      623: .endif
                    624:
1.74      mycroft   625: .if !target(proginstall)
1.223     jmmv      626: proginstall:: ${_PROG_INSTALL}
1.74      mycroft   627: .endif
1.197     lukem     628: .PHONY:                proginstall
1.74      mycroft   629:
1.223     jmmv      630:
                    631:
                    632: realall: ${SCRIPTS}
1.215     lukem     633: .if defined(SCRIPTS) && !target(scriptsinstall)                                # {
1.65      mycroft   634: SCRIPTSDIR?=${BINDIR}
                    635: SCRIPTSOWN?=${BINOWN}
                    636: SCRIPTSGRP?=${BINGRP}
                    637: SCRIPTSMODE?=${BINMODE}
1.113     mycroft   638:
                    639: scriptsinstall:: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
1.114     mycroft   640: .PRECIOUS: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
1.113     mycroft   641:
1.115     mycroft   642: __scriptinstall: .USE
1.192     lukem     643:        ${_MKTARGET_INSTALL}
1.139     tv        644:        ${INSTALL_FILE} \
1.116     mycroft   645:            -o ${SCRIPTSOWN_${.ALLSRC:T}:U${SCRIPTSOWN}} \
                    646:            -g ${SCRIPTSGRP_${.ALLSRC:T}:U${SCRIPTSGRP}} \
                    647:            -m ${SCRIPTSMODE_${.ALLSRC:T}:U${SCRIPTSMODE}} \
1.209     jwise     648:            ${.ALLSRC} ${.TARGET}
1.115     mycroft   649:
1.130     sommerfe  650: .for S in ${SCRIPTS:O:u}
1.172     lukem     651: .if ${MKUPDATE} == "no"
1.154     mycroft   652: ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! ${S} __scriptinstall
                    653: .if !defined(BUILD) && !make(all) && !make(${S})
                    654: ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! .MADE
                    655: .endif
                    656: .else
                    657: ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: ${S} __scriptinstall
1.103     fredb     658: .if !defined(BUILD) && !make(all) && !make(${S})
1.113     mycroft   659: ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: .MADE
1.63      christos  660: .endif
1.154     mycroft   661: .endif
1.63      christos  662: .endfor
1.215     lukem     663: .endif                                                                 # }
1.1       cgd       664:
1.74      mycroft   665: .if !target(scriptsinstall)
                    666: scriptsinstall::
1.1       cgd       667: .endif
1.197     lukem     668: .PHONY:                scriptsinstall
1.1       cgd       669:
1.138     tv        670: ##### Pull in related .mk logic
1.241     apb       671: LINKSOWN?= ${BINOWN}
                    672: LINKSGRP?= ${BINGRP}
                    673: LINKSMODE?= ${BINMODE}
1.1       cgd       674: .include <bsd.man.mk>
1.50      jtc       675: .include <bsd.nls.mk>
1.66      christos  676: .include <bsd.files.mk>
1.63      christos  677: .include <bsd.inc.mk>
1.83      mycroft   678: .include <bsd.links.mk>
1.180     lukem     679: .include <bsd.sys.mk>
1.26      mycroft   680: .include <bsd.dep.mk>
1.266     joerg     681: .include <bsd.clang-analyze.mk>
1.267     apb       682: .include <bsd.clean.mk>
1.240     cube      683:
1.138     tv        684: ${TARGETS}:    # ensure existence
1.166     lukem     685:
                    686: .endif # HOSTPROG

CVSweb <webmaster@jp.NetBSD.org>