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

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

CVSweb <webmaster@jp.NetBSD.org>