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

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

CVSweb <webmaster@jp.NetBSD.org>