History log of /freebsd-11-stable/share/mk/bsd.dep.mk
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 359713 07-Apr-2020 bdrewery

MFC r353771:

Fix spelling of DPSRCS.


# 337481 08-Aug-2018 bdrewery

MFC r326552:

Fix DPSRCS not getting .depend.* files.


# 335204 15-Jun-2018 bdrewery

MFC r325560:

META_MODE: Bmake 20171028 in r325340 simplifies the meta filename.


# 320298 23-Jun-2017 bdrewery

MFC r320174,r320204:

r320174:
Fix 'make clean all' to work again.
r320204:
Fix various 'make *clean *all *install' combinations.

PR: 219819
Approved by: re (gjb)


# 316788 13-Apr-2017 bdrewery

MFC r315461:

META_MODE: Fix not using .depend files when no OBJDIR is present.


# 311195 03-Jan-2017 bdrewery

MFC r308600:

DIRDEPS_BUILD: Consolidate some logic for skipping of reading
Makefile.depend.


# 311193 03-Jan-2017 bdrewery

MFC r308599:

Consolidate the "don't build" optimizations into _SKIP_BUILD.


# 311192 03-Jan-2017 bdrewery

MFC r305147:

Add a 'make print-dir' that simply traverses all directories and prints them.


# 311177 03-Jan-2017 bdrewery

MFC r305009:

Allow parallelizing clean/cleandepend/depend with all.


# 311161 03-Jan-2017 bdrewery

MFC r305216:

FAST_DEPEND/META_MODE: Fix several issues with SRCS containing '/'.


# 309843 10-Dec-2016 marcel

MFC r305855, r306297, r306300, r306312-r306313

When MAKEOBJDIRPREFIX points to a case-insensitive file system, the
build can break when different source files create the same object
files (case-insensitivity speaking). This is the case for object
files compiled with -fpic and shared libraries. The former uses
an extension of ".So", and the latter an extension ".so". Rename
shared object files from *.So to *.pico to match what NetBSD does.

Also:
o Compile _Exit.c as C99_Exit.c, as it conflicts with _exit.s
o Add entry to UPDATING
o Document .pico extension


# 304717 23-Aug-2016 bdrewery

MFC r304697:

FAST_DEPEND: Fix 'make all install' not properly rebuilding based on
.depend.* files.


# 302408 07-Jul-2016 gjb

Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle.
Prune svn:mergeinfo from the new branch, as nothing has been merged
here.

Additional commits post-branch will follow.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


/freebsd-11-stable/MAINTAINERS
/freebsd-11-stable/cddl
/freebsd-11-stable/cddl/contrib/opensolaris
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/zfs
/freebsd-11-stable/cddl/contrib/opensolaris/lib/libzfs
/freebsd-11-stable/contrib/amd
/freebsd-11-stable/contrib/apr
/freebsd-11-stable/contrib/apr-util
/freebsd-11-stable/contrib/atf
/freebsd-11-stable/contrib/binutils
/freebsd-11-stable/contrib/bmake
/freebsd-11-stable/contrib/byacc
/freebsd-11-stable/contrib/bzip2
/freebsd-11-stable/contrib/com_err
/freebsd-11-stable/contrib/compiler-rt
/freebsd-11-stable/contrib/dialog
/freebsd-11-stable/contrib/dma
/freebsd-11-stable/contrib/dtc
/freebsd-11-stable/contrib/ee
/freebsd-11-stable/contrib/elftoolchain
/freebsd-11-stable/contrib/elftoolchain/ar
/freebsd-11-stable/contrib/elftoolchain/brandelf
/freebsd-11-stable/contrib/elftoolchain/elfdump
/freebsd-11-stable/contrib/expat
/freebsd-11-stable/contrib/file
/freebsd-11-stable/contrib/gcc
/freebsd-11-stable/contrib/gcclibs/libgomp
/freebsd-11-stable/contrib/gdb
/freebsd-11-stable/contrib/gdtoa
/freebsd-11-stable/contrib/groff
/freebsd-11-stable/contrib/ipfilter
/freebsd-11-stable/contrib/ldns
/freebsd-11-stable/contrib/ldns-host
/freebsd-11-stable/contrib/less
/freebsd-11-stable/contrib/libarchive
/freebsd-11-stable/contrib/libarchive/cpio
/freebsd-11-stable/contrib/libarchive/libarchive
/freebsd-11-stable/contrib/libarchive/libarchive_fe
/freebsd-11-stable/contrib/libarchive/tar
/freebsd-11-stable/contrib/libc++
/freebsd-11-stable/contrib/libc-vis
/freebsd-11-stable/contrib/libcxxrt
/freebsd-11-stable/contrib/libexecinfo
/freebsd-11-stable/contrib/libpcap
/freebsd-11-stable/contrib/libstdc++
/freebsd-11-stable/contrib/libucl
/freebsd-11-stable/contrib/libxo
/freebsd-11-stable/contrib/llvm
/freebsd-11-stable/contrib/llvm/projects/libunwind
/freebsd-11-stable/contrib/llvm/tools/clang
/freebsd-11-stable/contrib/llvm/tools/lldb
/freebsd-11-stable/contrib/llvm/tools/llvm-dwarfdump
/freebsd-11-stable/contrib/llvm/tools/llvm-lto
/freebsd-11-stable/contrib/mdocml
/freebsd-11-stable/contrib/mtree
/freebsd-11-stable/contrib/ncurses
/freebsd-11-stable/contrib/netcat
/freebsd-11-stable/contrib/ntp
/freebsd-11-stable/contrib/nvi
/freebsd-11-stable/contrib/one-true-awk
/freebsd-11-stable/contrib/openbsm
/freebsd-11-stable/contrib/openpam
/freebsd-11-stable/contrib/openresolv
/freebsd-11-stable/contrib/pf
/freebsd-11-stable/contrib/sendmail
/freebsd-11-stable/contrib/serf
/freebsd-11-stable/contrib/sqlite3
/freebsd-11-stable/contrib/subversion
/freebsd-11-stable/contrib/tcpdump
/freebsd-11-stable/contrib/tcsh
/freebsd-11-stable/contrib/tnftp
/freebsd-11-stable/contrib/top
/freebsd-11-stable/contrib/top/install-sh
/freebsd-11-stable/contrib/tzcode/stdtime
/freebsd-11-stable/contrib/tzcode/zic
/freebsd-11-stable/contrib/tzdata
/freebsd-11-stable/contrib/unbound
/freebsd-11-stable/contrib/vis
/freebsd-11-stable/contrib/wpa
/freebsd-11-stable/contrib/xz
/freebsd-11-stable/crypto/heimdal
/freebsd-11-stable/crypto/openssh
/freebsd-11-stable/crypto/openssl
/freebsd-11-stable/gnu/lib
/freebsd-11-stable/gnu/usr.bin/binutils
/freebsd-11-stable/gnu/usr.bin/cc/cc_tools
/freebsd-11-stable/gnu/usr.bin/gdb
/freebsd-11-stable/lib/libc/locale/ascii.c
/freebsd-11-stable/sys/cddl/contrib/opensolaris
/freebsd-11-stable/sys/contrib/dev/acpica
/freebsd-11-stable/sys/contrib/ipfilter
/freebsd-11-stable/sys/contrib/libfdt
/freebsd-11-stable/sys/contrib/octeon-sdk
/freebsd-11-stable/sys/contrib/x86emu
/freebsd-11-stable/sys/contrib/xz-embedded
/freebsd-11-stable/usr.sbin/bhyve/atkbdc.h
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.c
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.h
/freebsd-11-stable/usr.sbin/bhyve/console.c
/freebsd-11-stable/usr.sbin/bhyve/console.h
/freebsd-11-stable/usr.sbin/bhyve/pci_fbuf.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.h
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.c
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.h
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.c
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.h
/freebsd-11-stable/usr.sbin/bhyve/rfb.c
/freebsd-11-stable/usr.sbin/bhyve/rfb.h
/freebsd-11-stable/usr.sbin/bhyve/sockstream.c
/freebsd-11-stable/usr.sbin/bhyve/sockstream.h
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.c
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.h
/freebsd-11-stable/usr.sbin/bhyve/usb_mouse.c
/freebsd-11-stable/usr.sbin/bhyve/vga.c
/freebsd-11-stable/usr.sbin/bhyve/vga.h
# 302073 21-Jun-2016 bdrewery

