2011-08-27 22:35:19 +04:00
|
|
|
# $NetBSD: bsd.prog.mk,v 1.266 2011/08/27 18:35:20 joerg 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>
|
1997-10-11 12:16:24 +04:00
|
|
|
|
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
|
2001-08-14 11:02:13 +04:00
|
|
|
clean: cleanprog
|
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
|
|
|
|
|
|
|
|
cleanobjs: .PHONY
|
|
|
|
|
|
|
|
cleanprog: .PHONY cleanobjs cleanextra
|
|
|
|
rm -f a.out [Ee]rrs mklog core *.core .gdbinit
|
|
|
|
|
|
|
|
.if defined(SHAREDSTRINGS)
|
|
|
|
CLEANFILES+=strings
|
|
|
|
.c.o:
|
|
|
|
${CC} -E ${CPPFLAGS} ${CFLAGS} ${.IMPSRC} | xstr -c -
|
|
|
|
@${CC} ${CPPFLAGS} ${CFLAGS} -c x.c -o ${.TARGET}
|
|
|
|
@rm -f x.c
|
|
|
|
|
|
|
|
.cc.o .cpp.o .cxx.o .C.o:
|
|
|
|
${CXX} -E ${CPPFLAGS} ${CXXFLAGS} ${.IMPSRC} | xstr -c -
|
|
|
|
@mv -f x.c x.cc
|
|
|
|
@${CXX} ${CPPFLAGS} ${CXXFLAGS} -c x.cc -o ${.TARGET}
|
|
|
|
@rm -f x.cc
|
|
|
|
.endif
|
2003-09-13 06:52:05 +04:00
|
|
|
|
2008-10-15 21:31:50 +04:00
|
|
|
.if defined(MKPIE) && (${MKPIE} != "no")
|
2008-10-16 18:36:42 +04:00
|
|
|
CFLAGS+= ${PIE_CFLAGS}
|
2008-10-19 19:22:50 +04:00
|
|
|
AFLAGS+= ${PIE_AFLAGS}
|
2008-10-16 18:36:42 +04:00
|
|
|
LDFLAGS+= ${PIE_LDFLAGS}
|
2008-10-15 21:31:50 +04:00
|
|
|
.endif
|
|
|
|
|
1993-08-15 23:37:04 +04:00
|
|
|
CFLAGS+= ${COPTS}
|
2006-05-12 03:47:34 +04:00
|
|
|
OBJCFLAGS+= ${OBJCOPTS}
|
2003-11-11 14:43:45 +03:00
|
|
|
MKDEP_SUFFIXES?= .o .ln
|
1993-03-21 12:45:37 +03:00
|
|
|
|
2010-03-02 23:49:18 +03:00
|
|
|
# CTF preserve debug symbols
|
|
|
|
.if defined(MKDTRACE) && (${MKDTRACE} != "no") && (${CFLAGS:M-g} != "")
|
|
|
|
CTFFLAGS+= -g
|
|
|
|
CTFMFLAGS+= -g
|
|
|
|
.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
|
2003-06-01 00:33:15 +04:00
|
|
|
LIBCRTBEGIN= ${DESTDIR}/usr/lib/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
|
2003-06-01 00:33:15 +04:00
|
|
|
LIBCRTEND= ${_GCC_CRTEND} ${DESTDIR}/usr/lib/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
|
|
|
|
LIBCRT0= ${DESTDIR}/usr/lib/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
|
|
|
|
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..
|
|
|
|
|
|
|
|
.for _lib in \
|
2007-07-29 21:06:00 +04:00
|
|
|
archive asn1 bluetooth bsdmalloc bz2 c c_pic cdk com_err compat \
|
|
|
|
crypt crypto crypto_idea crypto_mdc2 crypto_rc5 \
|
2005-01-08 12:53:38 +03:00
|
|
|
curses dbm des edit event \
|
2011-04-26 12:22:17 +04:00
|
|
|
fetch form fl g2c gcc gnumalloc gssapi hdb heimbase heimntlm hx509 \
|
|
|
|
intl ipsec \
|
2010-10-31 14:52:50 +03:00
|
|
|
kadm5clnt kadm5srv kafs krb5 kvm l lber ldap ldap_r lua \
|
2005-01-08 12:53:38 +03:00
|
|
|
m magic menu objc ossaudio pam pcap pci pmc posix pthread pthread_dbg \
|
2011-02-13 03:42:45 +03:00
|
|
|
puffs radius resolv rmt roken rpcsvc rt rump rumpuser saslc skey sl ss \
|
2008-07-29 17:17:40 +04:00
|
|
|
ssh ssl termcap usbhid util wrap y z bind9 dns lwres isccfg isccc isc \
|
|
|
|
\
|
|
|
|
rumpfs_cd9660fs rumpfs_efs rumpfs_ext2fs rumpfs_ffs rumpfs_hfs \
|
|
|
|
rumpfs_lfs rumpfs_msdosfs rumpfs_nfs rumpfs_ntfs rumpfs_syspuffs \
|
2011-04-26 12:22:17 +04:00
|
|
|
rumpfs_tmpfs rumpfs_udf rumpfs_ufs \
|
|
|
|
wind
|
2004-08-04 09:32:47 +04:00
|
|
|
.ifndef LIB${_lib:tu}
|
|
|
|
LIB${_lib:tu}= ${DESTDIR}/usr/lib/lib${_lib}.a
|
|
|
|
.MADE: ${LIB${_lib:tu}} # Note: ${DESTDIR} will be expanded
|
|
|
|
.endif
|
|
|
|
.endfor
|
2011-02-20 23:16:01 +03:00
|
|
|
# atf-c and atf-c++ are special cases because we cannot use [-+] as part of
|
|
|
|
# make(1) variable names. Just define them here.
|
|
|
|
LIBATF_C= ${DESTDIR}/usr/lib/libatf-c.a
|
|
|
|
LIBATF_CXX= ${DESTDIR}/usr/lib/libatf-c++.a
|
|
|
|
.MADE: ${LIBATF_C} ${LIBATF_CXX}
|
2004-08-04 09:32:47 +04:00
|
|
|
|
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
|
|
|
.if (${MKCRYPTO} != "no")
|
|
|
|
PAM_STATIC_LDADD+= -lssh
|
|
|
|
PAM_STATIC_DPADD+= ${LIBSSH}
|
|
|
|
.endif
|
|
|
|
.if (${MKKERBEROS} != "no")
|
2011-04-26 12:22:17 +04:00
|
|
|
PAM_STATIC_LDADD+= -lkafs -lkrb5 -lhx509 -lwind -lasn1 \
|
|
|
|
-lroken -lcom_err -lheimbase -lcrypto
|
|
|
|
PAM_STATIC_DPADD+= ${LIBKAFS} ${LIBKRB5} ${LIBHX509} ${LIBWIND} ${LIBASN1} \
|
|
|
|
${LIBROKEN} ${LIBCOM_ERR} ${LIBHEIMBASE} ${LIBCRYPTO}
|
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
|
|
|
|
|
2006-10-09 12:32:11 +04:00
|
|
|
# These need + -> X transformations
|
2004-08-04 09:32:47 +04:00
|
|
|
.ifndef LIBSTDCXX
|
|
|
|
LIBSTDCXX= ${DESTDIR}/usr/lib/libstdc++.a
|
|
|
|
.MADE: ${LIBSTDCXX}
|
|
|
|
.endif
|
|
|
|
|
2006-10-09 12:32:11 +04:00
|
|
|
.ifndef LIBSUPCXX
|
|
|
|
LIBSUPCXX= ${DESTDIR}/usr/lib/libsupc++.a
|
|
|
|
.MADE: ${LIBSUPCXX}
|
|
|
|
.endif
|
|
|
|
|
2004-08-04 09:32:47 +04:00
|
|
|
.for _lib in \
|
|
|
|
dps expat fntstubs fontcache fontconfig fontenc freetype FS \
|
|
|
|
GL GLU ICE lbxutil SM X11 Xau Xaw Xdmcp Xext Xfont Xft \
|
|
|
|
Xi Xinerama xkbfile Xmu Xmuu Xpm Xrandr Xrender Xss Xt \
|
|
|
|
XTrap Xtst Xv Xxf86dga Xxf86misc Xxf86vm
|
|
|
|
.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
|
|
|
|
|
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}
|
2003-09-15 02:36:55 +04:00
|
|
|
.elif ${SHLIBINSTALLDIR} != "/usr/lib"
|
2011-04-12 03:03:38 +04:00
|
|
|
_PROGLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \
|
2011-04-10 20:52:36 +04:00
|
|
|
-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)
|
|
|
|
PROG= ${RUMPPRG}
|
2010-12-14 00:47:04 +03:00
|
|
|
.ifndef CRUNCHEDPROG
|
2010-12-13 20:22:26 +03:00
|
|
|
PROGS= ${RUMPPRG} rump.${RUMPPRG}
|
|
|
|
. if defined(SRCS)
|
|
|
|
SRCS.rump.${PROG}:= ${SRCS} ${PROG}_rumpops.c ${RUMPSRCS}
|
|
|
|
SRCS+= ${PROG}_hostops.c
|
|
|
|
. else
|
|
|
|
SRCS= ${PROG}.c ${PROG}_hostops.c
|
|
|
|
SRCS.rump.${PROG}= ${PROG}.c ${PROG}_rumpops.c ${RUMPSRCS}
|
|
|
|
. endif
|
2011-01-17 21:05:52 +03:00
|
|
|
DPSRCS+= ${PROG}_rumpops.c ${RUMPSRCS}
|
2010-12-13 20:22:26 +03:00
|
|
|
LDADD.rump.${PROG}+= -lrumpclient
|
|
|
|
DPADD.rump.${PROG}+= ${LIBRUMPCLIENT}
|
|
|
|
MAN.rump.${PROG}= # defined but feeling empty
|
|
|
|
_RUMPINSTALL.rump.${PROG}=# defined
|
2010-12-14 00:47:04 +03:00
|
|
|
.else # CRUNCHEDPROG
|
|
|
|
PROGS= ${PROG}
|
|
|
|
CPPFLAGS+= -DCRUNCHOPS
|
|
|
|
.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
|
|
|
|
|
|
|
#
|
|
|
|
# Per-program definitions and targets.
|
|
|
|
#
|
|
|
|
|
|
|
|
# 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}
|
2002-09-08 07:59:02 +04:00
|
|
|
.endfor
|
|
|
|
|
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}
|
|
|
|
|
remove almost all the ability to build netbsd with an a.out target.
we're ELF now, and there are many missing checks against OBJECT_FMT.
if we ever consider switching, the we can figure out what new ones
we need but for now it's just clutter.
this doesn't remove any of the support for exec_aout or any actually
required-for-boot a.out support, only the ability to build a netbsd
release in a.out format. ie, most of this code has been dead for
over a decade.
i've tested builds on vax, amd64, i386, mac68k, macppc, sparc, atari,
amiga, shark, cats, dreamcast, landisk, mmeye and x68k. this covers
the 5 MACHINE_ARCH's affected, and all the other arch code touched.
it also includes some actual run-time testing of sparc, i386 and
shark, and i performed binary comparison upon amiga and x68k as well.
some minor details relevant:
- move shlib.[ch] from ld.aout_so into ldconfig proper, and cut them
down to only the parts ldconfig needs
- remove various unused source files
- switch amiga bootblocks to using elf2bb.h instead of aout2bb.h
2010-07-06 09:59:50 +04:00
|
|
|
.if ${MKDEBUG} != "no" && !commands(${_P})
|
2007-11-12 18:04:35 +03:00
|
|
|
_PROGDEBUG.${_P}:= ${PROGNAME.${_P}}.debug
|
|
|
|
.endif
|
2003-08-01 21:03:41 +04:00
|
|
|
|
2007-11-12 18:04:35 +03:00
|
|
|
.if defined(PAXCTL_FLAGS)
|
|
|
|
PAXCTL_FLAGS.${_P}?= ${PAXCTL_FLAGS}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
##### PROG specific flags.
|
2009-12-08 18:18:42 +03:00
|
|
|
|
2007-11-12 18:04:35 +03:00
|
|
|
_LDADD.${_P}= ${LDADD} ${LDADD.${_P}}
|
|
|
|
_LDFLAGS.${_P}= ${LDFLAGS} ${LDFLAGS.${_P}}
|
|
|
|
_LDSTATIC.${_P}= ${LDSTATIC} ${LDSTATIC.${_P}}
|
|
|
|
|
|
|
|
##### Build and install rules
|
|
|
|
.if !empty(_APPEND_SRCS:M[Yy][Ee][Ss])
|
|
|
|
SRCS+= ${SRCS.${_P}} # For bsd.dep.mk
|
|
|
|
.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}}
|
|
|
|
|
|
|
|
${OBJS.${_P}} ${LOBJS.${_P}}: ${DPSRCS}
|
|
|
|
|
|
|
|
${_P}: .gdbinit ${LIBCRT0} ${OBJS.${_P}} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
|
|
|
|
.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} \
|
|
|
|
${OBJS.${_P}} ${_LDADD.${_P}} \
|
|
|
|
${_PROGLDOPTS}
|
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})
|
2003-08-01 17:08:35 +04:00
|
|
|
|
2007-11-12 18:04:35 +03:00
|
|
|
${_P}.ro: ${OBJS.${_P}} ${DPADD}
|
2005-04-09 17:00:53 +04:00
|
|
|
${_MKTARGET_LINK}
|
2010-12-10 23:08:17 +03:00
|
|
|
${CC} ${LDFLAGS} -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
|
|
|
|
2007-11-12 18:04:35 +03:00
|
|
|
cleanprog: cleanprog-${_P}
|
|
|
|
cleanprog-${_P}:
|
|
|
|
rm -f ${_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})
|
|
|
|
cleanobjs: cleanobjs-${_P}
|
|
|
|
cleanobjs-${_P}:
|
|
|
|
rm -f ${OBJS.${_P}} ${LOBJS.${_P}}
|
|
|
|
.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))
|
|
|
|
cleanobjs: cleanobjs-plain
|
|
|
|
cleanobjs-plain:
|
|
|
|
rm -f ${OBJS} ${LOBJS}
|
|
|
|
.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>
|
1997-10-11 12:16:24 +04:00
|
|
|
|
2008-11-24 05:13:08 +03:00
|
|
|
cleanextra: .PHONY
|
|
|
|
.if defined(CLEANFILES) && !empty(CLEANFILES)
|
|
|
|
rm -f ${CLEANFILES}
|
|
|
|
.endif
|
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
${TARGETS}: # ensure existence
|
2003-05-18 11:36:23 +04:00
|
|
|
|
|
|
|
.endif # HOSTPROG
|