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

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

CVSweb <webmaster@jp.NetBSD.org>