META_MODE: Don't generate or read _EXTRADEPEND dependencies when using filemon.

The DPADD data in .depend will be redundant with what is in the .meta file.

Also extend NO_EXTRADEPEND support to bsd.prog.mk.

Approved by: re (blanket, META_MODE)
Sponsored by: EMC / Isilon Storage Division


# 301935 15-Jun-2016 bdrewery

WITH_META_MODE: Do include headers for specific guessed dependencies

This is a follow-up to r300343.

This is important for the OBJS_DEPEND_GUESS usage in
gnu/usr.bin/cc/cc_tools.

See comments for more details.

Approved by: re (implicit)
Sponsored by: EMC / Isilon Storage Division


# 301933 15-Jun-2016 bdrewery

Don't truncate OBJS_DEPEND_GUESS.target from Makefile

This is important to allow a Makefile to override OBJS_DEPEND_GUESS for
handling in META_MODE when its depend files are missing.

Approved by: re (implicit)
Sponsored by: EMC / Isilon Storage Division


# 301290 03-Jun-2016 bdrewery

WITH_META_MODE: Avoid "building" .depend if there is nothing to do.

This avoids 'Building /path/.depend' when it will not actually produce a
file.

Sponsored by: EMC / Isilon Storage Division


# 301285 03-Jun-2016 bdrewery

WITH_META_MODE: Don't expect meta files for side-effect generated files.

The first file in these lists will generate everything else so only
it should be getting a .meta file. With bmake's missing=yes meta
feature these would otherwise cause a rebuild without the
.NOMETA hint.

Sponsored by: EMC / Isilon Storage Division


# 301284 03-Jun-2016 bdrewery

Revert r301079.

This breaks cross-building with WITH_META_MODE since it will rebuild
'build-tools' during the 'everything' phase.

A more proper fix is coming to bmake to implicitly require .META unless
.NOMETA (and other restrictions) are in place.


# 301079 31-May-2016 bdrewery

WITH_META_MODE: Mitigate switching from without to with META_MODE.

Adding .META to targets-to-build will ensure that they will rebuild if there
is no .meta file.

Adding it to all SUFFIXES and objects ensures that at least objects will
rebuild if there is no .meta file.

This will be reverted if bmake's behavior changes to rebuild on missing .meta
files.

Sponsored by: EMC / Isilon Storage Division


# 300343 20-May-2016 bdrewery

WITH_META_MODE: Fix suffix transformation rules with guessed dependencies.

This is the same problem as r290629. With META_MODE we do not generate
.depend files, so there is no proper dependency to lookup. Guessed
dependencies must be used. If this proves to be a problem then we will
have to generate and use .depend files even with META_MODE.

Sponsored by: EMC / Isilon Storage Division


# 298228 18-Apr-2016 bdrewery

META_MODE: Don't hide the .depend rm -f command.

Otherwise the build command changes every build. META_MODE will
only remove it if something changes to warrant rebuilding
the file.

Sponsored by: EMC / Isilon Storage Division


# 298217 18-Apr-2016 bdrewery

META_MODE: Clean .meta files with 'make cleandepend'.

Sponsored by: EMC / Isilon Storage Division


# 297996 14-Apr-2016 bdrewery

Implement the dependency condition more safely.

Nested : are not handled well without "".

Sponsored by: EMC / Isilon Storage Division


# 297434 30-Mar-2016 bdrewery

Remove the old depend (mkdep) code and make FAST_DEPEND the one true way.

Reviewed by: emaste, hselasky (partial), brooks (brief)
Discussed on: arch@
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D5742


# 296646 11-Mar-2016 bdrewery

FAST_DEPEND: Use .dinclude to enable full .depend logic in bmake.

The inclusion of .MAKE.DEPENDFILE (.depend) has special logic in make
to ignore stale/missing dependencies. bmake 20160220 added a '.dinclude'
directive that uses the special logic for .depend when including the file.

This fixes a build error when a file is moved or deleted that exists in a
.depend.OBJ file. This happened in r292782 when sha512c.c "moved" and an
incremental build of lib/libmd would fail with:
make: don't know how to make /usr/src/lib/libcrypt/../libmd/sha512c.c. Stop

Now this will just be seen as a stale dependency and cause a rebuild:
make: /usr/obj/usr/src/lib/libmd/.depend.sha512c.o, 13: ignoring stale .depend for /usr/src/lib/libcrypt/../libmd/sha512c.c
--- sha512c.o ---
...
This rebuild will only be done once since the .depend.sha512c.o will
be updated on the build with the -MF flags.

This also removes -MP being passed for the .depend.OBJ generation (which
would create fake targets for system headers) since the logic is no
longer needed to protect from missing files.

Sponsored by: EMC / Isilon Storage Division


# 296238 29-Feb-2016 bdrewery

FAST_DEPEND: Prefer .OBJDIR depend files.

Sponsored by: EMC / Isilon Storage Division


# 296124 26-Feb-2016 bdrewery

Import bsd.clang-analyze.mk based on NetBSD's version.

This allows 'make analyze' or 'make OBJ.clang-analyzer' to run the
Clang static analyzer and present results on stdout.

Obtained from: NetBSD (CVS Rev. 1.3)
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D5449


# 296075 26-Feb-2016 bdrewery

Let CLEANDEPENDFILES actually be set before bsd.dep.mk.

This fixes 'cleandepend' for kmods after r295983.

Pointyhat to: bdrewery
Sponsored by: EMC / Isilon Storage Division


# 296062 25-Feb-2016 bdrewery

Fix build without FAST_DEPEND and without running 'make depend' after r295985.

The OBJS_DEPEND_GUESS mechanism required moving the bsd.dep.mk inclusion
to after the checks, but left DEPENDFILE not-yet-set. Move it to
bsd.own.mk to resolve this.

Pointyhat to: bdrewery
Reported by: antoine (ports failures)
Sponsored by: EMC / Isilon Storage Division


# 295999 24-Feb-2016 bdrewery

FAST_DEPEND: Still need to remove DEPENDFILE when rebuilding.

This avoids _EXTRADEPEND adding duplicate entries.

Sponsored by: EMC / Isilon Storage Division


# 295988 24-Feb-2016 bdrewery

