2019-11-18 19:09:21 +03:00
|
|
|
# $NetBSD: bsd.prog.mk,v 1.324 2019/11/18 16:09:21 christos Exp $
|
1997-03-29 11:02:45 +03:00
|
|
|
# @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94
|
1993-03-21 12:45:37 +03:00
|
|
|
|
2003-05-18 11:36:23 +04:00
|
|
|
.ifndef HOSTPROG
|
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
.include <bsd.init.mk>
|
Only use the MKDYNAMICROOT semantics (i.e. -rpath=/lib,/usr/lib and
-dynamic-linker=/libexec/ld.elf_so) if the BINDIR of the program being
built is /bin or /sbin.
The reason we do this is because now all programs *except* those in
/bin and /sbin (i.e. the "special cases") match the default the compiler
uses, which is what is used for things in e.g. xsrc, pkgsrc, and other
random 3rd party programs.
This is done by decoupling where a shlib is installed from how it
is located. Two new variables, SHLIBINSTALLDIR and SHLINKINSTALLDIR,
contain the former information, and key off MKDYNAMICROOT only. SHLIBDIR
and SHLINKDIR contain the latter, and key off MKDYNAMICROOT and BINDIR.
The SHLIBINSTALLDIR, SHLIBDIR, _LIBSODIR, SHLINKINSTALLDIR, and
SHLINKDIR parameters are moved to a new <bsd.shlib.mk>; see bsd.README
for usage details.
2002-09-28 01:37:50 +04:00
|
|
|
.include <bsd.shlib.mk>
|
2003-06-01 00:33:15 +04:00
|
|
|
.include <bsd.gcc.mk>
|
2019-08-28 01:48:53 +03:00
|
|
|
.include <bsd.sanitizer.mk>
|
1997-10-11 12:16:24 +04:00
|
|
|
|
2018-06-21 14:24:38 +03:00
|
|
|
##### Sanitizer specific flags.
|
|
|
|
|
2018-07-26 02:34:25 +03:00
|
|
|
CFLAGS+= ${SANITIZERFLAGS} ${LIBCSANITIZERFLAGS}
|
|
|
|
CXXFLAGS+= ${SANITIZERFLAGS} ${LIBCSANITIZERFLAGS}
|
2018-06-21 14:24:38 +03:00
|
|
|
LDFLAGS+= ${SANITIZERFLAGS}
|
|
|
|
|
2007-11-12 18:04:35 +03:00
|
|
|
#
|
|
|
|
# Definitions and targets shared among all programs built by a single
|
|
|
|
# Makefile.
|
|
|
|
#
|
2006-11-10 20:13:15 +03:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
##### Basic targets
|
1997-05-09 17:25:46 +04:00
|
|
|
realinstall: proginstall scriptsinstall
|
1997-05-07 19:53:28 +04:00
|
|
|
|
2007-11-12 18:04:35 +03:00
|
|
|
.gdbinit:
|
|
|
|
rm -f .gdbinit
|
|
|
|
.if defined(DESTDIR) && !empty(DESTDIR)
|
|
|
|
echo "set solib-absolute-prefix ${DESTDIR}" > .gdbinit
|
|
|
|
.else
|
|
|
|
touch .gdbinit
|
|
|
|
.endif
|
|
|
|
.for __gdbinit in ${GDBINIT}
|
|
|
|
echo "source ${__gdbinit}" >> .gdbinit
|
|
|
|
.endfor
|
|
|
|
|
2011-09-10 20:57:35 +04:00
|
|
|
CLEANFILES+= a.out [Ee]rrs mklog core *.core .gdbinit
|
2007-11-12 18:04:35 +03:00
|
|
|
|
|
|
|
.if defined(SHAREDSTRINGS)
|
|
|
|
CLEANFILES+=strings
|
|
|
|
.c.o:
|
|
|
|
${CC} -E ${CPPFLAGS} ${CFLAGS} ${.IMPSRC} | xstr -c -
|
|
|
|
@${CC} ${CPPFLAGS} ${CFLAGS} -c x.c -o ${.TARGET}
|
2013-01-27 01:49:20 +04:00
|
|
|
.if defined(CTFCONVERT)
|
|
|
|
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
|
|
|
|
.endif
|
2007-11-12 18:04:35 +03:00
|
|
|
@rm -f x.c
|
|
|
|
|
|
|
|
.cc.o .cpp.o .cxx.o .C.o:
|
|
|
|
${CXX} -E ${CPPFLAGS} ${CXXFLAGS} ${.IMPSRC} | xstr -c -
|
2019-01-22 00:11:54 +03:00
|
|
|
@${MV} x.c x.cc
|
2007-11-12 18:04:35 +03:00
|
|
|
@${CXX} ${CPPFLAGS} ${CXXFLAGS} -c x.cc -o ${.TARGET}
|
2013-01-27 01:49:20 +04:00
|
|
|
.if defined(CTFCONVERT)
|
|
|
|
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
|
|
|
|
.endif
|
2007-11-12 18:04:35 +03:00
|
|
|
@rm -f x.cc
|
|
|
|
.endif
|
2003-09-13 06:52:05 +04:00
|
|
|
|
2016-01-31 18:30:14 +03:00
|
|
|
.if defined(MKPIE) && (${MKPIE} != "no") && !defined(NOPIE)
|
2008-10-16 18:36:42 +04:00
|
|
|
CFLAGS+= ${PIE_CFLAGS}
|
2008-10-19 19:22:50 +04:00
|
|
|
AFLAGS+= ${PIE_AFLAGS}
|
2016-04-04 18:06:16 +03:00
|
|
|
LDFLAGS+= ${"${LDSTATIC.${.TARGET}}" == "-static" :? : ${PIE_LDFLAGS}}
|
2008-10-15 21:31:50 +04:00
|
|
|
.endif
|
|
|
|
|
1993-08-15 23:37:04 +04:00
|
|
|
CFLAGS+= ${COPTS}
|
2016-02-21 06:34:27 +03:00
|
|
|
.if ${MKDEBUG:Uno} != "no" && !defined(NODEBUG)
|
2013-01-17 19:42:59 +04:00
|
|
|
CFLAGS+= -g
|
|
|
|
.endif
|
2006-05-12 03:47:34 +04:00
|
|
|
OBJCFLAGS+= ${OBJCOPTS}
|
2014-12-01 04:34:30 +03:00
|
|
|
MKDEP_SUFFIXES?= .o .ln .d
|
1993-03-21 12:45:37 +03:00
|
|
|
|
2010-03-02 23:49:18 +03:00
|
|
|
# CTF preserve debug symbols
|
2014-03-25 13:52:55 +04:00
|
|
|
.if (${MKCTF:Uno} != "no") && (${CFLAGS:M-g} != "")
|
2010-03-02 23:49:18 +03:00
|
|
|
CTFFLAGS+= -g
|
|
|
|
CTFMFLAGS+= -g
|
2016-03-13 02:08:58 +03:00
|
|
|
.if defined(HAVE_GCC)
|
2014-03-09 22:00:51 +04:00
|
|
|
#CFLAGS+=-gdwarf-2
|
2014-03-03 02:22:05 +04:00
|
|
|
.endif
|
2010-03-02 23:49:18 +03:00
|
|
|
.endif
|
|
|
|
|
2002-11-22 09:44:56 +03:00
|
|
|
# ELF platforms depend on crti.o, crtbegin.o, crtend.o, and crtn.o
|
2002-02-07 10:43:24 +03:00
|
|
|
.ifndef LIBCRTBEGIN
|
2015-06-07 18:04:28 +03:00
|
|
|
LIBCRTBEGIN= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crti.o ${_GCC_CRTBEGIN}
|
2002-02-04 20:25:44 +03:00
|
|
|
.MADE: ${LIBCRTBEGIN}
|
2002-02-07 10:43:24 +03:00
|
|
|
.endif
|
|
|
|
.ifndef LIBCRTEND
|
2015-06-07 18:04:28 +03:00
|
|
|
LIBCRTEND= ${_GCC_CRTEND} ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crtn.o
|
2002-02-04 20:25:44 +03:00
|
|
|
.MADE: ${LIBCRTEND}
|
2002-02-07 10:43:24 +03:00
|
|
|
.endif
|
* Add user-controlled mk.conf variables
- SHLIBDIR Location to install shared libraries if ${USE_SHLIBDIR}
is "yes". Defaults to "/usr/lib".
- USE_SHLIBDIR If "yes", install shared libraries in ${SHLIBDIR}
instead of ${LIBDIR}. Defaults to "no".
Sets ${_LIBSODIR} to the appropriate value.
This may be set by individual Makefiles as well.
- SHLINKDIR Location of shared linker. Defaults to "/usr/libexec".
If != "/usr/libexec", change the dynamic-linker
encoded in shared programs
* Set USE_SHLIBDIR for libraries used by /bin and /sbin:
libc libcrypt libcrypto libedit libipsec libkvm libm libmi387
libtermcap libutil libz
* If ${_LIBSODIR} != ${LIBDIR}, add symlinks from ${LIBDIR}/${LIB}.so*
to ${_LIBSODIR}/${LIB}.so* for compatibility.
* Always install /sbin/init statically (for now)
The net effect of these changes depends on how the variables are set:
1.) If nothing is set or changed, there is no change from the
current behaviour:
- Static /bin, /sbin, and bits of /usr/*
- Dynamic rest
- Shared linker is /usr/libexec/ld*so
2.) If the following make variables are set:
LDSTATIC=
SHLINKDIR=/lib
SHLIBDIR=/lib
Then the behaviour becomes:
- Dynamic tools
- .so libraries used by /bin and /sbin are installed to /lib,
with symlinks from /usr/lib/lib*so to -> /lib/lib*so
where appropriate
- Shared linker is /lib/ld*so
3.) As per 2.), but add the following variable:
USE_SHLIBDIR=yes
This forces all .so's to be instaleld in /lib (with compat
symlinks), not just those tagged by their Makefiles to be.
Again, compat symlinks are installed
2001-12-28 04:32:37 +03:00
|
|
|
_SHLINKER= ${SHLINKDIR}/ld.elf_so
|
1997-04-17 10:40:32 +04:00
|
|
|
|
2002-02-07 10:43:24 +03:00
|
|
|
.ifndef LIBCRT0
|
2015-06-07 18:04:28 +03:00
|
|
|
LIBCRT0= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crt0.o
|
2002-02-04 20:25:44 +03:00
|
|
|
.MADE: ${LIBCRT0}
|
2002-02-07 10:43:24 +03:00
|
|
|
.endif
|
1998-09-10 04:40:33 +04:00
|
|
|
|
2013-11-11 14:24:53 +04:00
|
|
|
.ifndef LIBCRTI
|
2015-06-07 18:04:28 +03:00
|
|
|
LIBCRTI= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crti.o
|
2013-11-11 14:24:53 +04:00
|
|
|
.MADE: ${LIBCRTI}
|
|
|
|
.endif
|
|
|
|
|
2004-08-04 09:32:47 +04:00
|
|
|
##### Installed system library definitions
|
|
|
|
#
|
|
|
|
# E.g.
|
|
|
|
# LIBC?=${DESTDIR}/usr/lib/libc.a
|
2008-08-28 11:17:06 +04:00
|
|
|
# LIBX11?=${DESTDIR}/usr/X11R7/lib/libX11.a
|
2004-08-04 09:32:47 +04:00
|
|
|
# etc..
|
2011-10-16 05:24:05 +04:00
|
|
|
# NB: If you are a library here, add it in bsd.README
|
2004-08-04 09:32:47 +04:00
|
|
|
|
2018-08-12 14:50:51 +03:00
|
|
|
_LIBLIST=\
|
2011-10-16 05:14:33 +04:00
|
|
|
archive \
|
|
|
|
asn1 \
|
2011-10-16 05:24:05 +04:00
|
|
|
atf_c \
|
|
|
|
atf_cxx \
|
2011-10-16 05:14:33 +04:00
|
|
|
bind9 \
|
|
|
|
bluetooth \
|
|
|
|
bsdmalloc \
|
|
|
|
bz2 \
|
|
|
|
c \
|
|
|
|
c_pic \
|
|
|
|
com_err \
|
|
|
|
compat \
|
|
|
|
crypt \
|
|
|
|
crypto \
|
|
|
|
curses \
|
2017-02-20 19:05:34 +03:00
|
|
|
cxx \
|
2011-10-16 05:14:33 +04:00
|
|
|
des \
|
|
|
|
dns \
|
|
|
|
edit \
|
|
|
|
event \
|
2018-08-12 14:50:51 +03:00
|
|
|
event_openssl \
|
|
|
|
event_pthreads \
|
2015-11-08 02:41:58 +03:00
|
|
|
execinfo \
|
2018-08-12 14:50:51 +03:00
|
|
|
expat \
|
2011-10-16 05:14:33 +04:00
|
|
|
fetch \
|
|
|
|
fl \
|
|
|
|
form \
|
|
|
|
gcc \
|
|
|
|
gnumalloc \
|
|
|
|
gssapi \
|
|
|
|
hdb \
|
|
|
|
heimbase \
|
|
|
|
heimntlm \
|
|
|
|
hx509 \
|
|
|
|
intl \
|
|
|
|
ipsec \
|
|
|
|
isc \
|
|
|
|
isccc \
|
|
|
|
isccfg \
|
|
|
|
kadm5clnt \
|
|
|
|
kadm5srv \
|
|
|
|
kafs \
|
|
|
|
krb5 \
|
|
|
|
kvm \
|
|
|
|
l \
|
|
|
|
lber \
|
|
|
|
ldap \
|
|
|
|
ldap_r \
|
|
|
|
lua \
|
|
|
|
m \
|
|
|
|
magic \
|
|
|
|
menu \
|
2017-04-20 02:41:00 +03:00
|
|
|
netpgpverify \
|
2018-08-12 14:50:51 +03:00
|
|
|
ns \
|
2011-10-16 05:14:33 +04:00
|
|
|
objc \
|
|
|
|
ossaudio \
|
2018-08-12 14:50:51 +03:00
|
|
|
panel \
|
2011-10-16 05:14:33 +04:00
|
|
|
pam \
|
|
|
|
pcap \
|
|
|
|
pci \
|
|
|
|
posix \
|
|
|
|
pthread \
|
|
|
|
puffs \
|
|
|
|
quota \
|
|
|
|
radius \
|
2018-08-12 14:50:51 +03:00
|
|
|
refuse \
|
2011-10-16 05:14:33 +04:00
|
|
|
resolv \
|
|
|
|
rmt \
|
|
|
|
roken \
|
|
|
|
rpcsvc \
|
|
|
|
rt \
|
|
|
|
rump \
|
2019-11-18 19:09:21 +03:00
|
|
|
rumpfs_cd9660 \
|
2011-10-16 05:14:33 +04:00
|
|
|
rumpfs_efs \
|
|
|
|
rumpfs_ext2fs \
|
|
|
|
rumpfs_ffs \
|
|
|
|
rumpfs_hfs \
|
|
|
|
rumpfs_lfs \
|
2019-11-18 19:09:21 +03:00
|
|
|
rumpfs_msdos \
|
2011-10-16 05:14:33 +04:00
|
|
|
rumpfs_nfs \
|
|
|
|
rumpfs_ntfs \
|
|
|
|
rumpfs_syspuffs \
|
|
|
|
rumpfs_tmpfs \
|
|
|
|
rumpfs_udf \
|
|
|
|
rumpuser \
|
|
|
|
saslc \
|
|
|
|
skey \
|
|
|
|
sl \
|
|
|
|
sqlite3 \
|
|
|
|
ssh \
|
|
|
|
ssl \
|
2018-08-12 14:50:51 +03:00
|
|
|
stdc++ \
|
|
|
|
supc++ \
|
2011-10-16 05:14:33 +04:00
|
|
|
terminfo \
|
2011-11-06 02:56:30 +04:00
|
|
|
tre \
|
2016-08-20 14:21:50 +03:00
|
|
|
unbound \
|
2011-10-16 05:14:33 +04:00
|
|
|
usbhid \
|
|
|
|
util \
|
|
|
|
wind \
|
|
|
|
wrap \
|
|
|
|
y \
|
|
|
|
z
|
2018-08-12 14:50:51 +03:00
|
|
|
|
|
|
|
.for _lib in ${_LIBLIST}
|
2004-08-04 09:32:47 +04:00
|
|
|
.ifndef LIB${_lib:tu}
|
2011-10-16 05:24:05 +04:00
|
|
|
LIB${_lib:tu}= ${DESTDIR}/usr/lib/lib${_lib:S/xx/++/:S/atf_c/atf-c/}.a
|
2004-08-04 09:32:47 +04:00
|
|
|
.MADE: ${LIB${_lib:tu}} # Note: ${DESTDIR} will be expanded
|
|
|
|
.endif
|
|
|
|
.endfor
|
2011-10-16 05:24:05 +04:00
|
|
|
|
2018-02-25 03:16:48 +03:00
|
|
|
.if (${MKKERBEROS} != "no")
|
|
|
|
LIBKRB5_LDADD+= -lkrb5
|
|
|
|
LIBKRB5_DPADD+= ${LIBKRB5}
|
|
|
|
# Kerberos5 applications, if linked statically, need more libraries
|
|
|
|
LIBKRB5_STATIC_LDADD+= \
|
|
|
|
-lhx509 -lcrypto -lasn1 -lcom_err -lroken \
|
|
|
|
-lwind -lheimbase -lsqlite3 -lcrypt -lutil
|
|
|
|
LIBKRB5_STATIC_DPADD+= \
|
|
|
|
${LIBHX509} ${LIBCRYPTO} ${LIBASN1} ${LIBCOM_ERR} ${LIBROKEN} \
|
|
|
|
${LIBWIND} ${LIBHEIMBASE} ${LIBSQLITE3} ${LIBCRYPT} ${LIBUTIL}
|
|
|
|
. if (${MKPIC} == "no")
|
|
|
|
LIBKRB5_LDADD+= ${LIBKRB5_STATIC_LDADD}
|
|
|
|
LIBKRB5_DPADD+= ${LIBKRB5_STATIC_DPADD}
|
|
|
|
. endif
|
|
|
|
.endif
|
|
|
|
|
2005-03-04 23:41:08 +03:00
|
|
|
# PAM applications, if linked statically, need more libraries
|
|
|
|
.if (${MKPIC} == "no")
|
2006-01-20 19:54:11 +03:00
|
|
|
PAM_STATIC_LDADD+= -lssh
|
|
|
|
PAM_STATIC_DPADD+= ${LIBSSH}
|
|
|
|
.if (${MKKERBEROS} != "no")
|
2011-04-26 12:22:17 +04:00
|
|
|
PAM_STATIC_LDADD+= -lkafs -lkrb5 -lhx509 -lwind -lasn1 \
|
2017-01-30 00:43:56 +03:00
|
|
|
-lroken -lcom_err -lheimbase -lcrypto -lsqlite3
|
2011-04-26 12:22:17 +04:00
|
|
|
PAM_STATIC_DPADD+= ${LIBKAFS} ${LIBKRB5} ${LIBHX509} ${LIBWIND} ${LIBASN1} \
|
2017-01-30 00:43:56 +03:00
|
|
|
${LIBROKEN} ${LIBCOM_ERR} ${LIBHEIMBASE} ${LIBCRYPTO} ${LIBSQLITE3}
|
2006-01-20 19:54:11 +03:00
|
|
|
.endif
|
|
|
|
.if (${MKSKEY} != "no")
|
|
|
|
PAM_STATIC_LDADD+= -lskey
|
|
|
|
PAM_STATIC_DPADD+= ${LIBSKEY}
|
|
|
|
.endif
|
|
|
|
PAM_STATIC_LDADD+= -lradius -lcrypt -lrpcsvc -lutil
|
|
|
|
PAM_STATIC_DPADD+= ${LIBRADIUS} ${LIBCRYPT} ${LIBRPCSVC} ${LIBUTIL}
|
2005-03-04 23:41:08 +03:00
|
|
|
.else
|
|
|
|
PAM_STATIC_LDADD=
|
|
|
|
PAM_STATIC_DPADD=
|
|
|
|
.endif
|
|
|
|
|
2011-10-16 05:24:05 +04:00
|
|
|
# NB: If you are a library here, add it in bsd.README
|
2019-08-10 15:46:38 +03:00
|
|
|
# This list is sorted with -f so that it matches the order in bsd.README
|
|
|
|
_X11LIBLIST= dps fntstubs fontcache fontconfig fontenc freetype FS GL GLU \
|
|
|
|
ICE lbxutil SM X11 X11_xcb Xau Xaw xcb Xdmcp Xext Xfont Xfont2 Xft Xi \
|
|
|
|
Xinerama xkbfile Xmu Xmuu Xpm Xrandr Xrender Xss Xt XTrap Xtst Xv Xxf86dga \
|
|
|
|
Xxf86misc Xxf86vm
|
|
|
|
|
|
|
|
.for _lib in ${_X11LIBLIST}
|
2004-08-04 09:32:47 +04:00
|
|
|
.ifndef LIB${_lib:tu}
|
2008-08-27 12:22:20 +04:00
|
|
|
LIB${_lib:tu}= ${DESTDIR}${X11USRLIBDIR}/lib${_lib}.a
|
2004-08-04 09:32:47 +04:00
|
|
|
.MADE: ${LIB${_lib:tu}} # Note: ${DESTDIR} will be expanded
|
|
|
|
.endif
|
|
|
|
.endfor
|
|
|
|
|
2013-05-31 10:48:43 +04:00
|
|
|
# Ugly one-offs
|
|
|
|
LIBX11_XCB= ${DESTDIR}${X11USRLIBDIR}/libX11-xcb.a
|
2013-09-29 18:36:25 +04:00
|
|
|
LIBXCB= ${DESTDIR}${X11USRLIBDIR}/libxcb.a
|
2013-05-31 10:48:43 +04:00
|
|
|
|
2005-01-12 03:32:59 +03:00
|
|
|
.if defined(RESCUEDIR)
|
|
|
|
CPPFLAGS+= -DRESCUEDIR=\"${RESCUEDIR}\"
|
|
|
|
.endif
|
|
|
|
|
* Add user-controlled mk.conf variables
- SHLIBDIR Location to install shared libraries if ${USE_SHLIBDIR}
is "yes". Defaults to "/usr/lib".
- USE_SHLIBDIR If "yes", install shared libraries in ${SHLIBDIR}
instead of ${LIBDIR}. Defaults to "no".
Sets ${_LIBSODIR} to the appropriate value.
This may be set by individual Makefiles as well.
- SHLINKDIR Location of shared linker. Defaults to "/usr/libexec".
If != "/usr/libexec", change the dynamic-linker
encoded in shared programs
* Set USE_SHLIBDIR for libraries used by /bin and /sbin:
libc libcrypt libcrypto libedit libipsec libkvm libm libmi387
libtermcap libutil libz
* If ${_LIBSODIR} != ${LIBDIR}, add symlinks from ${LIBDIR}/${LIB}.so*
to ${_LIBSODIR}/${LIB}.so* for compatibility.
* Always install /sbin/init statically (for now)
The net effect of these changes depends on how the variables are set:
1.) If nothing is set or changed, there is no change from the
current behaviour:
- Static /bin, /sbin, and bits of /usr/*
- Dynamic rest
- Shared linker is /usr/libexec/ld*so
2.) If the following make variables are set:
LDSTATIC=
SHLINKDIR=/lib
SHLIBDIR=/lib
Then the behaviour becomes:
- Dynamic tools
- .so libraries used by /bin and /sbin are installed to /lib,
with symlinks from /usr/lib/lib*so to -> /lib/lib*so
where appropriate
- Shared linker is /lib/ld*so
3.) As per 2.), but add the following variable:
USE_SHLIBDIR=yes
This forces all .so's to be instaleld in /lib (with compat
symlinks), not just those tagged by their Makefiles to be.
Again, compat symlinks are installed
2001-12-28 04:32:37 +03:00
|
|
|
_PROGLDOPTS=
|
|
|
|
.if ${SHLINKDIR} != "/usr/libexec" # XXX: change or remove if ld.so moves
|
|
|
|
_PROGLDOPTS+= -Wl,-dynamic-linker=${_SHLINKER}
|
|
|
|
.endif
|
2003-09-15 02:36:55 +04:00
|
|
|
.if ${SHLIBDIR} != "/usr/lib"
|
2011-04-12 03:03:38 +04:00
|
|
|
_PROGLDOPTS+= -Wl,-rpath,${SHLIBDIR} \
|
2011-04-10 20:52:36 +04:00
|
|
|
-L=${SHLIBDIR}
|
2012-08-24 01:21:14 +04:00
|
|
|
.elif ${SHLIBINSTALLDIR} != "/usr/lib"
|
|
|
|
_PROGLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \
|
|
|
|
-L=${SHLIBINSTALLDIR}
|
* Add user-controlled mk.conf variables
- SHLIBDIR Location to install shared libraries if ${USE_SHLIBDIR}
is "yes". Defaults to "/usr/lib".
- USE_SHLIBDIR If "yes", install shared libraries in ${SHLIBDIR}
instead of ${LIBDIR}. Defaults to "no".
Sets ${_LIBSODIR} to the appropriate value.
This may be set by individual Makefiles as well.
- SHLINKDIR Location of shared linker. Defaults to "/usr/libexec".
If != "/usr/libexec", change the dynamic-linker
encoded in shared programs
* Set USE_SHLIBDIR for libraries used by /bin and /sbin:
libc libcrypt libcrypto libedit libipsec libkvm libm libmi387
libtermcap libutil libz
* If ${_LIBSODIR} != ${LIBDIR}, add symlinks from ${LIBDIR}/${LIB}.so*
to ${_LIBSODIR}/${LIB}.so* for compatibility.
* Always install /sbin/init statically (for now)
The net effect of these changes depends on how the variables are set:
1.) If nothing is set or changed, there is no change from the
current behaviour:
- Static /bin, /sbin, and bits of /usr/*
- Dynamic rest
- Shared linker is /usr/libexec/ld*so
2.) If the following make variables are set:
LDSTATIC=
SHLINKDIR=/lib
SHLIBDIR=/lib
Then the behaviour becomes:
- Dynamic tools
- .so libraries used by /bin and /sbin are installed to /lib,
with symlinks from /usr/lib/lib*so to -> /lib/lib*so
where appropriate
- Shared linker is /lib/ld*so
3.) As per 2.), but add the following variable:
USE_SHLIBDIR=yes
This forces all .so's to be instaleld in /lib (with compat
symlinks), not just those tagged by their Makefiles to be.
Again, compat symlinks are installed
2001-12-28 04:32:37 +03:00
|
|
|
.endif
|
|
|
|
|
2007-11-12 18:04:35 +03:00
|
|
|
__proginstall: .USE
|
|
|
|
${_MKTARGET_INSTALL}
|
|
|
|
${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
|
|
|
|
${STRIPFLAG} ${.ALLSRC} ${.TARGET}
|
|
|
|
|
2010-12-13 20:22:26 +03:00
|
|
|
__progrumpinstall: .USE
|
|
|
|
${_MKTARGET_INSTALL}
|
|
|
|
${INSTALL_FILE} -o ${RUMPBINOWN} -g ${RUMPBINGRP} -m ${RUMPBINMODE} \
|
|
|
|
${STRIPFLAG} ${.ALLSRC} ${.TARGET}
|
|
|
|
|
2007-11-12 18:04:35 +03:00
|
|
|
__progdebuginstall: .USE
|
|
|
|
${_MKTARGET_INSTALL}
|
|
|
|
${INSTALL_FILE} -o ${DEBUGOWN} -g ${DEBUGGRP} -m ${DEBUGMODE} \
|
|
|
|
${.ALLSRC} ${.TARGET}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Backwards compatibility with Makefiles that assume that bsd.prog.mk
|
|
|
|
# can only build a single binary.
|
|
|
|
#
|
|
|
|
|
|
|
|
_APPEND_MANS=yes
|
|
|
|
_APPEND_SRCS=yes
|
|
|
|
|
2008-08-25 12:03:14 +04:00
|
|
|
_CCLINKFLAGS=
|
|
|
|
|
2002-01-01 03:27:06 +03:00
|
|
|
.if defined(PROG_CXX)
|
2007-11-12 18:04:35 +03:00
|
|
|
PROG= ${PROG_CXX}
|
2008-08-25 12:03:14 +04:00
|
|
|
_CCLINK= ${CXX} ${_CCLINKFLAGS}
|
2002-01-01 03:27:06 +03:00
|
|
|
.endif
|
|
|
|
|
2010-12-13 20:22:26 +03:00
|
|
|
.if defined(RUMPPRG)
|
2016-01-24 00:22:45 +03:00
|
|
|
CPPFLAGS+= -D_KERNTYPES
|
2010-12-13 20:22:26 +03:00
|
|
|
PROG= ${RUMPPRG}
|
2012-08-08 17:56:13 +04:00
|
|
|
. ifndef CRUNCHEDPROG
|
|
|
|
. if (${MKRUMP} != "no")
|
2010-12-13 20:22:26 +03:00
|
|
|
PROGS= ${RUMPPRG} rump.${RUMPPRG}
|
2012-08-08 17:56:13 +04:00
|
|
|
. else
|
|
|
|
PROGS= ${RUMPPRG}
|
|
|
|
. endif
|
|
|
|
. if defined(SRCS)
|
|
|
|
. if (${MKRUMP} != "no")
|
2010-12-13 20:22:26 +03:00
|
|
|
SRCS.rump.${PROG}:= ${SRCS} ${PROG}_rumpops.c ${RUMPSRCS}
|
2012-08-08 17:56:13 +04:00
|
|
|
. endif
|
2010-12-13 20:22:26 +03:00
|
|
|
SRCS+= ${PROG}_hostops.c
|
2012-08-08 17:56:13 +04:00
|
|
|
. else
|
2010-12-13 20:22:26 +03:00
|
|
|
SRCS= ${PROG}.c ${PROG}_hostops.c
|
2012-08-08 17:56:13 +04:00
|
|
|
. if (${MKRUMP} != "no")
|
2010-12-13 20:22:26 +03:00
|
|
|
SRCS.rump.${PROG}= ${PROG}.c ${PROG}_rumpops.c ${RUMPSRCS}
|
2012-08-08 17:56:13 +04:00
|
|
|
. endif
|
|
|
|
. endif
|
|
|
|
. if (${MKRUMP} != "no")
|
2011-01-17 21:05:52 +03:00
|
|
|
DPSRCS+= ${PROG}_rumpops.c ${RUMPSRCS}
|
2017-10-10 22:29:44 +03:00
|
|
|
LDADD.rump.${PROG}+= ${LDADD.rump} -lrumpclient
|
|
|
|
DPADD.rump.${PROG}+= ${DPADD.rump} ${LIBRUMPCLIENT}
|
2010-12-13 20:22:26 +03:00
|
|
|
MAN.rump.${PROG}= # defined but feeling empty
|
|
|
|
_RUMPINSTALL.rump.${PROG}=# defined
|
2012-08-08 17:56:13 +04:00
|
|
|
. endif
|
|
|
|
. else # CRUNCHEDPROG
|
2010-12-14 00:47:04 +03:00
|
|
|
PROGS= ${PROG}
|
|
|
|
CPPFLAGS+= -DCRUNCHOPS
|
2012-08-08 17:56:13 +04:00
|
|
|
. endif
|
2010-12-13 20:22:26 +03:00
|
|
|
.endif
|
|
|
|
|
2007-11-12 18:04:35 +03:00
|
|
|
.if defined(PROG)
|
2008-08-25 12:03:14 +04:00
|
|
|
_CCLINK?= ${CC} ${_CCLINKFLAGS}
|
2007-11-12 18:04:35 +03:00
|
|
|
. if defined(MAN)
|
|
|
|
MAN.${PROG}= ${MAN}
|
|
|
|
_APPEND_MANS= no
|
|
|
|
. endif
|
|
|
|
. if !defined(OBJS)
|
|
|
|
OBJS= ${OBJS.${PROG}}
|
|
|
|
. endif
|
|
|
|
. if defined(PROGNAME)
|
|
|
|
PROGNAME.${PROG}= ${PROGNAME}
|
|
|
|
. endif
|
|
|
|
. if defined(SRCS)
|
|
|
|
SRCS.${PROG}= ${SRCS}
|
|
|
|
_APPEND_SRCS= no
|
|
|
|
. endif
|
2006-07-23 15:41:24 +04:00
|
|
|
.endif
|
|
|
|
|
2007-11-12 18:04:35 +03:00
|
|
|
# Turn the single-program PROG and PROG_CXX variables into their multi-word
|
|
|
|
# counterparts, PROGS and PROGS_CXX.
|
2010-12-13 20:22:26 +03:00
|
|
|
.if !defined(RUMPPRG)
|
|
|
|
. if defined(PROG_CXX) && !defined(PROGS_CXX)
|
2007-11-12 18:04:35 +03:00
|
|
|
PROGS_CXX= ${PROG_CXX}
|
2011-03-08 10:53:43 +03:00
|
|
|
. elif defined(PROG) && !defined(PROGS)
|
2007-11-12 18:04:35 +03:00
|
|
|
PROGS= ${PROG}
|
2010-12-13 20:22:26 +03:00
|
|
|
. endif
|
2002-09-08 07:59:02 +04:00
|
|
|
.endif
|
2007-11-12 18:04:35 +03:00
|
|
|
|
2013-02-14 05:58:00 +04:00
|
|
|
##### Libraries that this may depend upon.
|
|
|
|
.if defined(PROGDPLIBS) # {
|
|
|
|
.for _lib _dir in ${PROGDPLIBS}
|
|
|
|
.if !defined(BINDO.${_lib})
|
2013-02-14 07:02:47 +04:00
|
|
|
PROGDO.${_lib}!= cd "${_dir}" && ${PRINTOBJDIR}
|
|
|
|
.MAKEOVERRIDES+=PROGDO.${_lib}
|
2013-02-14 05:58:00 +04:00
|
|
|
.endif
|
2013-02-14 07:02:47 +04:00
|
|
|
LDADD+= -L${PROGDO.${_lib}} -l${_lib}
|
|
|
|
.if exists(${PROGDO.${_lib}}/lib${_lib}_pic.a)
|
|
|
|
DPADD+= ${PROGDO.${_lib}}/lib${_lib}_pic.a
|
|
|
|
.elif exists(${PROGDO.${_lib}}/lib${_lib}.so)
|
|
|
|
DPADD+= ${PROGDO.${_lib}}/lib${_lib}.so
|
2013-02-14 05:58:00 +04:00
|
|
|
.else
|
2013-02-14 07:02:47 +04:00
|
|
|
DPADD+= ${PROGDO.${_lib}}/lib${_lib}.a
|
2013-02-14 05:58:00 +04:00
|
|
|
.endif
|
|
|
|
.endfor
|
|
|
|
.endif # }
|
2007-11-12 18:04:35 +03:00
|
|
|
#
|
|
|
|
# Per-program definitions and targets.
|
|
|
|
#
|
|
|
|
|
2012-02-20 03:19:37 +04:00
|
|
|
_CCLINK.CDEFAULT= ${CC} ${_CCLINKFLAGS}
|
2007-11-12 18:04:35 +03:00
|
|
|
# Definitions specific to C programs.
|
|
|
|
.for _P in ${PROGS}
|
|
|
|
SRCS.${_P}?= ${_P}.c
|
2008-08-25 12:03:14 +04:00
|
|
|
_CCLINK.${_P}= ${CC} ${_CCLINKFLAGS}
|
2012-02-20 03:19:37 +04:00
|
|
|
_CFLAGS.${_P}= ${CFLAGS} ${CPUFLAGS}
|
|
|
|
_CPPFLAGS.${_P}= ${CPPFLAGS}
|
|
|
|
_COPTS.${_P}= ${COPTS}
|
2002-09-08 07:59:02 +04:00
|
|
|
.endfor
|
|
|
|
|
2012-02-20 03:19:37 +04:00
|
|
|
_CCLINK.CXXDEFAULT= ${CXX} ${_CCLINKFLAGS}
|
2007-11-12 18:04:35 +03:00
|
|
|
# Definitions specific to C++ programs.
|
|
|
|
.for _P in ${PROGS_CXX}
|
|
|
|
SRCS.${_P}?= ${_P}.cc
|
2008-08-25 12:03:14 +04:00
|
|
|
_CCLINK.${_P}= ${CXX} ${_CCLINKFLAGS}
|
2007-11-12 18:04:35 +03:00
|
|
|
.endfor
|
|
|
|
|
|
|
|
# Language-independent definitions.
|
|
|
|
.for _P in ${PROGS} ${PROGS_CXX} # {
|
|
|
|
|
|
|
|
BINDIR.${_P}?= ${BINDIR}
|
|
|
|
PROGNAME.${_P}?= ${_P}
|
|
|
|
|
2017-12-10 18:11:47 +03:00
|
|
|
.if ${MKDEBUG:Uno} != "no" && !defined(NODEBUG) && !commands(${_P}) && \
|
2017-12-11 16:08:47 +03:00
|
|
|
empty(SRCS.${_P}:M*.sh)
|
2007-11-12 18:04:35 +03:00
|
|
|
_PROGDEBUG.${_P}:= ${PROGNAME.${_P}}.debug
|
|
|
|
.endif
|
2003-08-01 21:03:41 +04:00
|
|
|
|
2019-08-17 03:14:48 +03:00
|
|
|
# paxctl specific arguments
|
|
|
|
|
2007-11-12 18:04:35 +03:00
|
|
|
.if defined(PAXCTL_FLAGS)
|
|
|
|
PAXCTL_FLAGS.${_P}?= ${PAXCTL_FLAGS}
|
|
|
|
.endif
|
|
|
|
|
2019-08-17 03:14:48 +03:00
|
|
|
.if ${MKSANITIZER:Uno} == "yes" && \
|
|
|
|
(${USE_SANITIZER} == "address" || ${USE_SANITIZER} == "thread" || \
|
|
|
|
${USE_SANITIZER} == "memory")
|
|
|
|
PAXCTL_FLAGS.${_P}= +a
|
|
|
|
.endif
|
|
|
|
|
2007-11-12 18:04:35 +03:00
|
|
|
##### PROG specific flags.
|
2009-12-08 18:18:42 +03:00
|
|
|
|
2012-08-25 00:26:24 +04:00
|
|
|
_DPADD.${_P}= ${DPADD} ${DPADD.${_P}}
|
2007-11-12 18:04:35 +03:00
|
|
|
_LDADD.${_P}= ${LDADD} ${LDADD.${_P}}
|
|
|
|
_LDFLAGS.${_P}= ${LDFLAGS} ${LDFLAGS.${_P}}
|
2018-06-02 18:19:45 +03:00
|
|
|
.if ${MKSANITIZER} != "yes"
|
|
|
|
# Sanitizers don't support static build.
|
2007-11-12 18:04:35 +03:00
|
|
|
_LDSTATIC.${_P}= ${LDSTATIC} ${LDSTATIC.${_P}}
|
2018-06-02 18:19:45 +03:00
|
|
|
.endif
|
2007-11-12 18:04:35 +03:00
|
|
|
|
|
|
|
##### Build and install rules
|
|
|
|
.if !empty(_APPEND_SRCS:M[Yy][Ee][Ss])
|
2012-02-20 03:19:37 +04:00
|
|
|
SRCS+= ${SRCS.${_P}} # For bsd.dep.mk
|
2007-11-12 18:04:35 +03:00
|
|
|
.endif
|
|
|
|
|
|
|
|
_YPSRCS.${_P}= ${SRCS.${_P}:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS.${_P}:M*.y:.y=.h}}
|
|
|
|
|
|
|
|
DPSRCS+= ${_YPSRCS.${_P}}
|
|
|
|
CLEANFILES+= ${_YPSRCS.${_P}}
|
|
|
|
|
|
|
|
.if !empty(SRCS.${_P}:N*.h:N*.sh:N*.fth)
|
|
|
|
OBJS.${_P}+= ${SRCS.${_P}:N*.h:N*.sh:N*.fth:R:S/$/.o/g}
|
|
|
|
LOBJS.${_P}+= ${LSRCS:.c=.ln} ${SRCS.${_P}:M*.c:.c=.ln}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if defined(OBJS.${_P}) && !empty(OBJS.${_P}) # {
|
|
|
|
.NOPATH: ${OBJS.${_P}} ${_P} ${_YPSRCS.${_P}}
|
|
|
|
|
2012-02-20 03:19:37 +04:00
|
|
|
.if (defined(USE_COMBINE) && ${USE_COMBINE} != "no" && !commands(${_P}) \
|
|
|
|
&& (${_CCLINK.${_P}} == ${_CCLINK.CDEFAULT} \
|
|
|
|
|| ${_CCLINK.${_P}} == ${_CCLINK.CXXDEFAULT}) \
|
|
|
|
&& !defined(NOCOMBINE.${_P}) && !defined(NOCOMBINE))
|
|
|
|
.for f in ${SRCS.${_P}:N*.h:N*.sh:N*.fth:C/\.[yl]$/.c/g}
|
|
|
|
#_XFLAGS.$f := ${CPPFLAGS.$f:D1} ${CPUFLAGS.$f:D2} \
|
|
|
|
# ${COPTS.$f:D3} ${OBJCOPTS.$f:D4} ${CXXFLAGS.$f:D5}
|
|
|
|
.if (${CPPFLAGS.$f:D1} == "1" || ${CPUFLAGS.$f:D2} == "2" \
|
|
|
|
|| ${COPTS.$f:D3} == "3" || ${OBJCOPTS.$f:D4} == "4" \
|
|
|
|
|| ${CXXFLAGS.$f:D5} == "5") \
|
|
|
|
|| ("${f:M*.[cyl]}" == "" || commands(${f:R:S/$/.o/}))
|
|
|
|
XOBJS.${_P}+= ${f:R:S/$/.o/}
|
|
|
|
.else
|
|
|
|
XSRCS.${_P}+= ${f}
|
|
|
|
NODPSRCS+= ${f}
|
|
|
|
.endif
|
|
|
|
.endfor
|
|
|
|
|
2013-11-11 14:24:53 +04:00
|
|
|
${_P}: .gdbinit ${LIBCRT0} ${LIBCRTI} ${XOBJS.${_P}} ${SRCS.${_P}} \
|
|
|
|
${DPSRCS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${_DPADD.${_P}}
|
2012-02-20 03:19:37 +04:00
|
|
|
${_MKTARGET_LINK}
|
|
|
|
.if defined(DESTDIR)
|
|
|
|
${_CCLINK.${_P}} -Wl,-nostdlib \
|
|
|
|
${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} ${_PROGLDOPTS} \
|
|
|
|
-B${_GCC_CRTDIR}/ -B${DESTDIR}/usr/lib/ \
|
|
|
|
-MD --combine ${_CPPFLAGS.${_P}} ${_CFLAGS.${_P}} ${_COPTS.${_P}} \
|
|
|
|
${XSRCS.${_P}:@.SRC.@${.ALLSRC:M*.c:M*${.SRC.}}@:O:u} ${XOBJS.${_P}} \
|
|
|
|
${_LDADD.${_P}} -L${_GCC_LIBGCCDIR} -L${DESTDIR}/usr/lib
|
|
|
|
.else
|
|
|
|
${_CCLINK.${_P}} ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} ${_PROGLDOPTS} \
|
|
|
|
-MD --combine ${_CPPFLAGS.${_P}} ${_COPTS.${_P}}
|
|
|
|
${XSRCS.${_P}:@.SRC.@${.ALLSRC:M*.c:M*${.SRC.}}@:O:u} ${XOBJS.${_P}} \
|
|
|
|
${_LDADD.${_P}}
|
|
|
|
.endif # defined(DESTDIR)
|
|
|
|
.if defined(CTFMERGE)
|
|
|
|
${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${_P}}
|
|
|
|
.endif
|
|
|
|
.if defined(PAXCTL_FLAGS.${_P})
|
|
|
|
${PAXCTL} ${PAXCTL_FLAGS.${_P}} ${.TARGET}
|
|
|
|
.endif
|
|
|
|
.if ${MKSTRIPIDENT} != "no"
|
|
|
|
${OBJCOPY} -R .ident ${.TARGET}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
CLEANFILES+= ${_P}.d
|
|
|
|
.if exists(${_P}.d)
|
|
|
|
.include "${_P}.d" # include -MD depend for program.
|
|
|
|
.endif
|
|
|
|
.else # USE_COMBINE
|
|
|
|
|
2007-11-12 18:04:35 +03:00
|
|
|
${OBJS.${_P}} ${LOBJS.${_P}}: ${DPSRCS}
|
|
|
|
|
2013-11-11 14:24:53 +04:00
|
|
|
${_P}: .gdbinit ${LIBCRT0} ${LIBCRTI} ${OBJS.${_P}} ${LIBC} ${LIBCRTBEGIN} \
|
|
|
|
${LIBCRTEND} ${_DPADD.${_P}}
|
2007-11-12 18:04:35 +03:00
|
|
|
.if !commands(${_P})
|
2003-11-16 17:09:00 +03:00
|
|
|
${_MKTARGET_LINK}
|
2008-08-25 12:03:14 +04:00
|
|
|
${_CCLINK.${_P}} \
|
2008-08-27 05:15:22 +04:00
|
|
|
${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} \
|
2013-04-05 01:14:36 +04:00
|
|
|
${OBJS.${_P}} ${_PROGLDOPTS} ${_LDADD.${_P}}
|
2010-03-02 23:49:18 +03:00
|
|
|
.if defined(CTFMERGE)
|
|
|
|
${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${_P}}
|
|
|
|
.endif
|
2007-11-12 18:04:35 +03:00
|
|
|
.if defined(PAXCTL_FLAGS.${_P})
|
|
|
|
${PAXCTL} ${PAXCTL_FLAGS.${_P}} ${.TARGET}
|
2006-11-10 20:13:15 +03:00
|
|
|
.endif
|
2008-09-09 15:54:19 +04:00
|
|
|
.if ${MKSTRIPIDENT} != "no"
|
|
|
|
${OBJCOPY} -R .ident ${.TARGET}
|
|
|
|
.endif
|
2007-11-12 18:04:35 +03:00
|
|
|
.endif # !commands(${_P})
|
2012-02-20 03:19:37 +04:00
|
|
|
.endif # USE_COMBINE
|
2003-08-01 17:08:35 +04:00
|
|
|
|
2012-08-25 00:26:24 +04:00
|
|
|
${_P}.ro: ${OBJS.${_P}} ${_DPADD.${_P}}
|
2005-04-09 17:00:53 +04:00
|
|
|
${_MKTARGET_LINK}
|
2016-03-30 16:05:09 +03:00
|
|
|
${CC} ${LDFLAGS:N-pie} -nostdlib -r -Wl,-dc -o ${.TARGET} ${OBJS.${_P}}
|
2003-08-22 23:17:00 +04:00
|
|
|
|
2007-11-12 18:04:35 +03:00
|
|
|
.if defined(_PROGDEBUG.${_P})
|
2007-11-13 16:57:53 +03:00
|
|
|
${_PROGDEBUG.${_P}}: ${_P}
|
2006-07-23 15:41:24 +04:00
|
|
|
${_MKTARGET_CREATE}
|
2010-11-08 09:54:52 +03:00
|
|
|
( ${OBJCOPY} --only-keep-debug ${_P} ${_PROGDEBUG.${_P}} \
|
|
|
|
&& ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \
|
|
|
|
--add-gnu-debuglink=${_PROGDEBUG.${_P}} ${_P} \
|
|
|
|
) || (rm -f ${_PROGDEBUG.${_P}}; false)
|
2006-07-23 15:41:24 +04:00
|
|
|
.endif
|
|
|
|
|
2007-11-12 18:04:35 +03:00
|
|
|
.endif # defined(OBJS.${_P}) && !empty(OBJS.${_P}) # }
|
2001-09-24 05:04:32 +04:00
|
|
|
|
2007-11-12 18:04:35 +03:00
|
|
|
.if !defined(MAN.${_P})
|
|
|
|
MAN.${_P}= ${_P}.1
|
|
|
|
.endif # !defined(MAN.${_P})
|
|
|
|
.if !empty(_APPEND_MANS:M[Yy][Ee][Ss])
|
|
|
|
MAN+= ${MAN.${_P}}
|
2001-09-24 13:18:05 +04:00
|
|
|
.endif
|
2001-09-24 05:04:32 +04:00
|
|
|
|
2007-11-12 18:04:35 +03:00
|
|
|
realall: ${_P} ${_PROGDEBUG.${_P}}
|
1993-03-21 12:45:37 +03:00
|
|
|
|
2011-09-10 20:57:35 +04:00
|
|
|
CLEANFILES+= ${_P} ${_PROGDEBUG.${_P}}
|
2000-06-06 13:22:00 +04:00
|
|
|
|
2007-11-12 18:04:35 +03:00
|
|
|
.if defined(OBJS.${_P}) && !empty(OBJS.${_P})
|
2011-09-10 20:57:35 +04:00
|
|
|
CLEANFILES+= ${OBJS.${_P}} ${LOBJS.${_P}}
|
2007-11-12 18:04:35 +03:00
|
|
|
.endif
|
2000-06-06 13:22:00 +04:00
|
|
|
|
2007-11-12 18:04:35 +03:00
|
|
|
_PROG_INSTALL+= proginstall-${_P}
|
2000-06-06 13:53:29 +04:00
|
|
|
|
2007-11-12 18:04:35 +03:00
|
|
|
.if !target(proginstall-${_P}) # {
|
|
|
|
proginstall-${_P}:: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}} \
|
|
|
|
${_PROGDEBUG.${_P}:D${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}}
|
|
|
|
.PRECIOUS: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}} \
|
|
|
|
${_PROGDEBUG.${_P}:D${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}}
|
2006-07-23 15:41:24 +04:00
|
|
|
|
2003-07-18 12:26:01 +04:00
|
|
|
.if ${MKUPDATE} == "no"
|
2010-12-13 20:22:26 +03:00
|
|
|
.if defined(_RUMPINSTALL.${_P})
|
|
|
|
${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! ${_P} __progrumpinstall
|
|
|
|
.else
|
2007-11-12 18:04:35 +03:00
|
|
|
${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! ${_P} __proginstall
|
2010-12-13 20:22:26 +03:00
|
|
|
.endif
|
2007-11-12 18:04:35 +03:00
|
|
|
.if !defined(BUILD) && !make(all) && !make(${_P})
|
|
|
|
${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! .MADE
|
1993-03-21 12:45:37 +03:00
|
|
|
.endif
|
2007-11-12 18:04:35 +03:00
|
|
|
.if defined(_PROGDEBUG.${_P})
|
|
|
|
${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}! ${_PROGDEBUG.${_P}} __progdebuginstall
|
|
|
|
.if !defined(BUILD) && !make(all) && !make(${_P})
|
|
|
|
${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}! .MADE
|
2006-07-23 15:41:24 +04:00
|
|
|
.endif
|
2007-11-12 18:04:35 +03:00
|
|
|
.endif # define(_PROGDEBUG.${_P})
|
2006-07-23 15:41:24 +04:00
|
|
|
.else # MKUPDATE != no
|
2010-12-13 20:22:26 +03:00
|
|
|
.if defined(_RUMPINSTALL.${_P})
|
|
|
|
${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: ${_P} __progrumpinstall
|
|
|
|
.else
|
2007-11-12 18:04:35 +03:00
|
|
|
${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: ${_P} __proginstall
|
2010-12-13 20:22:26 +03:00
|
|
|
.endif
|
2007-11-12 18:04:35 +03:00
|
|
|
.if !defined(BUILD) && !make(all) && !make(${_P})
|
|
|
|
${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: .MADE
|
2002-02-12 00:14:58 +03:00
|
|
|
.endif
|
2007-11-12 18:04:35 +03:00
|
|
|
.if defined(_PROGDEBUG.${_P})
|
|
|
|
${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}: ${_PROGDEBUG.${_P}} __progdebuginstall
|
|
|
|
.if !defined(BUILD) && !make(all) && !make(${_P})
|
|
|
|
${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}: .MADE
|
2002-02-12 00:14:58 +03:00
|
|
|
.endif
|
2007-11-12 18:04:35 +03:00
|
|
|
.endif # defined(_PROGDEBUG.${_P})
|
2006-07-23 15:41:24 +04:00
|
|
|
.endif # MKUPDATE != no
|
|
|
|
|
2007-11-12 18:04:35 +03:00
|
|
|
.endif # !target(proginstall-${_P}) # }
|
|
|
|
|
|
|
|
lint: lint-${_P}
|
|
|
|
lint-${_P}: ${LOBJS.${_P}}
|
|
|
|
.if defined(LOBJS.${_P}) && !empty(LOBJS.${_P})
|
|
|
|
${LINT} ${LINTFLAGS} ${_LDFLAGS.${_P}:C/-L[ ]*/-L/Wg:M-L*} ${LOBJS.${_P}} ${_LDADD.${_P}}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.endfor # _P in ${PROGS} ${PROGS_CXX} # }
|
1993-08-10 20:46:58 +04:00
|
|
|
|
2007-12-27 01:52:10 +03:00
|
|
|
.if defined(OBJS) && !empty(OBJS) && \
|
|
|
|
(empty(PROGS) && empty(PROGS_CXX))
|
2011-09-10 20:57:35 +04:00
|
|
|
CLEANFILES+= ${OBJS} ${LOBJS}
|
2007-12-27 01:52:10 +03:00
|
|
|
.endif
|
|
|
|
|
1997-05-07 19:53:28 +04:00
|
|
|
.if !target(proginstall)
|
2007-11-12 18:04:35 +03:00
|
|
|
proginstall:: ${_PROG_INSTALL}
|
1997-05-07 19:53:28 +04:00
|
|
|
.endif
|
2004-01-29 04:48:45 +03:00
|
|
|
.PHONY: proginstall
|
1997-05-07 19:53:28 +04:00
|
|
|
|
2007-11-12 18:04:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
realall: ${SCRIPTS}
|
2006-07-23 15:41:24 +04:00
|
|
|
.if defined(SCRIPTS) && !target(scriptsinstall) # {
|
1997-03-27 14:05:32 +03:00
|
|
|
SCRIPTSDIR?=${BINDIR}
|
|
|
|
SCRIPTSOWN?=${BINOWN}
|
|
|
|
SCRIPTSGRP?=${BINGRP}
|
|
|
|
SCRIPTSMODE?=${BINMODE}
|
2000-06-06 09:40:47 +04:00
|
|
|
|
|
|
|
scriptsinstall:: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
|
2000-06-06 13:22:00 +04:00
|
|
|
.PRECIOUS: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
|
2000-06-06 09:40:47 +04:00
|
|
|
|
2000-06-06 13:53:29 +04:00
|
|
|
__scriptinstall: .USE
|
2003-10-21 14:01:19 +04:00
|
|
|
${_MKTARGET_INSTALL}
|
2001-11-02 21:10:00 +03:00
|
|
|
${INSTALL_FILE} \
|
2000-06-10 18:12:03 +04:00
|
|
|
-o ${SCRIPTSOWN_${.ALLSRC:T}:U${SCRIPTSOWN}} \
|
|
|
|
-g ${SCRIPTSGRP_${.ALLSRC:T}:U${SCRIPTSGRP}} \
|
|
|
|
-m ${SCRIPTSMODE_${.ALLSRC:T}:U${SCRIPTSMODE}} \
|
2006-03-16 21:43:34 +03:00
|
|
|
${.ALLSRC} ${.TARGET}
|
2000-06-06 13:53:29 +04:00
|
|
|
|
2001-05-08 07:19:51 +04:00
|
|
|
.for S in ${SCRIPTS:O:u}
|
2003-07-18 12:26:01 +04:00
|
|
|
.if ${MKUPDATE} == "no"
|
2002-02-12 00:14:58 +03:00
|
|
|
${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! ${S} __scriptinstall
|
1999-09-05 01:48:33 +04:00
|
|
|
.if !defined(BUILD) && !make(all) && !make(${S})
|
2002-02-12 00:14:58 +03:00
|
|
|
${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! .MADE
|
1997-03-25 00:54:12 +03:00
|
|
|
.endif
|
2002-02-12 00:14:58 +03:00
|
|
|
.else
|
2000-06-06 13:53:29 +04:00
|
|
|
${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: ${S} __scriptinstall
|
2002-02-12 00:14:58 +03:00
|
|
|
.if !defined(BUILD) && !make(all) && !make(${S})
|
|
|
|
${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: .MADE
|
|
|
|
.endif
|
|
|
|
.endif
|
1997-03-25 00:54:12 +03:00
|
|
|
.endfor
|
2006-07-23 15:41:24 +04:00
|
|
|
.endif # }
|
1997-03-25 00:54:12 +03:00
|
|
|
|
1997-05-07 19:53:28 +04:00
|
|
|
.if !target(scriptsinstall)
|
|
|
|
scriptsinstall::
|
1993-03-21 12:45:37 +03:00
|
|
|
.endif
|
2004-01-29 04:48:45 +03:00
|
|
|
.PHONY: scriptsinstall
|
1993-03-21 12:45:37 +03:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
##### Pull in related .mk logic
|
2009-04-10 20:16:12 +04:00
|
|
|
LINKSOWN?= ${BINOWN}
|
|
|
|
LINKSGRP?= ${BINGRP}
|
|
|
|
LINKSMODE?= ${BINMODE}
|
1993-03-21 12:45:37 +03:00
|
|
|
.include <bsd.man.mk>
|
1995-04-22 00:29:40 +04:00
|
|
|
.include <bsd.nls.mk>
|
1997-03-27 20:33:34 +03:00
|
|
|
.include <bsd.files.mk>
|
1997-03-25 00:54:12 +03:00
|
|
|
.include <bsd.inc.mk>
|
1997-05-17 20:43:31 +04:00
|
|
|
.include <bsd.links.mk>
|
1995-10-22 03:45:53 +03:00
|
|
|
.include <bsd.sys.mk>
|
2003-07-31 17:47:32 +04:00
|
|
|
.include <bsd.dep.mk>
|
2011-08-27 22:35:19 +04:00
|
|
|
.include <bsd.clang-analyze.mk>
|
2011-09-10 20:57:35 +04:00
|
|
|
.include <bsd.clean.mk>
|
2008-11-24 05:13:08 +03:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
${TARGETS}: # ensure existence
|
2003-05-18 11:36:23 +04:00
|
|
|
|
|
|
|
.endif # HOSTPROG
|