1994-08-04 21:09:27 +00:00
|
|
|
# from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91
|
1999-08-28 00:22:10 +00:00
|
|
|
# $FreeBSD$
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2002-04-17 13:49:29 +00:00
|
|
|
.include <bsd.init.mk>
|
2014-05-07 18:15:02 +00:00
|
|
|
.include <bsd.compiler.mk>
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2002-09-20 19:32:51 +00:00
|
|
|
.SUFFIXES: .out .o .c .cc .cpp .cxx .C .m .y .l .ln .s .S .asm
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2004-08-13 14:30:26 +00:00
|
|
|
# XXX The use of COPTS in modern makefiles is discouraged.
|
2003-08-31 15:20:17 +00:00
|
|
|
.if defined(COPTS)
|
|
|
|
CFLAGS+=${COPTS}
|
|
|
|
.endif
|
|
|
|
|
2006-09-11 05:35:57 +00:00
|
|
|
.if ${MK_ASSERT_DEBUG} == "no"
|
|
|
|
CFLAGS+= -DNDEBUG
|
2006-09-13 23:27:21 +00:00
|
|
|
NO_WERROR=
|
2006-09-11 05:35:57 +00:00
|
|
|
.endif
|
|
|
|
|
2003-08-31 15:20:17 +00:00
|
|
|
.if defined(DEBUG_FLAGS)
|
|
|
|
CFLAGS+=${DEBUG_FLAGS}
|
2010-02-18 03:32:51 +00:00
|
|
|
CXXFLAGS+=${DEBUG_FLAGS}
|
2008-05-22 01:14:43 +00:00
|
|
|
|
2011-11-30 18:11:49 +00:00
|
|
|
.if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != ""
|
2008-05-22 01:14:43 +00:00
|
|
|
CTFFLAGS+= -g
|
|
|
|
.endif
|
2003-08-31 15:20:17 +00:00
|
|
|
.endif
|
|
|
|
|
2013-06-07 21:40:02 +00:00
|
|
|
.if defined(PROG_CXX)
|
|
|
|
PROG= ${PROG_CXX}
|
|
|
|
.endif
|
|
|
|
|
2014-09-02 19:05:34 +00:00
|
|
|
.if !empty(LDFLAGS:M-Wl,*--oformat,*) || !empty(LDFLAGS:M-static)
|
2013-06-07 21:40:02 +00:00
|
|
|
MK_DEBUG_FILES= no
|
|
|
|
.endif
|
|
|
|
|
2003-08-31 15:20:17 +00:00
|
|
|
.if defined(CRUNCH_CFLAGS)
|
2003-06-29 18:16:26 +00:00
|
|
|
CFLAGS+=${CRUNCH_CFLAGS}
|
2013-06-07 21:40:02 +00:00
|
|
|
.else
|
|
|
|
.if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \
|
|
|
|
empty(DEBUG_FLAGS:M-gdwarf-*)
|
|
|
|
CFLAGS+= -g
|
|
|
|
CTFFLAGS+= -g
|
|
|
|
.endif
|
2003-08-31 15:20:17 +00:00
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
1994-09-16 14:30:25 +00:00
|
|
|
.if !defined(DEBUG_FLAGS)
|
1994-05-30 19:09:18 +00:00
|
|
|
STRIP?= -s
|
1994-09-16 14:30:25 +00:00
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2004-12-21 09:59:45 +00:00
|
|
|
.if defined(NO_SHARED) && (${NO_SHARED} != "no" && ${NO_SHARED} != "NO")
|
1994-08-04 21:09:27 +00:00
|
|
|
LDFLAGS+= -static
|
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2013-06-07 21:40:02 +00:00
|
|
|
.if ${MK_DEBUG_FILES} != "no"
|
|
|
|
PROG_FULL=${PROG}.full
|
|
|
|
# Use ${DEBUGDIR} for base system debug files, else .debug subdirectory
|
|
|
|
.if defined(BINDIR) && (\
|
|
|
|
${BINDIR} == "/bin" ||\
|
2015-10-14 19:19:44 +00:00
|
|
|
${BINDIR:C%/libexec(/.*)?%/libexec%} == "/libexec" ||\
|
2013-06-07 21:40:02 +00:00
|
|
|
${BINDIR} == "/sbin" ||\
|
2015-10-15 02:52:30 +00:00
|
|
|
${BINDIR:C%/usr/(bin|bsdinstall|libexec|lpr|sendmail|sm.bin|sbin|tests)(/.*)?%/usr/bin%} == "/usr/bin"\
|
2013-06-07 21:40:02 +00:00
|
|
|
)
|
|
|
|
DEBUGFILEDIR= ${DEBUGDIR}${BINDIR}
|
|
|
|
.else
|
|
|
|
DEBUGFILEDIR?= ${BINDIR}/.debug
|
|
|
|
DEBUGMKDIR=
|
|
|
|
.endif
|
|
|
|
.else
|
|
|
|
PROG_FULL= ${PROG}
|
2002-04-11 10:44:30 +00:00
|
|
|
.endif
|
|
|
|
|
1994-05-30 19:09:18 +00:00
|
|
|
.if defined(PROG)
|
2013-03-26 20:32:46 +00:00
|
|
|
PROGNAME?= ${PROG}
|
2013-06-07 21:40:02 +00:00
|
|
|
|
1994-05-30 19:09:18 +00:00
|
|
|
.if defined(SRCS)
|
|
|
|
|
1994-08-04 21:09:27 +00:00
|
|
|
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
|
|
|
|
|
2010-09-10 16:21:09 +00:00
|
|
|
.if target(beforelinking)
|
2012-12-31 21:54:43 +00:00
|
|
|
beforelinking: ${OBJS}
|
2013-06-07 21:40:02 +00:00
|
|
|
${PROG_FULL}: beforelinking
|
2010-09-10 16:21:09 +00:00
|
|
|
.endif
|
2013-06-07 21:40:02 +00:00
|
|
|
${PROG_FULL}: ${OBJS}
|
2002-04-12 16:25:13 +00:00
|
|
|
.if defined(PROG_CXX)
|
Add a FAST_DEPEND option, off by default, which speeds up the build significantly.
This speeds up buildworld by 16% on my system and buildkernel by 35%.
Rather than calling mkdep(1), which is just a wrapper around 'cc -E',
use the modern -MD -MT -MF flags to gather and generate dependencies during
compilation. This flag was introduced in GCC "a long time ago", in GCC 3.0,
and is also supported by Clang. (It appears that ICC also supports this but I
do not have access to test it). This avoids running the preprocessor *twice*
for every build, in both 'make depend' and 'make all'. This is especially
noticeable when using ccache since it does not cache preprocessor results from
mkdep(1) / 'cc -E', but still speeds up compilation with the -MD flags.
For 'make depend' a tree-walk is still done to ensure that all DPSRCS
are generated when expected, and that beforedepend/afterdepend and
_EXTRADEPEND are all still respected. In time this may change but for now
I've been conservative. The time for a tree-walk with -j combined with
SUBDIR_PARALLEL is not significant. For example, it takes about 9 seconds
with -j15 to walk all of src/ for 'make depend' now on my system.
A .depend file is still generated with the various rules that apply to
the final target, or custom rules. Otherwise there are now
per-built-object-file .depend files, such as .depend.filename.o. These
are included directly by make rather than populating .depend with a loop
and .depend lines, which only added overhead to the now almost-NOP 'make
depend' phase.
Before this I experimented with having mkdep(1) called in parallel per-file.
While this improved the kernel and lib/libc 'make depend' phase, it resulted
in slower build times overall.
The -M flags are removed from CFLAGS when linking since they have no effect.
Enabling this by default, for src or out-of-src, can be done once more testing
has been done, such as a ports exp-run, and with more compilers.
The system I used for testing was:
WITNESS
Build options: -j20 WITH_LLDB=yes WITH_DEBUG_FILES=yes WITH_FAST_DEPEND=yes
DISK: ZFS 3-way mirror with very slow disks using SSD l2arc/log.
The arc was fully populated with src tree files.
RAM: 76GiB
CPU: Intel(R) Xeon(R) CPU L5520 @2.27GHz
2 package(s) x 4 core(s) x 2 SMT threads = hw.ncpu=16
buildworld:
x buildworld-before
+ buildworld-fastdep
+-------------------------------------------------------------------------------+
|+ |
|+ |
|+ xx x|
| |_MA___||
|A |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 3744.13 3794.31 3752.25 3763.5633 26.935139
+ 3 3153.34 3155.16 3154.2 3154.2333 0.91045776
Difference at 95.0% confidence
-609.33 +/- 43.1943
-16.1902% +/- 1.1477%
(Student's t, pooled s = 19.0569)
buildkernel:
x buildkernel-before
+ buildkernel-fastdep
+-------------------------------------------------------------------------------+
|+ x |
|++ xx|
| A||
|A| |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 571.57 573.94 571.79 572.43333 1.3094401
+ 3 369.12 370.57 369.3 369.66333 0.79033748
Difference at 95.0% confidence
-202.77 +/- 2.45131
-35.4225% +/- 0.428227%
(Student's t, pooled s = 1.0815)
Sponsored by: EMC / Isilon Storage Division
MFC after: 3 weeks
Relnotes: yes
2015-11-06 04:45:29 +00:00
|
|
|
${CXX} ${CXXFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
|
2002-04-12 16:25:13 +00:00
|
|
|
.else
|
Add a FAST_DEPEND option, off by default, which speeds up the build significantly.
This speeds up buildworld by 16% on my system and buildkernel by 35%.
Rather than calling mkdep(1), which is just a wrapper around 'cc -E',
use the modern -MD -MT -MF flags to gather and generate dependencies during
compilation. This flag was introduced in GCC "a long time ago", in GCC 3.0,
and is also supported by Clang. (It appears that ICC also supports this but I
do not have access to test it). This avoids running the preprocessor *twice*
for every build, in both 'make depend' and 'make all'. This is especially
noticeable when using ccache since it does not cache preprocessor results from
mkdep(1) / 'cc -E', but still speeds up compilation with the -MD flags.
For 'make depend' a tree-walk is still done to ensure that all DPSRCS
are generated when expected, and that beforedepend/afterdepend and
_EXTRADEPEND are all still respected. In time this may change but for now
I've been conservative. The time for a tree-walk with -j combined with
SUBDIR_PARALLEL is not significant. For example, it takes about 9 seconds
with -j15 to walk all of src/ for 'make depend' now on my system.
A .depend file is still generated with the various rules that apply to
the final target, or custom rules. Otherwise there are now
per-built-object-file .depend files, such as .depend.filename.o. These
are included directly by make rather than populating .depend with a loop
and .depend lines, which only added overhead to the now almost-NOP 'make
depend' phase.
Before this I experimented with having mkdep(1) called in parallel per-file.
While this improved the kernel and lib/libc 'make depend' phase, it resulted
in slower build times overall.
The -M flags are removed from CFLAGS when linking since they have no effect.
Enabling this by default, for src or out-of-src, can be done once more testing
has been done, such as a ports exp-run, and with more compilers.
The system I used for testing was:
WITNESS
Build options: -j20 WITH_LLDB=yes WITH_DEBUG_FILES=yes WITH_FAST_DEPEND=yes
DISK: ZFS 3-way mirror with very slow disks using SSD l2arc/log.
The arc was fully populated with src tree files.
RAM: 76GiB
CPU: Intel(R) Xeon(R) CPU L5520 @2.27GHz
2 package(s) x 4 core(s) x 2 SMT threads = hw.ncpu=16
buildworld:
x buildworld-before
+ buildworld-fastdep
+-------------------------------------------------------------------------------+
|+ |
|+ |
|+ xx x|
| |_MA___||
|A |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 3744.13 3794.31 3752.25 3763.5633 26.935139
+ 3 3153.34 3155.16 3154.2 3154.2333 0.91045776
Difference at 95.0% confidence
-609.33 +/- 43.1943
-16.1902% +/- 1.1477%
(Student's t, pooled s = 19.0569)
buildkernel:
x buildkernel-before
+ buildkernel-fastdep
+-------------------------------------------------------------------------------+
|+ x |
|++ xx|
| A||
|A| |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 571.57 573.94 571.79 572.43333 1.3094401
+ 3 369.12 370.57 369.3 369.66333 0.79033748
Difference at 95.0% confidence
-202.77 +/- 2.45131
-35.4225% +/- 0.428227%
(Student's t, pooled s = 1.0815)
Sponsored by: EMC / Isilon Storage Division
MFC after: 3 weeks
Relnotes: yes
2015-11-06 04:45:29 +00:00
|
|
|
${CC} ${CFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
|
2002-04-12 16:25:13 +00:00
|
|
|
.endif
|
2011-11-30 18:11:49 +00:00
|
|
|
.if ${MK_CTF} != "no"
|
2011-11-29 08:38:47 +00:00
|
|
|
${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS}
|
|
|
|
.endif
|
2002-04-12 16:25:13 +00:00
|
|
|
|
2005-04-11 07:13:29 +00:00
|
|
|
.else # !defined(SRCS)
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2002-04-12 16:25:13 +00:00
|
|
|
.if !target(${PROG})
|
2002-04-11 10:44:30 +00:00
|
|
|
.if defined(PROG_CXX)
|
|
|
|
SRCS= ${PROG}.cc
|
|
|
|
.else
|
1994-08-28 15:32:10 +00:00
|
|
|
SRCS= ${PROG}.c
|
2002-04-11 10:44:30 +00:00
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
1994-08-28 15:32:10 +00:00
|
|
|
# Always make an intermediate object file because:
|
|
|
|
# - it saves time rebuilding when only the library has changed
|
|
|
|
# - the name of the object gets put into the executable symbol table instead of
|
|
|
|
# the name of a variable temporary object.
|
|
|
|
# - it's useful to keep objects around for crunching.
|
2013-03-26 18:46:40 +00:00
|
|
|
OBJS+= ${PROG}.o
|
1998-02-19 14:53:29 +00:00
|
|
|
|
2010-09-10 16:21:09 +00:00
|
|
|
.if target(beforelinking)
|
2012-12-31 21:54:43 +00:00
|
|
|
beforelinking: ${OBJS}
|
2013-06-07 21:40:02 +00:00
|
|
|
${PROG_FULL}: beforelinking
|
2010-09-10 16:21:09 +00:00
|
|
|
.endif
|
2013-06-07 21:40:02 +00:00
|
|
|
${PROG_FULL}: ${OBJS}
|
2002-04-12 08:17:24 +00:00
|
|
|
.if defined(PROG_CXX)
|
Add a FAST_DEPEND option, off by default, which speeds up the build significantly.
This speeds up buildworld by 16% on my system and buildkernel by 35%.
Rather than calling mkdep(1), which is just a wrapper around 'cc -E',
use the modern -MD -MT -MF flags to gather and generate dependencies during
compilation. This flag was introduced in GCC "a long time ago", in GCC 3.0,
and is also supported by Clang. (It appears that ICC also supports this but I
do not have access to test it). This avoids running the preprocessor *twice*
for every build, in both 'make depend' and 'make all'. This is especially
noticeable when using ccache since it does not cache preprocessor results from
mkdep(1) / 'cc -E', but still speeds up compilation with the -MD flags.
For 'make depend' a tree-walk is still done to ensure that all DPSRCS
are generated when expected, and that beforedepend/afterdepend and
_EXTRADEPEND are all still respected. In time this may change but for now
I've been conservative. The time for a tree-walk with -j combined with
SUBDIR_PARALLEL is not significant. For example, it takes about 9 seconds
with -j15 to walk all of src/ for 'make depend' now on my system.
A .depend file is still generated with the various rules that apply to
the final target, or custom rules. Otherwise there are now
per-built-object-file .depend files, such as .depend.filename.o. These
are included directly by make rather than populating .depend with a loop
and .depend lines, which only added overhead to the now almost-NOP 'make
depend' phase.
Before this I experimented with having mkdep(1) called in parallel per-file.
While this improved the kernel and lib/libc 'make depend' phase, it resulted
in slower build times overall.
The -M flags are removed from CFLAGS when linking since they have no effect.
Enabling this by default, for src or out-of-src, can be done once more testing
has been done, such as a ports exp-run, and with more compilers.
The system I used for testing was:
WITNESS
Build options: -j20 WITH_LLDB=yes WITH_DEBUG_FILES=yes WITH_FAST_DEPEND=yes
DISK: ZFS 3-way mirror with very slow disks using SSD l2arc/log.
The arc was fully populated with src tree files.
RAM: 76GiB
CPU: Intel(R) Xeon(R) CPU L5520 @2.27GHz
2 package(s) x 4 core(s) x 2 SMT threads = hw.ncpu=16
buildworld:
x buildworld-before
+ buildworld-fastdep
+-------------------------------------------------------------------------------+
|+ |
|+ |
|+ xx x|
| |_MA___||
|A |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 3744.13 3794.31 3752.25 3763.5633 26.935139
+ 3 3153.34 3155.16 3154.2 3154.2333 0.91045776
Difference at 95.0% confidence
-609.33 +/- 43.1943
-16.1902% +/- 1.1477%
(Student's t, pooled s = 19.0569)
buildkernel:
x buildkernel-before
+ buildkernel-fastdep
+-------------------------------------------------------------------------------+
|+ x |
|++ xx|
| A||
|A| |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 571.57 573.94 571.79 572.43333 1.3094401
+ 3 369.12 370.57 369.3 369.66333 0.79033748
Difference at 95.0% confidence
-202.77 +/- 2.45131
-35.4225% +/- 0.428227%
(Student's t, pooled s = 1.0815)
Sponsored by: EMC / Isilon Storage Division
MFC after: 3 weeks
Relnotes: yes
2015-11-06 04:45:29 +00:00
|
|
|
${CXX} ${CXXFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
|
2002-04-12 08:17:24 +00:00
|
|
|
.else
|
Add a FAST_DEPEND option, off by default, which speeds up the build significantly.
This speeds up buildworld by 16% on my system and buildkernel by 35%.
Rather than calling mkdep(1), which is just a wrapper around 'cc -E',
use the modern -MD -MT -MF flags to gather and generate dependencies during
compilation. This flag was introduced in GCC "a long time ago", in GCC 3.0,
and is also supported by Clang. (It appears that ICC also supports this but I
do not have access to test it). This avoids running the preprocessor *twice*
for every build, in both 'make depend' and 'make all'. This is especially
noticeable when using ccache since it does not cache preprocessor results from
mkdep(1) / 'cc -E', but still speeds up compilation with the -MD flags.
For 'make depend' a tree-walk is still done to ensure that all DPSRCS
are generated when expected, and that beforedepend/afterdepend and
_EXTRADEPEND are all still respected. In time this may change but for now
I've been conservative. The time for a tree-walk with -j combined with
SUBDIR_PARALLEL is not significant. For example, it takes about 9 seconds
with -j15 to walk all of src/ for 'make depend' now on my system.
A .depend file is still generated with the various rules that apply to
the final target, or custom rules. Otherwise there are now
per-built-object-file .depend files, such as .depend.filename.o. These
are included directly by make rather than populating .depend with a loop
and .depend lines, which only added overhead to the now almost-NOP 'make
depend' phase.
Before this I experimented with having mkdep(1) called in parallel per-file.
While this improved the kernel and lib/libc 'make depend' phase, it resulted
in slower build times overall.
The -M flags are removed from CFLAGS when linking since they have no effect.
Enabling this by default, for src or out-of-src, can be done once more testing
has been done, such as a ports exp-run, and with more compilers.
The system I used for testing was:
WITNESS
Build options: -j20 WITH_LLDB=yes WITH_DEBUG_FILES=yes WITH_FAST_DEPEND=yes
DISK: ZFS 3-way mirror with very slow disks using SSD l2arc/log.
The arc was fully populated with src tree files.
RAM: 76GiB
CPU: Intel(R) Xeon(R) CPU L5520 @2.27GHz
2 package(s) x 4 core(s) x 2 SMT threads = hw.ncpu=16
buildworld:
x buildworld-before
+ buildworld-fastdep
+-------------------------------------------------------------------------------+
|+ |
|+ |
|+ xx x|
| |_MA___||
|A |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 3744.13 3794.31 3752.25 3763.5633 26.935139
+ 3 3153.34 3155.16 3154.2 3154.2333 0.91045776
Difference at 95.0% confidence
-609.33 +/- 43.1943
-16.1902% +/- 1.1477%
(Student's t, pooled s = 19.0569)
buildkernel:
x buildkernel-before
+ buildkernel-fastdep
+-------------------------------------------------------------------------------+
|+ x |
|++ xx|
| A||
|A| |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 571.57 573.94 571.79 572.43333 1.3094401
+ 3 369.12 370.57 369.3 369.66333 0.79033748
Difference at 95.0% confidence
-202.77 +/- 2.45131
-35.4225% +/- 0.428227%
(Student's t, pooled s = 1.0815)
Sponsored by: EMC / Isilon Storage Division
MFC after: 3 weeks
Relnotes: yes
2015-11-06 04:45:29 +00:00
|
|
|
${CC} ${CFLAGS:N-M*} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
2011-11-30 18:11:49 +00:00
|
|
|
.if ${MK_CTF} != "no"
|
2011-11-29 08:38:47 +00:00
|
|
|
${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS}
|
|
|
|
.endif
|
2013-06-07 21:40:02 +00:00
|
|
|
.endif # !target(${PROG})
|
1998-02-19 14:53:29 +00:00
|
|
|
|
2012-12-14 18:30:01 +00:00
|
|
|
.endif # !defined(SRCS)
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2013-06-07 21:40:02 +00:00
|
|
|
.if ${MK_DEBUG_FILES} != "no"
|
|
|
|
${PROG}: ${PROG_FULL} ${PROGNAME}.debug
|
|
|
|
${OBJCOPY} --strip-debug --add-gnu-debuglink=${PROGNAME}.debug \
|
|
|
|
${PROG_FULL} ${.TARGET}
|
|
|
|
|
|
|
|
${PROGNAME}.debug: ${PROG_FULL}
|
|
|
|
${OBJCOPY} --only-keep-debug ${PROG_FULL} ${.TARGET}
|
|
|
|
.endif
|
|
|
|
|
2006-03-17 18:54:44 +00:00
|
|
|
.if ${MK_MAN} != "no" && !defined(MAN) && \
|
2001-03-26 08:04:11 +00:00
|
|
|
!defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \
|
1994-05-30 19:09:18 +00:00
|
|
|
!defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \
|
2013-01-16 23:21:04 +00:00
|
|
|
!defined(MAN7) && !defined(MAN8) && !defined(MAN9)
|
2001-03-28 15:07:48 +00:00
|
|
|
MAN= ${PROG}.1
|
|
|
|
MAN1= ${MAN}
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
2012-12-14 18:30:01 +00:00
|
|
|
.endif # defined(PROG)
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2012-08-22 19:25:57 +00:00
|
|
|
.if defined(_SKIP_BUILD)
|
|
|
|
all:
|
|
|
|
.else
|
2014-08-13 01:27:51 +00:00
|
|
|
all: beforebuild .WAIT ${PROG} ${SCRIPTS}
|
|
|
|
beforebuild: objwarn
|
2006-03-17 18:54:44 +00:00
|
|
|
.if ${MK_MAN} != "no"
|
2002-05-07 15:42:56 +00:00
|
|
|
all: _manpages
|
2001-03-26 08:04:11 +00:00
|
|
|
.endif
|
2012-08-22 19:25:57 +00:00
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2003-08-31 15:20:17 +00:00
|
|
|
.if defined(PROG)
|
|
|
|
CLEANFILES+= ${PROG}
|
2013-06-07 21:40:02 +00:00
|
|
|
.if ${MK_DEBUG_FILES} != "no"
|
|
|
|
CLEANFILES+= ${PROG_FULL} ${PROGNAME}.debug
|
|
|
|
.endif
|
2003-08-31 15:20:17 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.if defined(OBJS)
|
|
|
|
CLEANFILES+= ${OBJS}
|
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2004-02-09 14:05:17 +00:00
|
|
|
.include <bsd.libnames.mk>
|
|
|
|
|
2000-01-09 15:40:32 +00:00
|
|
|
.if defined(PROG)
|
1997-04-09 16:10:27 +00:00
|
|
|
_EXTRADEPEND:
|
2004-02-09 14:05:17 +00:00
|
|
|
.if defined(LDFLAGS) && !empty(LDFLAGS:M-nostdlib)
|
|
|
|
.if defined(DPADD) && !empty(DPADD)
|
2015-02-13 17:33:27 +00:00
|
|
|
echo ${PROG_FULL}: ${DPADD} >> ${DEPENDFILE}
|
2004-02-09 14:05:17 +00:00
|
|
|
.endif
|
|
|
|
.else
|
2015-02-13 17:33:27 +00:00
|
|
|
echo ${PROG_FULL}: ${LIBC} ${DPADD} >> ${DEPENDFILE}
|
2014-05-10 16:38:03 +00:00
|
|
|
.if defined(PROG_CXX)
|
2014-03-30 23:43:30 +00:00
|
|
|
.if ${COMPILER_TYPE} == "clang" && empty(CXXFLAGS:M-stdlib=libstdc++)
|
2015-02-13 17:33:27 +00:00
|
|
|
echo ${PROG_FULL}: ${LIBCPLUSPLUS} >> ${DEPENDFILE}
|
2012-08-25 19:30:15 +00:00
|
|
|
.else
|
2015-02-13 17:33:27 +00:00
|
|
|
echo ${PROG_FULL}: ${LIBSTDCPLUSPLUS} >> ${DEPENDFILE}
|
2002-04-12 08:17:24 +00:00
|
|
|
.endif
|
1997-08-30 23:23:18 +00:00
|
|
|
.endif
|
2004-02-09 14:05:17 +00:00
|
|
|
.endif
|
2012-08-25 19:30:15 +00:00
|
|
|
.endif
|
1997-04-09 16:10:27 +00:00
|
|
|
|
1994-05-30 19:09:18 +00:00
|
|
|
.if !target(install)
|
|
|
|
|
2004-11-12 13:24:34 +00:00
|
|
|
.if defined(PRECIOUSPROG)
|
2004-12-21 09:53:14 +00:00
|
|
|
.if !defined(NO_FSCHG)
|
2004-11-03 18:01:21 +00:00
|
|
|
INSTALLFLAGS+= -fschg
|
|
|
|
.endif
|
2004-11-12 13:24:34 +00:00
|
|
|
INSTALLFLAGS+= -S
|
|
|
|
.endif
|
2004-11-03 18:01:21 +00:00
|
|
|
|
1999-07-31 20:27:33 +00:00
|
|
|
_INSTALLFLAGS:= ${INSTALLFLAGS}
|
|
|
|
.for ie in ${INSTALLFLAGS_EDIT}
|
|
|
|
_INSTALLFLAGS:= ${_INSTALLFLAGS${ie}}
|
|
|
|
.endfor
|
|
|
|
|
2004-02-09 14:05:17 +00:00
|
|
|
.if !target(realinstall) && !defined(INTERNALPROG)
|
2002-05-07 15:30:49 +00:00
|
|
|
realinstall: _proginstall
|
2002-07-03 12:28:03 +00:00
|
|
|
.ORDER: beforeinstall _proginstall
|
2002-05-07 15:30:49 +00:00
|
|
|
_proginstall:
|
1994-05-30 19:09:18 +00:00
|
|
|
.if defined(PROG)
|
2002-07-29 09:40:17 +00:00
|
|
|
${INSTALL} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
|
2001-04-02 11:44:20 +00:00
|
|
|
${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}/${PROGNAME}
|
2013-06-07 21:40:02 +00:00
|
|
|
.if ${MK_DEBUG_FILES} != "no"
|
|
|
|
.if defined(DEBUGMKDIR)
|
2015-10-15 22:49:56 +00:00
|
|
|
${INSTALL} -T debug -d ${DESTDIR}${DEBUGFILEDIR}/
|
2013-06-07 21:40:02 +00:00
|
|
|
.endif
|
|
|
|
${INSTALL} -T debug -o ${BINOWN} -g ${BINGRP} -m ${DEBUGMODE} \
|
|
|
|
${PROGNAME}.debug ${DESTDIR}${DEBUGFILEDIR}/${PROGNAME}.debug
|
|
|
|
.endif
|
2001-04-02 11:44:20 +00:00
|
|
|
.endif
|
2005-04-11 07:13:29 +00:00
|
|
|
.endif # !target(realinstall)
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2001-04-07 11:13:46 +00:00
|
|
|
.if defined(SCRIPTS) && !empty(SCRIPTS)
|
|
|
|
realinstall: _scriptsinstall
|
2002-07-03 12:28:03 +00:00
|
|
|
.ORDER: beforeinstall _scriptsinstall
|
2001-04-07 11:13:46 +00:00
|
|
|
|
|
|
|
SCRIPTSDIR?= ${BINDIR}
|
|
|
|
SCRIPTSOWN?= ${BINOWN}
|
|
|
|
SCRIPTSGRP?= ${BINGRP}
|
|
|
|
SCRIPTSMODE?= ${BINMODE}
|
|
|
|
|
2013-01-29 00:07:54 +00:00
|
|
|
STAGE_AS_SETS+= scripts
|
|
|
|
stage_as.scripts: ${SCRIPTS}
|
|
|
|
FLAGS.stage_as.scripts= -m ${SCRIPTSMODE}
|
|
|
|
STAGE_FILES_DIR.scripts= ${STAGE_OBJTOP}
|
2001-04-07 11:13:46 +00:00
|
|
|
.for script in ${SCRIPTS}
|
|
|
|
.if defined(SCRIPTSNAME)
|
|
|
|
SCRIPTSNAME_${script:T}?= ${SCRIPTSNAME}
|
|
|
|
.else
|
|
|
|
SCRIPTSNAME_${script:T}?= ${script:T:R}
|
|
|
|
.endif
|
|
|
|
SCRIPTSDIR_${script:T}?= ${SCRIPTSDIR}
|
|
|
|
SCRIPTSOWN_${script:T}?= ${SCRIPTSOWN}
|
|
|
|
SCRIPTSGRP_${script:T}?= ${SCRIPTSGRP}
|
|
|
|
SCRIPTSMODE_${script:T}?= ${SCRIPTSMODE}
|
2013-01-29 00:07:54 +00:00
|
|
|
STAGE_AS_${script:T}= ${SCRIPTSDIR_${script:T}}/${SCRIPTSNAME_${script:T}}
|
2001-12-17 13:59:35 +00:00
|
|
|
_scriptsinstall: _SCRIPTSINS_${script:T}
|
|
|
|
_SCRIPTSINS_${script:T}: ${script}
|
2002-07-29 09:40:17 +00:00
|
|
|
${INSTALL} -o ${SCRIPTSOWN_${.ALLSRC:T}} \
|
2001-04-07 11:13:46 +00:00
|
|
|
-g ${SCRIPTSGRP_${.ALLSRC:T}} -m ${SCRIPTSMODE_${.ALLSRC:T}} \
|
2002-04-17 16:29:02 +00:00
|
|
|
${.ALLSRC} \
|
2001-04-07 11:13:46 +00:00
|
|
|
${DESTDIR}${SCRIPTSDIR_${.ALLSRC:T}}/${SCRIPTSNAME_${.ALLSRC:T}}
|
|
|
|
.endfor
|
|
|
|
.endif
|
|
|
|
|
2002-07-02 12:37:09 +00:00
|
|
|
NLSNAME?= ${PROG}
|
|
|
|
.include <bsd.nls.mk>
|
|
|
|
|
2015-10-09 21:57:42 +00:00
|
|
|
.include <bsd.confs.mk>
|
2002-06-03 14:49:34 +00:00
|
|
|
.include <bsd.files.mk>
|
2002-05-15 16:19:54 +00:00
|
|
|
.include <bsd.incs.mk>
|
2002-07-02 12:16:54 +00:00
|
|
|
.include <bsd.links.mk>
|
2002-05-12 16:01:00 +00:00
|
|
|
|
2006-03-17 18:54:44 +00:00
|
|
|
.if ${MK_MAN} != "no"
|
2002-05-07 15:42:56 +00:00
|
|
|
realinstall: _maninstall
|
2002-07-03 12:28:03 +00:00
|
|
|
.ORDER: beforeinstall _maninstall
|
1994-08-04 21:09:27 +00:00
|
|
|
.endif
|
2002-05-07 15:30:49 +00:00
|
|
|
|
2015-09-23 23:20:49 +00:00
|
|
|
.endif # !target(install)
|
1994-05-30 19:09:18 +00:00
|
|
|
|
|
|
|
.if !target(lint)
|
2002-09-20 19:32:51 +00:00
|
|
|
lint: ${SRCS:M*.c}
|
1994-05-30 19:09:18 +00:00
|
|
|
.if defined(PROG)
|
2002-09-20 19:32:51 +00:00
|
|
|
${LINT} ${LINTFLAGS} ${CFLAGS:M-[DIU]*} ${.ALLSRC}
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
2006-03-17 18:54:44 +00:00
|
|
|
.if ${MK_MAN} != "no"
|
1994-05-30 19:09:18 +00:00
|
|
|
.include <bsd.man.mk>
|
1998-03-12 20:02:17 +00:00
|
|
|
.endif
|
|
|
|
|
1994-08-04 21:09:27 +00:00
|
|
|
.include <bsd.dep.mk>
|
1998-03-06 06:48:39 +00:00
|
|
|
|
2002-04-07 14:58:12 +00:00
|
|
|
.if defined(PROG) && !exists(${.OBJDIR}/${DEPENDFILE})
|
1998-03-06 07:28:01 +00:00
|
|
|
${OBJS}: ${SRCS:M*.h}
|
1998-03-06 06:48:39 +00:00
|
|
|
.endif
|
|
|
|
|
1996-06-24 04:26:21 +00:00
|
|
|
.include <bsd.obj.mk>
|
2001-05-19 23:18:21 +00:00
|
|
|
|
|
|
|
.include <bsd.sys.mk>
|