FAST_DEPEND: Always run depend via beforebuild which removes many hacks.

This will generate dependencies rather than depending on the previous behavior
of depending on the guessed OBJS: *.h dependecies or a user running
'make depend'.

Experimentation showed that depending only on headers was not enough and
prone to .ORDER errors. Downstream users may also have added
dependencies into beforedepend or afterdepend targets. The safest way to
ensure dependencies are generated before build is to run 'make depend'
beforehand rather than just depending on DPSRCS+SRCS.

Note that the OBJS_DEPEND_GUESS mechanism (a.k.a .if !exists(.depend) then
foo.o: *.h) is still useful as it improves incremental builds with missing
.depend.* files and allows 'make foo.o' to usually work, while this
'beforebuild: depend' ensures that the build will always find all dependencies.
The 'make foo.o' case has no means of a 'beforebuild' hook.

This also removes several hacks in the DIRDEPS_BUILD:
- NO_INSTALL_INCLUDES is no longer needed as it mostly was to work around
.ORDER problems with building the needed headers early.
- DIRDEPS_BUILD: It is no longer necesarry to track "local dependencies" in
Makefile.depend.

These were only in Makefile.depend for 'clean builds' since nothing would
generate the files due to skipping 'make depend' and early dependency
bugs that have been fixed, such as adding headers into SRCS for the
OBJS_DEPEND_GUESS mechanism. Normally if a .depend file does not exist then
a dependency is added by bsd.lib.mk/bsd.prog.mk from OBJS: *.h. However,
meta.autodep.mk creates a .depend file from created meta files and inserts
that into Makefile.depend. It also only tracks *.[ch] files though which can
miss some dependencies that are hooked into 'make depend'. This .depend
that is created then breaks incremental builds due to the !exists(.depend)
checks for OBJS_DEPEND_GUESS. The goal was to skip 'make depend' yet it only
really works the first time. After that files are not generated as expected,
which r288966 tried to address but was using buildfiles: rather than
beforebuild: and was reverted in r291725. As noted previously,
depending only on headers in beforebuild: would create .ORDER errors
in some cases.

meta.autodep.mk is still used to generate Makefile.depend though via:
gendirdeps: Makefile.depend
.END: gendirdeps

This commit allows removing all of the "local dependencies" in
Makefile.depend which cuts down on churn and removes some of the
arch-dependent Makefile.depend files.

The "local dependencies" were also problematic for bootstrapping.

Sponsored by: EMC / Isilon Storage Division


# 295987 24-Feb-2016 bdrewery

Hook the meta/nofilemon build into using FAST_DEPEND.

FAST_DEPEND is intended to be the "skip 'make depend' and mkdep"
feature. Since DIRDEPS_BUILD does this already with some of its own
hacks, and filemon doesn't need this, and nofilemon does, teach it how
to handle each of these cases.

In meta+filemon mode filemon will handle dependencies itself via the
meta mode logic in bmake. We still want to set MK_FAST_DEPEND=yes to
enable some logic that indicates that 'make depend' is skipped in the
traditional sense. The actual .depend.* files will be skipped.

When nofilemon is set though we still need to track and generate dependencies.

Sponsored by: EMC / Isilon Storage Division


# 295986 24-Feb-2016 bdrewery

FAST_DEPEND: Don't waste time generating an empty .depend file.

The .depend file will still be generated if _EXTRADEPEND is used. The target
is kept with a dependency on DPSRCS though so that 'make depend' will generate
all files.

Sponsored by: EMC / Isilon Storage Division


# 295985 24-Feb-2016 bdrewery

FAST_DEPEND: Rework how guessed dependencies are handled.

Rather than depend on .depend not existing, check the actual
.depend.OBJ file that will be used for that object. If it doesn't
exist then use the guessed dependencies.

FAST_DEPEND may never have a .depend file. Not having one means all of the
previous logic would over-depend all object files on all headers which is not
what we wanted. It also means that if a .depend is generated before a build
is done for _EXTRADEPEND (such as for PROG or LIB) then all of these
dependencies would not be used since the .depend wasn't generated from mkdep
and the real .depend.* files are not generated until the build.

Sponsored by: EMC / Isilon Storage Division


# 295982 24-Feb-2016 bdrewery

Follow-up r295667 with fixes for SRCS defined.

cleandepend should always remove CLEANDEPEND* if they are not empty,
but bsd.dep.mk should not add the tags entries unless SRCS is defined
as it did before. The .depend file itself it still always removed
to avoid accidentally keeping a stale one around as done in r295666.

Sponsored by: EMC / Isilon Storage Division


# 295779 18-Feb-2016 bdrewery

Avoid reading .depend.* in simple cases where not needed.

This will speed up some tree-walks with FAST_DEPEND which otherwise
would include length(SRCS) .depend files.

This also uses a trick suggested by sjg@ to still read them in when
specifying _V_READ_DEPEND=1 in the env/make args.

Sponsored by: EMC / Isilon Storage Division


# 295667 16-Feb-2016 bdrewery

Add CLEANDEPEND[FILES|DIRS] and simplify the tags cleanup to use it.

Sponsored by: EMC / Isilon Storage Division


# 295666 16-Feb-2016 bdrewery

Always remove .depend.* regardless of WITH_FAST_DEPEND in case of changing
which is used.

Sponsored by: EMC / Isilon Storage Division


# 295665 16-Feb-2016 bdrewery

Remove temporary hack from r294370 for SSH upgrades.

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division


# 295006 28-Jan-2016 bdrewery

Fix -include .depend hack from r294370 for headers not in .PATH.

This hack will be removed in a few weeks. It is here to fix incremental
builds of SSH between r291941 and r294370.

Reported by: jmallett
MFC after: 1 day
Sponsored by: EMC / Isilon Storage Division


# 294878 26-Jan-2016 bdrewery

Revert yacc dependency back to pre-r241298.

Several attempts to fix this logic was done after r241298, which were
all reverted, yet this change was not.

The .h file does not depend on the .c file, so do not impose such a
dependency on it. They are generated by the same command but do not
depend on each other. Restore the .ORDER which should handle parallel build
issues. This fixes an actual bug where the .h file is not recreated
when missing [1]. For example:
cd lib/libc
make cleanobj
make nsparser.h
rm nsparser.h
make nsparser.h # will not rebuild nsparser.h

I have been trying to track down a build problem where nsparser.h is
missing when nslexer.o is built. It is possible this is related.

Reported by: bde [1]
https://lists.freebsd.org/pipermail/svn-src-all/2012-October/059481.html
https://lists.freebsd.org/pipermail/svn-src-all/2012-October/060038.html
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division


# 294872 26-Jan-2016 bdrewery

Fix DIRDEPS_BUILD after r294752.

DIRDEPS_BUILD does not yet support PROGS having their own dependency
file.

Overriding .MAKE.DEPENDFILE here causes major problems with the meta
mode logic since it creates the Makefile.depend as '.depend' resulting
in infinite loops in make due to dirdeps.mk including .depend endlessly.

X-MFC-With: r294752
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division


# 294752 25-Jan-2016 bdrewery

Fix PROGS not reading .depend files after r284288 by making DEPENDFILE work.

We have had this user-modifable DEPENDFILE variable forever that does nothing
relevant for the user since fmake always used '.depend'. Bmake
introduced the .MAKE.DEPENDFILE variable that can be modified to change
the name of '.depend'.

