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

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

CVSweb <webmaster@jp.NetBSD.org>