Prior to r284288, bsd.progs.mk was setting .MAKE.DEPENDFILE to allow
working incremental builds. This was modified most likely to not
conflict with the META MODE handling of .MAKE.DEPENDFILE as it has a lot
more special logic for that variable.

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division


# 294751 25-Jan-2016 bdrewery

Remove unneeded beforebuild hacks for dtrace probes.

This still allows skipping 'make depend'. Headers in SRCS generate
properly.

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division


# 294750 25-Jan-2016 bdrewery

Fix incremental build of dtrace probes.

Currently dtrace(1) -Go does not properly rebuild the target if it
exists. It results in missing symbols.

dtrace -C -x nolibs -G -o usdt.o -s /root/git/freebsd/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/usdt.d tst.usdt.o
dtrace: target object (usdt.o) already exists. Please remove the target
dtrace: object and rebuild all the source objects if you wish to run the DTrace
dtrace: linking process again
cc -O2 -pipe -O0 -g -I/root/git/freebsd/cddl/usr.sbin/dtrace/tests/common/json -std=gnu99 -fstack-protector-strong -Qunused-arguments -o tst.usdt.exe.full tst.usdt.o usdt.o
tst.usdt.o: In function `main':
/root/git/freebsd/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.usdt.c:56: undefined reference to `__dtrace_bunyan_fake___log__debug'
/root/git/freebsd/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.usdt.c:60: undefined reference to `__dtrace_bunyan_fake___log__debug'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** [tst.usdt.exe.full] Error code 1

This is a consequence of r212358.

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division


# 294370 19-Jan-2016 bdrewery

mkdep: Fix -include not being added for .depend tracking.

This fixes incremental build of OpenSSH after the recent upgrade.

For example, in secure/lib/libssh, -include ssh_namespace.h is used on
all files. This is not tracked in the .depend file though due to
MKDEP_CFLAGS not including it. The ssh example was broken in r291941
when not using FAST_DEPEND due to the .depend bug. FAST_DEPEND was not
affected by this because it generates dependencies at compile time and
thus sees the -include.

This ugly make syntax could be simpler for bmake by using :tW but
fmake-compatible syntax is used since this needs to be MFC'd all the way
to stable/9.

Also add a temporary hack to workaround existing checkouts building
incrementally with a .depend file not having these headers.

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division


# 294351 19-Jan-2016 bdrewery

FAST_DEPEND: Still use if filemon is not used.

If filemon is used then there is no need to generate dependency files during
compilation as the .meta files will achieve the same result.

This is a temporary solution until FAST_DEPEND is default. Once that is
default there will be an option to disable dependency generation entirely
as it is only useful if an incremental build is planned, thus META_MODE+filemon
can enable that option to short-circuit all FAST_DEPEND-related logic.

Sponsored by: EMC / Isilon Storage Division


# 294349 19-Jan-2016 bdrewery

Define .MAKE.MODE to normal to avoid the need for :U later.

Sponsored by: EMC / Isilon Storage Division


# 294104 15-Jan-2016 bdrewery

FAST_DEPEND: Rework optimization for r290524.

The .MAKEFLAGS check inside of the .for loop is extremely slow for some
reason. Just moving it out of the loop trimmed -V lookup time from 11
seconds to 1 second in the kernel obj directory.

Sponsored by: EMC / Isilon Storage Division


# 291945 07-Dec-2015 bdrewery

FAST_DEPEND: Only pass -MF if we care about the object being compiled.

This will save time generating dependency files that we didn't expect
due to cases where SRCS!=OBJS or for building custom targetted objects
in Makefiles that do not end up in the DEPENDOBJS list.

This uses a bmake trick to modify CFLAGS based on ${.TARGET}. A
.PARSEDIR check is done for the sake of MFC safety.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division


# 291944 07-Dec-2015 bdrewery

FAST_DEPEND: Move handling code below yacc/lex/dtrace code that modified SRCS.

This fixes some of those newly added SRCS not having their depend files
included.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division


# 291943 07-Dec-2015 bdrewery

FAST_DEPEND: Only try to use dependencies from C/C++ SRCS as mkdep did.

Rather than try to guess at all of the OBJS variables just use SRCS
using the same patterns that mkdep does. This also fixes a mistake
where dependencies were being generated with FAST_DEPEND when they were
not for mkdep. This happens when OBJS!=SRCS as is the case in
gnu/lib/csu where SRCS has 1 file and OBJS has several other files that
does not even contain the 1 SRCS file. Generally in these cases the
OBJS have custom dependencies defined in their Makefile. If we generate
dependencies for those and then load a .depend file, then .IMPSRC may
contain duplicate sources and lead to errors such as:
cc: error: cannot specify -o when generating multiple output files

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division


# 291589 01-Dec-2015 bdrewery

FAST_DEPEND: Actually use -MP from DEPEND_MP, completing r291554.

X-MFC-With: r291554
MFC after: 1 week
Pointyhat to: bdrewery
Sponsored by: EMC / Isilon Storage Division


# 291555 01-Dec-2015 bdrewery

FAST_DEPEND: Workaround hacks in the wild that have '..' or '/' in OBJS.

This is mostly working around the converts/iconv port having '../ces/file.o'
in its OBJS list which resulted in '.depend../ces/file.o'. Now it will have
'.depend.._ces_file.o'.

Other implementations have :T which would result in '.depend.file.o' here, but
that could lead to collisions.

X-MFC-With: r291554
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division


# 291554 01-Dec-2015 bdrewery

FAST_DEPEND: Allow not using -MP by setting DEPEND_MP blank.

-MP creates empty targets for all dependency files, which can be useful when a
dependency is deleted from the file system. This would otherwise cause an
error for "don't know how to build FOO" since the .depend file is included
with the dependency registered.

This is mostly a workaround for the misc/dahdi-kmod port using '::' for one of
its dependencies, while -MP uses just ':'. This results in an 'Inconsistent
operator for' error.

X-MFC-With: r290433
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division


# 290816 14-Nov-2015 sjg

Rename META_MODE option to DIRDEPS_BUILD

This allows META_FILES option to be renamed META_MODE.
Also add META_COOKIE_TOUCH for use in targets that can benefit
from a cookie when in meta mode.

Differential Revision: https://reviews.freebsd.org/D4153
Reviewed by: bdrewery


# 290629 09-Nov-2015 bdrewery

FAST_DEPEND: Fix building of wrong source files in some cases.

Similar to the original reason for these dependency hints to be added,
in r124637, the missing-dependency file case can lead to building of the
wrong source.

A clear example of this is in gnu/lib/libstdc++ where the .PATH contains
both contrib/gcc and contrib/libstdc++/src.

contrib/gcc has a debug.c.
contrib/libstdc++/src has a debug.cc.

When building for the objects of debug.o, debug.So, and debug.po, it is
ambiguous for which src file to use due to the suffix transformation
rules, even though the proper one is listed first in .PATH.

This was normally avoided due to these dependency hints for the initial
build, and then mkdep would add an explicit 'debug.o: debug.cc'
dependency into the .depend file. WITH_FAST_DEPEND does not generate
the .depend file with these, but puts them into .depend.debug.o instead.

Rather than extending the exists() check to each object's .depend.*
file, just enable the hint when when using WITH_FAST_DEPEND. It fixes
the problem and seems to be safe enough to use since it is mapping SRCS
back to OBJS, rather than letting make make assumptions from OBJS to
SRCS.

A similar check mapping objects to headers is present in some mk files
but was not extended here for FAST_DEPEND since it has not yet been
found to be a problem.

X-MFC-With: r290433
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division


# 290526 07-Nov-2015 bdrewery

Add built-in ccache build support via WITH_CCACHE_BUILD option.

ccache is mostly beneficial for frequent builds where -DNO_CLEAN is not
used to achieve a safe pseudo-incremental build. This is explained in
more detail upstream [1] [2]. It incurs about a 20%-28% hit to populate the
cache, but with a full cache saves 30-50% in build times. When combined with
the WITH_FAST_DEPEND feature it saves up to 65% since ccache does cache the
resulting dependency file, which it does not do when using mkdep(1)/'CC
-E'. Stats are provided at the end of this message.

This removes the need to modify /etc/make.conf with the CC:= and CXX:=
lines which conflicted with external compiler support [3] (causing the
bootstrap compiler to not be built which lead to obscure failures [4]),
incorrectly invoked ccache in various stages, required CCACHE_CPP2 to avoid
Clang errors with parenthesis, and did not work with META_MODE.

The option name was picked to match the existing option in ports. This
feature is available for both in-src and out-of-src builds that use
/usr/share/mk.

Linking, assembly compiles, and pre-processing avoid using ccache since it is
only overhead. ccache does nothing special in these modes, although there is
no harm in calling it for them.

CCACHE_COMPILERCHECK is set to 'content' when using the in-tree bootstrap
compiler to hash the content of the compiler binary to determine if it
should be a cache miss. For external compilers the 'mtime' option is used
as it is more efficient and likely to be correct. Future work may optimize the
'content' check using the same checks as whether a bootstrap compiler is needed
to be built.

The CCACHE_CPP2 pessimization is currently default in our devel/ccache
port due to Clang requiring it. Clang's -Wparentheses-equality,
-Wtautological-compare, and -Wself-assign warnings do not mix well with
compiling already-pre-processed code that may have expanded macros that
trigger the warnings. GCC has so far not had this issue so it is allowed to
disable the CCACHE_CPP2 default in our port.

Sharing a cache between multiple checkouts, or systems, is explained in
the ccache manual. Sharing a cache over NFS would likely not be worth
it, but syncing cache directories between systems may be useful for an
organization. There is also a memcached backend available [5]. Due to using
an object directory outside of the source directory though you will need to
ensure that both are in the same prefix and all users use the same layout. A
possible working layout is as follows:
Source: /some/prefix/src1
Source: /some/prefix/src2
Source: /some/prefix/src3
Objdir: /some/prefix/obj
Environment: CCACHE_BASEDIR='${SRCTOP:H}' MAKEOBJDIRPREFIX='${SRCTOP:H}/obj'
This will use src*/../obj as the MAKEOBJDIRPREFIX and tells ccache to replace
all absolute paths to be relative. Using something like this is required due
to -I and -o flags containing both SRC and OBJDIR absolute paths that ccache
adds into its hash for the object without CCACHE_BASEDIR.

distcc can be hooked into by setting CCACHE_PREFIX=/usr/local/bin/distcc.
I have not personally tested this and assume it will not mix well with
using the bootstrap compiler.

The cache from buildworld can be reused in a subdir by first running
'make buildenv' (from r290424).

Note that the cache is currently different depending on whether -j is
used or not due to ccache enabling -fdiagnostics-color automatically if
stderr is a TTY, which bmake only does if not using -j.

The system I used for testing was:
WITNESS
Build options: -j20 WITH_LLDB=yes WITH_DEBUG_FILES=yes WITH_CCACHE_BUILD=yes
DISK: ZFS 3-way mirror with very slow disks using SSD l2arc/log.
The arc was fully populated with src tree files and ccache objects.
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

The WITH_FAST_DEPEND feature was used for comparison here as well to show
the dramatic time savings with a full cache.

buildworld:
x buildworld-before
+ buildworld-ccache-empty
* buildworld-ccache-full
% buildworld-ccache-full-fastdep
# buildworld-fastdep
+-------------------------------------------------------------------------------+
|% * # +|
|% * # +|
|% * # xxx +|
| |A |
| A|
| A |
|A |
| A |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 3744.13 3794.31 3752.25 3763.5633 26.935139
+ 3 4519 4525.04 4520.73 4521.59 3.1104823
Difference at 95.0% confidence
758.027 +/- 43.4565
20.1412% +/- 1.15466%
(Student's t, pooled s = 19.1726)
* 3 1823.08 1827.2 1825.62 1825.3 2.0785572
Difference at 95.0% confidence
-1938.26 +/- 43.298
-51.5007% +/- 1.15045%
(Student's t, pooled s = 19.1026)
% 3 1266.96 1279.37 1270.47 1272.2667 6.3971113
Difference at 95.0% confidence
-2491.3 +/- 44.3704
-66.1952% +/- 1.17895%
(Student's t, pooled s = 19.5758)
# 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-ccache-empty
* buildkernel-ccache-empty-fastdep
% buildkernel-ccache-full
# buildkernel-ccache-full-fastdep
@ buildkernel-fastdep
+-------------------------------------------------------------------------------+
|# @ % * |
|# @ % * x + |
|# @ % * xx ++|
| MA |
| MA|
| A |
| A |
|A |
| A |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 571.57 573.94 571.79 572.43333 1.3094401
+ 3 727.97 731.91 728.06 729.31333 2.2492295
Difference at 95.0% confidence
156.88 +/- 4.17129
27.4058% +/- 0.728695%
(Student's t, pooled s = 1.84034)
* 3 527.1 528.29 528.08 527.82333 0.63516402
Difference at 95.0% confidence
-44.61 +/- 2.33254
-7.79305% +/- 0.407478%
(Student's t, pooled s = 1.02909)
% 3 400.4 401.05 400.62 400.69 0.3306055
Difference at 95.0% confidence
-171.743 +/- 2.16453
-30.0023% +/- 0.378128%
(Student's t, pooled s = 0.954969)
# 3 201.94 203.34 202.28 202.52 0.73020545
Difference at 95.0% confidence
-369.913 +/- 2.40293
-64.6212% +/- 0.419774%
(Student's t, pooled s = 1.06015)
@ 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)

[1] https://ccache.samba.org/performance.html
[2] http://www.mail-archive.com/ccache@lists.samba.org/msg00576.html
[3] https://reviews.freebsd.org/D3484
[5] https://github.com/jrosdahl/ccache/pull/30

PR: 182944 [4]
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division
Relnotes: yes


# 290525 07-Nov-2015 bdrewery

FAST_DEPEND: Don't enable when .MAKE.MODE=meta.

This is because the .meta files generated from filemon already contain a
list of all files read to generate the object.

X-MFC-With: r290433
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division


# 290524 07-Nov-2015 bdrewery

FAST_DEPEND: Don't include depend files when using 'make -V'.

This is especially noticeable in the kernel obj directory since it
includes so many files.

X-MFC-With: r290433
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division


# 290433 06-Nov-2015 bdrewery

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


# 284345 13-Jun-2015 sjg

Add META_MODE support.

Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision: D2796
Reviewed by: brooks imp


# 281258 08-Apr-2015 markj

Add a DTRACEFLAGS variable, which can be used to pass additional variables
to dtrace(1) invocations during a build. This change includes -C in the
default flags, which has dtrace(1) run input scripts through the
preprocessor. While here, sort the definitions of CP and CPP in sys.mk.

Differential Revision: https://reviews.freebsd.org/D2204
Reviewed by: imp, rpaulo (previous revision)


# 278934 18-Feb-2015 markj

Remove drti.o's dependency on libelf. This makes it possible to add DTrace
probes to userland programs and libraries without also needing to link
libelf.

dtrace -G places the __SUNW_dof symbol at the beginning of the DOF (DTrace
probe and provider metdata) section in the generated object file; drti.o
now just uses this symbol to locate the section. A complication occurs
when multiple dtrace-generated object files are linked together, since the
__SUNW_dof symbol defined in each file is global. This is handled by
using objcopy(1) to convert __SUNW_dof to a local symbol once drti.o has
been linked with the generated object file. Upstream, this is done using a
linker feature not present in GNU ld.

Differential Revision: https://reviews.freebsd.org/D1757
Reviewed by: rpaulo
MFC after: 1 month
Relnotes: yes


# 273404 21-Oct-2014 bapt

The dependencies are computed with CC even if sources are C++, when building
when building with an external gcc, we want to be able to pass the path to
the libc++ headers so dependencies are correctly computed for C++ source files.
Add a DEPFLAGS for that purpose

Reviewed by: imp


# 273365 21-Oct-2014 markj

Fix a few small bugs in the DTrace USDT rules:
* anchor search strings appropriately,
* use .ALLSRC to pass the full path to the D script to dtrace(1),
* don't insert the auto-generated header into SRCS - it doesn't
accomplish anything, and we end up having to remove it from OBJS anyway.

Reviewed by: rpaulo
Differential Revision: https://reviews.freebsd.org/D978
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division


# 272346 01-Oct-2014 markj

Correct the way that libelf is linked when USDT is used.


# 271365 10-Sep-2014 ngie

Remove many false positives with make checkdpadd

- Reduce DPADD and LDADD in checkdpadd to -l<foo>
- Skip over -Wl,[es]*-group because -Wl,--end-group and
-Wl,--start-group might be required to properly link objects (see
usr.bin/clang/lldb as an example)

This caveat has been present for a while with some components of
the build. However, these false positives were made more more apparent
after r269648.

Phabric: D635
Reviewed by: jmmv (an earlier version)
PR: 192730
MFC after: 2 weeks


# 270990 02-Sep-2014 markj

Define _DTRACE_VERSION in sdt.h rather than setting it manually. This is
similar to what illumos does, and makes it easier to enable USDT probes
in third-party software that doesn't make use of the system makefiles.


# 269899 12-Aug-2014 rpaulo

Make sure the DTrace header files are built before depend and before
the build starts.

This adds a new variable DHDRS that contains a list of all DTrace
header files. Then, we use the beforedepend hook to make sure the
heaeder files are built.

Introduce a beforebuild dependency (from projects/bmake) based on
feedback from Simon J. Gerraty. This lets us generate the header
files without running make depend.

Reviewed by: sjg, imp
MFC after: 3 days


# 269844 11-Aug-2014 rpaulo

Revert r269839.

This doesn't work like I expected and the if clause is never matched.
It turns out that the problem with the older make is unrelated.

MFC after: 3 days


# 269842 11-Aug-2014 rpaulo

Add .d files to the reverse matching pattern in bsd.dep.mk to account
for source file dependencies.

This follows the .y and .l behaviour.

MFC after: 3 days


# 269840 11-Aug-2014 rpaulo

Fix another typoe in the definition of DTrace SOBJS.

MFC after: 3 days


# 269839 11-Aug-2014 rpaulo

bsd.dep.mk: use the empty() function with the check for .d files.

Seems to work better with the old make.

MFC after: 3 days


# 269838 11-Aug-2014 rpaulo

Fix an error in the dependency of the DTrace object file.

MFC after: 3 days


# 269775 10-Aug-2014 rpaulo

Fix a few problems with the USDT probes:

* Include OBJDIR to make sure the generated file is found;
* Simplify the definition of OBJS;
* Add targets for shared objects and for profiled objects.

MFC after: 3 days


# 268921 20-Jul-2014 des

Older versions of flex (like the one used in FreeBSD <= 9) expect the
output file name to follow the -o flag immediately, with no intervening
whitespace.

Reported by: ian@
MFC after: 1 week


# 268877 19-Jul-2014 des

Use -o (output to file) instead of -t (print to stdout) and a redirect.

MFC after: 1 week


# 268544 11-Jul-2014 rpaulo

Optimisation: replace ${_D:R} with just ${_D}.

MFC after: 3 weeks


# 268541 11-Jul-2014 rpaulo

Automatically build and link DTrace USDT probes.

This completely replaces bsd.dtrace.mk which never worked reliably.

MFC after: 3 weeks


# 268300 05-Jul-2014 rpaulo

bsd.dep.mk: add support for generating DTrace header files from .d files.

MFC after: 3 weeks


# 241790 20-Oct-2012 marcel

Revert r241752. The claim that it's more correct while at the same time
causing a build breakage is interesting to say the least.


# 241752 19-Oct-2012 marcel

Improve upon the previous commit to fix the yacc rule.
1. Have the resulting C file depend on the resulting H
file as it should be. Touch the C file to make sure
the C file is newer than the H file to keep make
happy.
2. Apply the same fix to the other instance of .ORDER,
missed in the previous commit.


# 241298 06-Oct-2012 marcel

Add support for bmake. This includes:
1. Don't do upgrade_checks when using bmake. As long as we have WITH_BMAKE,
there's a bootstrap complication in ths respect. Avoid it. Make the
necessary changes to have upgrade_checks work wth bmake anyway.
2. Remove the use of -E. It's not needed in our build because we use ?= for
the respective variables, which means that we'll take the environment
value (if any) anyway.
3. Properly declare phony targets as phony as bmake is a lot smarter (and
thus agressive) about build avoidance.
4. Make sure CLEANFILES is complete and use it on .NOPATH. bmake is a lot
smarter about build avoidance and should not find files we generate in
the source tree. We should not have files in the repository we want to
generate, but this is an easier way to cross this hurdle.
5. Have behavior under bmake the same as it is under make with respect to
halting when sub-commands fail. Add "set -e" to compound commands so
that bmake is informed when sub-commands fail.
6. Make sure crunchgen uses the same make as the rest of the build. This
is important when the make utility isn't called make (but bmake for
example).
7. While here, add support for using MAKEOBJDIR to set the object tree
location. It's the second alternative bmake looks for when determining
the actual object directory (= .OBJDIR).

Submitted by: Simon Gerraty <sjg@juniper.net>
Submitted by: John Van Horne <jvanhorne@juniper.net>


# 239613 23-Aug-2012 dim

Make sure bsd.dep.mk does not filter out -stdlib=xxx from CXXFLAGS,
since this determines parts of the C++ include path.

MFC after: 1 week


# 226244 11-Oct-2011 das

Also pass the -ansi flag through to mkdep (requested by bde), and fix
a cut-and-paste-o (noticed by rdivacky).


# 226216 10-Oct-2011 das

Pass -std= flags in CFLAGS to mkdep. Without this, preprocessor tests
for particular compiler features might be evaluated differently by
mkdep than they would be by cc.


# 220863 19-Apr-2011 dim

Remove support for the Intel C Compiler from the build infrastructure.
This support has not worked for several years, and is not likely to work
again, unless Intel decides to release a native FreeBSD version of their
compiler. ;)


# 220755 17-Apr-2011 dim

Remove libobjc and other Objective-C related components, as these are
extremely outdated, and not used by anything in the base system.

Silence from: current@


# 211437 17-Aug-2010 rpaulo

For every instance of '.if ${CC} == "foo"' or '.if ${CC} != "foo"' in
Makefiles or *.mk files, use ${CC:T:Mfoo} instead, so only the basename
of the compiler command (excluding any arguments) is considered.

This allows you to use, for example, CC="/nondefault/path/clang -xxx",
and still have the various tests in bsd.*.mk identify your compiler as
clang correctly.

ICC if cases were also changed.

Submitted by: Dimitry Andric <dimitry at andric.com>


# 211427 17-Aug-2010 rpaulo

Make sure any -U CFLAGS are not filtered out when calling mkdep, as
gnu/usr.bin/cc/libiberty first defines the PREFIX macro, and then
undefines it again, so mkdep with clang complains.

Submitted by: Dimitry Andric <dimitry at andric.com>
Reviewed by: ru


# 202579 18-Jan-2010 ru

Allow the CTAGS to be set to something other than "gtags" or "ctags",
but assume it supports a ctags(1)-compatible syntax.

PR: 46676
Submitted by: Lyndon Nerenberg
MFC after: 3 days


# 202578 18-Jan-2010 ru

If CTAGS is not set or set to something other than "ctags" or "gtags",
"cleandepend" was not removing the .depend file; fixed.

PR: 126747
MFC after: 3 days


# 175980 05-Feb-2008 des

Revert CLEANDEPFILES commit per ru@'s request; it does not really solve
the problem. The correct fix will follow.


# 175937 03-Feb-2008 des

Normally, when a header file is removed from the build (as i4b headers
were recently), a simple 'make cleandepend; make depend' is sufficient
to keep the tree buildable after a cvs update when doing incremental
builds.

However, kdump and truss use a script which searches for header files
that define ioctls, and generates C code that includes them. This
script will usually not need updating when a header file is removed,
so the normal dependency mechanism will not realize that it needs to
be re-run. One is therefore left with code that references dead files
but will only be removed by a full 'make clean', which defeats the
purpose of incremental builds.

To work around this, modify the cleandepend target in bsd.dep.mk to
also remove any files listed in a new variable named CLEANDEPFILES,
and modify kdump's and truss's Makefiles accordingly.

MFC after: 2 weeks


# 139761 06-Jan-2005 krion

Remove trailing spaces.


# 139108 21-Dec-2004 ru

NOTAGS -> NO_TAGS


# 126890 12-Mar-2004 trhodes

This are the build infrastructure changes to allow to use the
Intel C/C++ compiler (lang/icc) to build the kernel.

The icc CPUTYPE CFLAGS use icc v7 syntax, icc v8 moans about them, but
doesn't abort. They also produce CPU specific code (new instructions
of the CPU, not only CPU specific scheduling), so if you get coredumps
with signal 4 (SIGILL, illegal instruction) you've used the wrong
CPUTYPE.

Incarnations of this patch survive gcc compiles and my make universe.
I use it on my desktop.

To use it update share/mk, add
/usr/local/intel/compiler70/ia32/bin (icc v7, works)
or
/usr/local/intel_cc_80/bin (icc v8, doesn't work)
to your PATH, make sure you have a new kernel compile directory
(e.g. MYKERNEL_icc) and run
CFLAGS="-O2 -ip" CC=icc make depend
CFLAGS="-O2 -ip" CC=icc make
in it.

Don't compile with -ipo, the build infrastructure uses ld directly to
link the kernel and the modules, but -ipo needs the link step to be
performed with Intel's linker.

Problems with icc v8:
- panic: npx0 cannot be emulated on an SMP system
- UP: first start of /bin/sh results in a FP exception

Parts of this commit contains suggestions or submissions from
Marius Strobl <marius@alchemy.franken.de>.

Reviewed by: silence on -arch
Submitted by: netchild


# 125119 27-Jan-2004 ru

Fixed bogus ${FOO:Mbar} tests where the actual intent is to check
if the result set is empty. While here, replaced non-bogus empty
string comparisons with equivalent empty() checks.


# 124637 17-Jan-2004 ru

Guess better the source for object files in case .depend file is
missing and there are multiple choices using multiple inference
(suffix transformation) rules.

This is known to fix compilation of s_log1p.o in lib/msun on i386,
as otherwise it attempted to use s_log1p.S as the source (which is
marked broken) instead of legal s_log1p.c which is in CFLAGS. The
normal case where .depend file exists is not affected.

Reviewed by: bde


# 124490 13-Jan-2004 ru

Introduce DPSRCS, that holds the list of source files which are
needed for generating dependencies. SRCS are always part of it,
and normally only they.

This can be useful in some random cases where it's necessary to
have something in .depend that isn't part of SRCS. This will be
used to replace a hack in lib/libpam/libpam/Makefile.


# 124435 12-Jan-2004 ru

- Replaced several := ops with their += equivalents; the old
form became unnecessary with the bsd.prog.mk,v 1.69 change.

- Eliminated duplicate y.tab.h in SRCS.

Reviewed by: bde

- Complementary to the said bsd.prog.mk change, use the fact
that inner .for loops are not real loops but a tricky form
of a local macro for the outer loop's variable, and switch
to using faster variable modifiers to replace extensions.


# 117195 03-Jul-2003 bde

Use make(1) instead of a shell script to implement the checkdpadd target.
This is simpler, and is easy to do now that make(1) supports substituting
regexps. Fixed missing '$' anchor in the regexp. Use less cryptic names
for temporary variables.

Submitted by: ru (early version)
Reviewed by: ru


# 117171 02-Jul-2003 ru

The .s files do not have to be preprocessed with cpp(1).


# 117122 01-Jul-2003 ru

There's no reason to keep separate AINC knob anymore.
The only real use of it (lib/libc/Makefile) has been
fixed, and if necessary, the contents of AINC should
be added to CFLAGS.

Explained by: bde


# 105327 17-Oct-2002 ru

Added the new variable CTAGS which, if set to "ctags", reverts
to creating the tags file using ctags(1). Defaults to "gtags".
Made GTAGSFLAGS and HTAGSFLAGS overrideable, added CTAGSFLAGS.
Folded bsd.prog.mk version of `tags' into bsd.dep.mk.

PR: bin/42852


# 103436 16-Sep-2002 peter

Initiate deorbit burn for the i386-only a.out related support. Moves are
under way to move the remnants of the a.out toolchain to ports. As the
comment in src/Makefile said, this stuff is deprecated and one should not
expect this to remain beyond 4.0-REL. It has already lasted WAY beyond
that.

Notable exceptions:
gcc - I have not touched the a.out generation stuff there.
ldd/ldconfig - still have some code to interface with a.out rtld.
old as/ld/etc - I have not removed these yet, pending their move to ports.
some includes - necessary for ldd/ldconfig for now.

Tested on: i386 (extensively), alpha


# 99344 03-Jul-2002 ru

Moved checkdpadd target to where it logically belongs.


# 96132 06-May-2002 bde

Fixed missing quotes in the default for MKDEPCMD in the CC != cc case.
"CC='cc -Dfoo' make depend" was very broken.


# 95306 23-Apr-2002 ru

Merge bsd.obj.mk's version of the _SUBDIR target with bsd.subdir.mk.

Ensure all standard targets honor SUBDIR. Now `make obj' descends into
SUBDIRs even if NOOBJ is set (some descendants may still need an object
directory, but we do not have such precedents). Now `make install' in
non-bsd.subdir.mk makefiles runs `afterinstall' target _after_ `install'
in SUBDIRs, like we do in bsd.subdir.mk. Nothing depended on the wrong
order anyway.

Fixed `distribute' targets (except for the bsd.subdir.mk version) so that
they do not depend on _SUBDIR; `distribute' calls `install' which already
depends on _SUBDIR.

De-standardize `maninstall', otherwise manpages would be installed twice.
(To be revised later.)


# 95255 22-Apr-2002 ru

Prohibit the direct inclusion of bsd.dep.mk.


# 94922 17-Apr-2002 ru

Doh, previous revision made .depend to be almost always out of date.

Spotted by: bde

Fortunately, we have a powerful make(1). Apply some black magic to
make it DTRT. (Better viewed as diff to revision 1.30.)


# 94841 16-Apr-2002 ru

Don't spawn extra make(1) process to execute _EXTRADEPEND.


# 94768 15-Apr-2002 ru

Only pass our idea of `CC' down to mkdep(1) if it's non-default.


# 92648 19-Mar-2002 bde

Removed bogus env(1) commands. make(1) uses a real shell, so
"env name=value ... cmd ..." was just a pessimized way of doing
"name=value ... cmd ...". Note that make(1) can't optimize
either of these to an exec of env(1) or "cmd" even if the second
"..." is simple, since it can't tell that the shell metacharacter
in "name=value" is actually handled by env(1).


# 92361 15-Mar-2002 obrien

Pass our idea of `CC' down to mkdep.

Tested on: sparc64


# 50476 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 42793 18-Jan-1999 simokawa

Clean new index file(GPATH) of global.

Submitted by: Shigio Yamaguchi <shigio@wafu.netgate.net>


# 36673 05-Jun-1998 dt

Recognize ".cpp" as a C++ suffix.

PR: 3476


# 36055 15-May-1998 bde

Oops, forgot references in previous commit.

Submitted by: Brian Cully <shmit@erols.com>
PR: 6178


# 36054 15-May-1998 bde

Support Objective C almost as well as C++.

Notes:
- We no longer use -fgnu-runtime in bsd.lib.mk, since it is the default
and bsd.lib.mk is the wrong place to override it.
- Gnu C doesn't have a special compiler driver for Objective C like it
does for C++. The defaults are suitable for Gnu C. Use `OBJCLIBS='
in /etc/make.conf for POC.


# 35951 11-May-1998 bde

Oops, the lex and yacc sources must be added to SRCS before ${SRCS}
is used in the dependency list for ${DEPENDFILE}. `make depend' was
broken for a few days. `make world' only uses `make depend' when
NOCLEAN is defined, so only a few people noticed the bug.

Submitted by: mostly by jmg


# 35838 08-May-1998 bde

Moved lex and yacc source handling from bsd.prog.mk to bsd.dep.mk
so that it applies to libraries (and lkms) as well as programs.


# 35789 06-May-1998 bde

Only include bsd.dep.mk in `mk'files that handle C sources. Abuse
bsd.obj.mk instead of bsd.dep.mk for defining the _SUBDIR target
and a default tags target. Abuse bsd.obj.mk for defining default
cleandepend and depend targets.


# 34829 23-Mar-1998 eivind

Support new version of global.

Submitted by: Shigio Yamaguchi <shigio@wafu.netgate.net>
Tested by: make buildworld


# 34181 07-Mar-1998 bde

Pass -nostdinc to mkdep for assembler and C files (it was already
passed for C++ files).

Don't pass -nostdlib to mkdep for C++ files.

Don't use temporary variables to obfuscate the main rule.


# 33681 20-Feb-1998 bde

Fixed cleaning of tags files. GSYMS was forgotten.


# 31717 14-Dec-1997 wosch

Optimize rm(1) usage.


# 30113 05-Oct-1997 jkh

Changes to support full make parallelism (-j<n>) in the world
target.
Reviewed by: <many different folks>
Submitted by: Nickolay N. Dudorov" <nnd@nnd.itfs.nsk.su>


# 28806 26-Aug-1997 bde

Fixed cleandepend target. Subdirectories weren't handled unless SRCS
was defined.


# 26715 18-Jun-1997 asami

Add `B' to list of flags to pass through from C*FLAGS when using mkdep
(bsd.dep.mk) and compiling assembly language sources (bsd.lib.mk).
This doesn't change anything for our current source tree, but if you
want to use the -B switch in C*FLAGS to specify the location of
compiler subprograms, now you can do it.

Reviewed by: bde (implicitly)


# 24861 13-Apr-1997 jkh

Support GLOBAL style tags.


# 24750 09-Apr-1997 bde

Use `ld -f' (actually `cc -Wl,-f') at `make depend' time to generate
almost perfect dependencies on crt0's and libraries. DPADD and
bsd.libnames.mk should go away soon. Use a new _EXTRADEPEND target
to implement this and to avoid editing of .depend when .depend isn;t
being rebuilt. The afterdepend target doesn't seem to be good for
anything and is now unused.

Fixed LDDESTDIR for the DESTDIR case when ${SHLIBDIR} != /usr/lib.

Added commented-out -nostdlib to LDDESTDIR for the DESTDIR case.
The wrong libraries may be used without this; however it breaks
linkage to crt0 and libc.


# 22988 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


# 21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 17819 25-Aug-1996 jkh

Back out the recent DEPEND changes - as Bruce points out, it's bogus.

I'll leave any future Makefile hackery to him since he's clearly thought
about this a great deal more than I have.


# 17800 23-Aug-1996 jkh

Make it possible to turn the depend pass off entirely with a NO_DEPEND
variable.
Requested-By: wollman


# 17310 27-Jul-1996 jkh

The clean rule in here was bogus.


# 16663 24-Jun-1996 jkh

Bring in my changes for removing the pestilent obj links (unless you
really want them) from /usr/src. This is the final version of the
patches, incorporating the feedback I've received from -current.


# 15903 25-May-1996 wosch

Add some comments for variables and targets.


# 14986 01-Apr-1996 wosch

add MKDEPCMD?= and DEPENDFILE?=
replace sh(1) commands with make(1) builtins


# 6252 08-Feb-1995 bde

More complete implementation of SUBDIR for programs, libraries and kmods.
`depend' wasn't supported. This seems to have only broken `make depend'
in gnu/usr.bin/ld.

bsd.prog.mk:
Build the man pages in ${MANDEPEND} at build time.


# 1845 04-Aug-1994 wollman

Add a couple of files we created in 1.x.