Commit Graph

2741 Commits

Author SHA1 Message Date
Glen Barber
52259a98ad MFH
Sponsored by:	The FreeBSD Foundation
2016-03-02 16:14:46 +00:00
Bryan Drewery
2eed38a070 CCACHE_BUILD+META_MODE: Lookup and canonicalize the default CCACHE_DIR.
This is done to prevent not having CCACHE_DIR causing meta mode with filemon to
see stat changes in the ccache dir and cause rebuilds.

Sponsored by:	EMC / Isilon Storage Division
2016-03-01 22:25:54 +00:00
Bryan Drewery
e9508dc293 FAST_DEPEND: Prefer .OBJDIR depend files.
Sponsored by:	EMC / Isilon Storage Division
2016-02-29 21:10:47 +00:00
Ed Maste
a304b6d089 Enable NO_ make variable deprecation warning
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D5495
2016-02-29 17:57:11 +00:00
Bryan Drewery
aae63957af 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
2016-02-26 22:14:00 +00:00
Bryan Drewery
b29980a63f META_MODE: Default to the silent build.
Sponsored by:	EMC / Isilon Storage Division
2016-02-26 22:13:56 +00:00
Bryan Drewery
342863e712 Move PROGS logic to proper place and remove redundant and unneeded logic.
- bsd.progs.mk is safe to include regardless of PROGS/PROGS_CXX/SCRIPTS
  being set.
- bsd.progs.mk includes bsd.prog.mk always and will bring in
  bsd.files.mk and bsd.obj.mk.
- DIRDEPS_BUILD: There's no need for _SKIP_BUILD or _SKIP_STAGING as the
  PROGS were implicitly being built by the staging dependency anyway.  This
  was also preventing other objects from building if they were not part of
  the staging sets.
- DIRDEPS_BUILD: This fixes PROGS without bsd.test.mk not staging.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2016-02-26 22:13:52 +00:00
Bryan Drewery
db74470bff DIRDEPS_BUILD: Fix some things building in MAKELEVEL0.
For PROGS this was recursing twice since MAKELEVEL0 is for 'dirdeps'
which then really builds in a sub-make.

Sponsored by:	EMC / Isilon Storage Division
2016-02-26 22:13:48 +00:00
Bryan Drewery
180a8487ee Track .meta files for .sh but don't preserve timestamp.
See r291320 for more information.

Sponsored by:	EMC / Isilon Storage Division
2016-02-26 22:13:42 +00:00
Bryan Drewery
64923b1128 Allow configuring .MAKE.MODE via META_MODE as meta.sys.mk does.
meta.sys.mk is only used for the DIRDEPS_BUILD.

Sponsored by:	EMC / Isilon Storage Division
2016-02-26 22:13:38 +00:00
Bryan Drewery
4e47b95cc9 Remove more references to targets we've never had.
Sponsored by:	EMC / Isilon Storage Division
2016-02-26 22:13:35 +00:00
Bryan Drewery
f1702f873d Remove _manpages and _maninstall targets as they are no longer needed.
r96164 added them to avoid recursing twice with _SUBDIR.  That issue was
fixed in bsd.subdir.mk in r291635 for all targets.

Sponsored by:	EMC / Isilon Storage Division
2016-02-26 22:13:31 +00:00
Ed Maste
ca8b902aa5 Install elftoolchain elfcopy(1) as objcopy(1) by default
As of r295661 elfcopy supports PE format for EFI boot binaries and is a
viable objcopy implementation for the base system and ports.

The (temporary) src.conf knob WITHOUT_ELFCOPY_AS_OBJCOPY knob may be set
to obtain the GNU version if necessary.

PR:		207091 [exp-run]
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
2016-02-26 15:46:14 +00:00
Bryan Drewery
caf1fb322e 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
2016-02-26 01:52:33 +00:00
Bryan Drewery
57b5a84431 Slightly lessen the amount of job target output for SUBDIR_PARALLEL.
Sponsored by:	EMC / Isilon Storage Division
2016-02-25 21:04:52 +00:00
Bryan Drewery
a2835556e9 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
2016-02-25 20:02:42 +00:00
Mariusz Zaborski
c501d73c7e Convert casperd(8) daemon to the libcasper.
After calling the cap_init(3) function Casper will fork from it's original
process, using pdfork(2). Forking from a process has a lot of advantages:
1. We have the same cwd as the original process.
2. The same uid, gid and groups.
3. The same MAC labels.
4. The same descriptor table.
5. The same routing table.
6. The same umask.
7. The same cpuset(1).
From now services are also in form of libraries.
We also removed libcapsicum at all and converts existing program using Casper
to new architecture.

Discussed with:		pjd, jonathan, ed, drysdale@google.com, emaste
Partially reviewed by:	drysdale@google.com, bdrewery
Approved by:		pjd (mentor)
Differential Revision:	https://reviews.freebsd.org/D4277
2016-02-25 18:23:40 +00:00
Bryan Drewery
b9c6f31681 Add more STANDALONE_SUBDIR_TARGETS.
Sponsored by:	EMC / Isilon Storage Division
2016-02-24 22:27:22 +00:00
Dimitry Andric
14e9c9161c Merge ^/head r295902 through r296006. 2016-02-24 21:38:51 +00:00
Bryan Drewery
1fdc8e0e39 PROGS: Only the main process will install INCS.
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2016-02-24 20:28:48 +00:00
Bryan Drewery
80f9a973ef FAST_DEPEND: Still need to remove DEPENDFILE when rebuilding.
This avoids _EXTRADEPEND adding duplicate entries.

Sponsored by:	EMC / Isilon Storage Division
2016-02-24 20:28:45 +00:00
Bryan Drewery
62d89d81bf PROGS: Remove the 'build one' optimization since it breaks 'build multiple'
Given PROG1 PROG2, 'make PROG1' would work but 'make PROG1 PROG2' would not.
Just build them as normal in a sub-make to avoid any issues.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2016-02-24 17:20:34 +00:00
Bryan Drewery
a540ec75d7 Show full DIRPRFX in subdir parallel target name.
For example when building, from buildworld, lib/atf/libatf-c++/tests/detail:
    --- all_subdir_atf ---
is now:
    --- all_subdir_lib/atf/libatf-c++/tests/detail ---

Sponsored by:	EMC / Isilon Storage Division
2016-02-24 17:20:31 +00:00
Bryan Drewery
b9cd412e7b 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
2016-02-24 17:19:18 +00:00
Bryan Drewery
70ca9ec4b9 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
2016-02-24 17:19:13 +00:00
Bryan Drewery
68add21344 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
2016-02-24 17:19:09 +00:00
Bryan Drewery
d7beff082b 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
2016-02-24 17:19:05 +00:00
Bryan Drewery
3d437ee23f 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
2016-02-24 17:18:55 +00:00
Bryan Drewery
a65a0e56cf PROGS: Only recurse on called targets like done for SUBDIR in r291635.
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2016-02-24 17:18:28 +00:00
Glen Barber
317cec3c43 MFH
Sponsored by:	The FreeBSD Foundation
2016-02-22 12:28:23 +00:00
Dimitry Andric
9893f787ec Merge ^/head r295601 through r295844. 2016-02-21 13:49:26 +00:00
Bryan Drewery
4ab0941ded DIRDEPS_BUILD: Enable the post-build footer/stats display.
There is no real downside to this and it is useful to have enabled.

Sponsored by:	EMC / Isilon Storage Division
2016-02-19 22:28:45 +00:00
Bryan Drewery
9fb02a70d0 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
2016-02-19 00:41:24 +00:00
Glen Barber
72c3aa02dc MFH
Sponsored by:	The FreeBSD Foundation
2016-02-18 00:37:58 +00:00
Bryan Drewery
ae038fc336 Add CLEANDEPEND[FILES|DIRS] and simplify the tags cleanup to use it.
Sponsored by:	EMC / Isilon Storage Division
2016-02-16 19:11:17 +00:00
Bryan Drewery
b601b230d8 Always remove .depend.* regardless of WITH_FAST_DEPEND in case of changing
which is used.

Sponsored by:	 EMC / Isilon Storage Division
2016-02-16 19:02:04 +00:00
Bryan Drewery
3b1e60a40a Remove temporary hack from r294370 for SSH upgrades.
MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2016-02-16 19:00:22 +00:00
Bryan Drewery
58857dfcb9 Add an .ORDER for all/install.
Sponsored by:	EMC / Isilon Storage Division
2016-02-16 02:14:15 +00:00
Bryan Drewery
d3157f0915 Test directories can build in parallel fine.
Sponsored by:	EMC / Isilon Storage Division
2016-02-16 02:13:59 +00:00
Bryan Drewery
1bd4272fb9 Consolidate common beforebuild logic.
Sponsored by:	EMC / Isilon Storage Division
2016-02-16 02:09:48 +00:00
Glen Barber
0fe0fe112f MFH
Sponsored by:	The FreeBSD Foundation
2016-02-15 21:58:52 +00:00
Dimitry Andric
90a4726375 Merge ^/head r295544 through r295600. 2016-02-13 16:02:12 +00:00
Ed Maste
c1da297433 Add libpe for elfcopy(1) PE/COFF support
Sponsored by:	The FreeBSD Foundation
2016-02-12 21:12:47 +00:00
Dimitry Andric
4156ce4fed Merge ^/head r295351 through r295543. 2016-02-11 20:07:09 +00:00
Glen Barber
bbb51924bb MFH
Sponsored by:	The FreeBSD Foundation
2016-02-08 12:16:01 +00:00
Enji Cooper
71b7fa1252 Simplify running the FreeBSD test suite
Replace `make regress` (legacy test make target) and `make test` (incomplete
test make target added with the FreeBSD test suite) with make check as it's
consistent with other open source projects.

`make check` defaults to running tests from `.OBJDIR`, but can be overridden
with the `CHECKDIR` variable.

Add `make checkworld` target to simplify running the FreeBSD test suite from
`TESTSBASE` (i.e. the top-level tests directory), similar to buildworld.

Document `make check` and `make checkworld` in build(7).

Other minor changes:

- Rename intermediate file (`Kyuafile.auto`) to `Kyuafile` to simplify
  `make check`.
- Remove terse warnings attached to `beforetest`/`aftertest`.
- Add kyua binary check to check target in suite.test.mk; error out if it's
  not found

The MFC is [partly] contingent on other build related changes being MFCed.

Differential Revision: https://reviews.freebsd.org/D4406
MFC after: 2 months
X-MFC to: stable/10
Relnotes: yes
Reviewed by: bdrewery, Evan Cramer <eccramer@gmail.com>
Sponsored by: EMC / Isilon Storage Division
2016-02-07 18:40:04 +00:00
Dimitry Andric
a49d8b6ecc Merge ^/head r294961 through r295350. 2016-02-06 14:07:17 +00:00
Bryan Drewery
5e13851e18 Fix style and remove excess / for installing SYMLINKS.
Sponsored by:	EMC / Isilon Storage Division
2016-02-04 01:08:51 +00:00
Bryan Drewery
5f3a77a594 MLINKS: Deduplicate some of the logic, simplify, and unhide install commands.
Sponsored by:	EMC / Isilon Storage Division
2016-02-04 01:08:48 +00:00
Bryan Drewery
88612bc6b6 Fix cat files being installed to wrong place since r284685.
Sponsored by:	EMC / Isilon Storage Division
2016-02-04 01:08:45 +00:00
Bryan Drewery
d341613006 Stop hiding link install commands.
This is no longer needed now that a .for loop is used rather
than inline shell script.

Sponsored by:	EMC / Isilon Storage Division
2016-02-04 01:08:42 +00:00
Bryan Drewery
91a44dfeef Don't let NLSLINKS contain itself.
Sponsored by:	EMC / Isilon Storage Division
2016-02-03 23:37:14 +00:00
Glen Barber
c8296cbb96 MFH
Sponsored by:	The FreeBSD Foundation
2016-01-29 14:52:54 +00:00
Bryan Drewery
2cf60b3ce2 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
2016-01-28 18:57:47 +00:00
Dimitry Andric
752d00608c Merge ^/head r294777 through r294960. 2016-01-27 22:52:20 +00:00
Glen Barber
0e186c0aab MFH
Sponsored by:	The FreeBSD Foundation
2016-01-27 14:16:13 +00:00
Bryan Drewery
5444d429b9 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
2016-01-27 01:33:26 +00:00
Bryan Drewery
dab1328231 Set a value for _RECURSING_PROGS for debugging.
MFC after:	3 days
Sponsored by:	EMC / Isilon Storage Division
2016-01-27 01:24:08 +00:00
Bryan Drewery
369737d7f0 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
2016-01-27 01:24:05 +00:00
Dimitry Andric
14d5c08ba8 Merge ^/head r294599 through r294776. 2016-01-26 07:49:11 +00:00
Bryan Drewery
fc2c2cd9e3 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
2016-01-25 22:29:44 +00:00
Bryan Drewery
cfa5f2be13 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
2016-01-25 22:29:41 +00:00
Bryan Drewery
a298c2797c 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
2016-01-25 22:29:32 +00:00
Bryan Drewery
c34d27e401 Import latest host-target.mk 1.11 from contrib/bmake/mk 2016-01-25 18:43:21 +00:00
Bryan Drewery
af928aa0cc Import latest gendirdeps.mk 1.29 from contrib/bmake/mk 2016-01-25 18:40:25 +00:00
Bryan Drewery
1e6a58ed3d Import latest meta.subdir.mk 1.11 from contrib/bmake/mk 2016-01-25 18:34:15 +00:00
Bryan Drewery
5f99c0d321 Import latest auto.obj.mk 1.12 from contrib/bmake/mk. 2016-01-25 18:16:41 +00:00
Dimitry Andric
d9b9dae1a9 Merge ^/head r294169 through r294598. 2016-01-22 20:41:56 +00:00
Glen Barber
59d43d11fe MFH
Sponsored by:	The FreeBSD Foundation
2016-01-20 09:50:54 +00:00
Bryan Drewery
473bcb0163 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
2016-01-20 01:40:18 +00:00
Bryan Drewery
eb2ad8724b FAST_DEPEND: Fix improperly depending all .So objects on all headers.
This was a regression in r290629, which was revealed partly in r294360.
Once 'make depend' has ran it will generate all headers already.  Thus
even with FAST_DEPEND lacking proper dependencies before building, it
will not have any missing headers.  Once objects are compiled the depend
files will be generated with proper dependencies.

Sponsored by:	EMC / Isilon Storage Division
2016-01-19 23:28:18 +00:00
Bryan Drewery
b69c69e000 bsd.subdir.mk: Allow easier modification of [STANDALONE_]SUBDIR_TARGETS.
This reworks r289254 and removes ALL_SUBDIR_TARGETS.

Because there is an include guard in this file there is no need for
LOCAL_ or ?= on SUBDIR_TARGETS or STANDALONE_SUBDIR_TARGETS.  These can
just be set via src.conf.  By the time bsd.subdir.mk is included it will
just append the values to the existing value and work fine.  This allows
a consistent way to append to these variables without introducing a
LOCAL_ var for STANDALONE_SUBDIR_TARGETS or renaming the historical
SUBDIR_TARGETS.

Sponsored by:	EMC / Isilon Storage Division
2016-01-19 22:42:07 +00:00
Bryan Drewery
ddc3c00d4b installconfig is PARALLEL_SUBDIR safe.
Sponsored by:	EMC / Isilon Storage Division
2016-01-19 22:42:04 +00:00
Bryan Drewery
d3b887fd0d 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
2016-01-19 22:41:58 +00:00
Bryan Drewery
952de59d68 META_MODE: Ensure bmake does not use filemon if it is not loaded.
Sponsored by:	EMC / Isilon Storage Division
2016-01-19 22:41:55 +00:00
Bryan Drewery
0b6ba3f22a Define .MAKE.MODE to normal to avoid the need for :U later.
Sponsored by:	EMC / Isilon Storage Division
2016-01-19 22:41:44 +00:00
Dimitry Andric
7aa11cde7e Merge ^head r294090 through r294168. 2016-01-16 17:33:09 +00:00
Bryan Drewery
9f286e8295 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
2016-01-15 22:08:51 +00:00
Dimitry Andric
7f38eb34e2 Merge ^/head r293850 through r294089. 2016-01-15 17:55:00 +00:00
Glen Barber
a11378bd93 MFH
Sponsored by:	The FreeBSD Foundation
2016-01-14 13:29:12 +00:00
Steven Hartland
ff7ea78834 Allow file specific user-specified flag overrides
Allow user-specified warning flag overrides for specific files under
bsd.sys.mk, in the same way kern.mk does.

This will to be used by future commits.

MFC after:	2 weeks
X-MFC-With:	r293268
Sponsored by:	Multiplay
2016-01-14 10:09:05 +00:00
Glen Barber
e60680024a MFH
Sponsored by:	The FreeBSD Foundation
2016-01-12 01:23:45 +00:00
Dimitry Andric
89d3f0ea4e Merge ^/head r293430 through r293685. 2016-01-11 19:36:44 +00:00
Ed Maste
b80f3546a8 Support use of LLVM's libunwind for exception unwinding
It is built in libgcc_s.so and libgcc_eh.a to simplify transition.

It is enabled by default on arm64 (where we previously had no other
unwinder) and may be enabled for testing on other platforms by setting
WITH_LLVM_LIBUNWIND in src.conf(5).

Also add compiler-rt's __gcc_personality_v0 implementation for use with
the LLVM unwinder.

Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D4787
2016-01-09 00:42:07 +00:00
Bryan Drewery
0e87e3cb6f Revert r293286. It was not intended to come in yet. 2016-01-07 00:20:47 +00:00
Bryan Drewery
3ba0785a74 Move the MAKEOBJDIRPREFIX value guard to sys.mk and expand to MAKEOBJDIR.
This will ensure that the variable was not set as a make override, in
make.conf, src.conf or src-env.conf.  It allows setting the value in
src-env.conf when using WITH_AUTO_OBJ since that case properly handles
changing .OBJDIR (except if MAKEOBJDIRPREFIX does not yet exist which is
being discussed to be changed).

This change allows setting a default MAKEOBJDIRPREFIX via local.sys.env.mk.

Sponsored by:	EMC / Isilon Storage Division
2016-01-07 00:19:03 +00:00
Dimitry Andric
9b52dc8469 Merge ^/head r293036 through r293174. 2016-01-04 20:31:09 +00:00
Glen Barber
b626f5a73a MFH r289384-r293170
Sponsored by:	The FreeBSD Foundation
2016-01-04 19:19:48 +00:00
Warner Losh
c42ade6081 Add new LIBSOFT option. This is similar to the LIB32 option, except
for libraries that follow the soft float ABI. It's only supported on
armv6 as a transition to the new hard float ABI, so mark as broken
everywhere else.
2016-01-03 04:32:04 +00:00
Dimitry Andric
381fba8537 Merge r293006 from clang380-import branch:
For determining the compiler version, quote the string to be echo'd,
otherwise the command might fail.  This is because clang -v now results
in the following:

FreeBSD clang version 3.8.0 (trunk 256633) (based on LLVM 3.8.0svn)

The second "3.8.8svn)" string tripped up the shell command.

MFC after:	3 days
2015-12-31 22:48:46 +00:00
Dimitry Andric
79f08b9adf For determining the compiler version, quote the string to be echo'd,
otherwise the command might fail.  This is because clang -v now results
in the following:

FreeBSD clang version 3.8.0 (trunk 256633) (based on LLVM 3.8.0svn)

The second "3.8.8svn)" string tripped up the shell command.
2015-12-31 21:01:06 +00:00
Dimitry Andric
34cdd77646 First part of updating llvm/clang build glue: getting llvm-tblgen,
clang-tblgen and clang itself built.
2015-12-31 14:39:45 +00:00
Colin Percival
f051a5b324 Make libxnet.so a symlink to libc.so. This makes -lxnet a no-op, as
POSIX requires for the c99 compiler.

(In fact, our c99(1) already ignores -lxnet; but our make(1) doesn't set
${CC} correctly, and our cc(1) treats xnet like any other library.)

Reviewed by:	kib
2015-12-25 11:29:18 +00:00
Colin Percival
6729297833 Document that make's .POSIX: handling is broken. In fact, it has been
broken ever since it was added in November 1996.
2015-12-25 10:08:42 +00:00
Enji Cooper
3bbee5556a Clean up Kyuafile.tmp, not Kyuafile.auto.tmp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D4406 (part of a larger diff)
Reviewed by: emaste, Evan Cramer <eccramer@gmail.com>
Sponsored by: EMC / Isilon Storage Division
2015-12-20 06:29:03 +00:00
Enji Cooper
46319c9839 Document LOCALBASE in the bsd.test.mk section
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D4406 (part of a larger diff)
Reviewed by: emaste, Evan Cramer <eccramer@gmail.com>
Sponsored by: EMC / Isilon Storage Division
2015-12-20 06:27:36 +00:00
Enji Cooper
26dfa13578 - Use LOCALBASE instead of KYUA_PREFIX for the --prefix to kyua(1)
- Use LOCALBASE instead of hardcoding /usr/local for perl

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D4406 (part of a larger diff)
Reviewed by: emaste, Evan Cramer <eccramer@gmail.com>
Sponsored by: EMC / Isilon Storage Division
2015-12-20 06:26:15 +00:00
Enji Cooper
fd6f8c3710 Deal with another hardcoded reference to Kyuafile in the KYUAFILE == auto
case

Differential Revision: https://reviews.freebsd.org/D4406 (part of a larger diff)
Reviewed by: emaste, Evan Cramer <eccramer@gmail.com>
Sponsored by: EMC / Isilon Storage Division
2015-12-20 06:01:53 +00:00
Enji Cooper
cc696e80e7 Fix typo in r292500 by adding missing conditional statement
MFC after: 1 week
X-MFC with: r292500
Pointyhat to: ngie
Differential Revision: https://reviews.freebsd.org/D4406 (part of a larger diff)
Sponsored by: EMC / Isilon Storage Division
2015-12-20 05:41:12 +00:00
Enji Cooper
c4835f11d0 Simplify Kyuafile generation logic with KYUAFILE == auto and
related complexity with variables

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D4406 (part of a larger diff)
Reviewed by: emaste, Evan Cramer <eccramer@gmail.com>
Sponsored by: EMC / Isilon Storage Division
2015-12-20 05:38:06 +00:00
Ed Maste
d0ba16f775 Enable LLDB by default on amd64 and arm64
LLDB is usable for userland core file and live debugging on amd64, and
for userland core file debugging on arm64. In general it works at least
as well on FreeBSD as our in-tree gdb version, so enable it by default
to allow for broader use and testing.

An LLDB tutorial is available at http://lldb.llvm.org/tutorial.html, and
a table mapping GDB commands to LLDB commands can be found at
http://lldb.llvm.org/lldb-gdb.html .

LLDB also has some level of support for FreeBSD on arm, mips, i386,
and powerpc, but is not yet ready to have them enabled by default.

Reviewed by:	gnn
Relnotes:	Yes
2015-12-16 19:23:10 +00:00
Bryan Drewery
66f96a1362 DIRDEPS_BUILD: Support bootstrapping from PROGS.(DPADD|LIBADD).
Sponsored by:	EMC / Isilon Storage Division
2015-12-15 02:51:05 +00:00
Bryan Drewery
a09a83ca33 DIRDEPS_BUILD: Fix incorrectly adding in RELDIR for DIRDEPS in bootstrapping.
This is not wrong, but was unexpected.  Using <empty>:H results in '.' which
then using the rest of the conversion was added in RELDIR.  This was also
causing an empty _DP_DIRDEPS to resolve to SRCTOP for DIRDEPS.

Sponsored by:	EMC / Isilon Storage Division
2015-12-15 02:46:14 +00:00
Bryan Drewery
92cc283761 DIRDEPS_BUILD: Avoid duplicates in DIRDEPS for bootstrapping.
This logic is potentially included multiple times, so overwrite the temporary
variable rather than append to it.

Sponsored by:	EMC / Isilon Storage Division
2015-12-15 02:27:31 +00:00
Bryan Drewery
382cab60bd Add comment about OBJTOP not yet being defined outside of META MODE.
It is fine for the purpose of the check though.

Sponsored by:	EMC / Isilon Storage Division
2015-12-15 00:40:04 +00:00
Bryan Drewery
aaa345b8ae Follow-up r291739: Don't suggest LDADD on private libs to use LIBADD.
This is because LDADD+=-lFOO is not the same as LDADD+=-lprivateFOO which is
what the private libs in LIBADD are.

Sponsored by:	EMC / Isilon Storage Division
2015-12-15 00:16:34 +00:00
John Baldwin
d6fb489498 Start on a new library (libsysdecode) that provides routines for decoding
system call information such as system call arguments.  Initially this
will consist of pulling duplicated code out of truss and kdump though it
may prove useful for other utilities in the future.

This commit moves the shared utrace(2) record parser out of kdump into
the library and updates kdump and truss to use it.  One difference from
the previous version is that the library version treats unknown events
that start with the "RTLD" signature as unknown events.  This simplifies
the interface and allows the consumer to decide how to handle all
non-recognized events.  Instead, this function only generates a string
description for known malloc() and RTLD records.

Reviewed by:	bdrewery
Differential Revision:	https://reviews.freebsd.org/D4537
2015-12-15 00:05:07 +00:00
Bryan Drewery
89401452f3 Allow overriding FILESDIRs for snmp files.
Sponsored by:	EMC / Isilon Storage Division
2015-12-14 22:42:05 +00:00
Bryan Drewery
e610b45868 Let termcap be used in LIBADD.
Sponsored by:	EMC / Isilon Storage Division
2015-12-14 21:00:00 +00:00
Bryan Drewery
54f8ee8840 DIRDEPS_BUILD: Don't force C dependencies on kernel modules for bootstrapping.
These use ld(1), effectively -nostdlib, and don't need any of these
normal dependencies.

kmod builds also define PROG so just checking for KMOD here seems to be
the easiest to handle it.

Sponsored by:	EMC / Isilon Storage Division
2015-12-11 22:55:41 +00:00
Ruslan Bukin
1fdcc5e5c0 Start support for the RISC-V 64-bit architecture developed by UC Berkeley.
RISC-V is a new ISA designed to support computer research and education, and
is now become a standard open architecture for industry implementations.

This is a minimal set of changes required to run 'make kernel-toolchain'
using external (GNU) toolchain.

The FreeBSD/RISC-V project home: https://wiki.freebsd.org/riscv.

Reviewed by:	andrew, bdrewery, emaste, imp
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
Differential Revision:	https://reviews.freebsd.org/D4445
2015-12-11 22:55:23 +00:00
Marcelo Araujo
682d840496 Fix minor typos introduced on r292084.
Approved by:	rodrigc (mentor)
Differential Revision:	https://reviews.freebsd.org/D4495
2015-12-11 07:24:25 +00:00
Warner Losh
fd48e7a5af Handle CPUTYPE=armv[4567]* better. gcc expects those to be either
-march=foo or -mcpu=generic-foo. Catch the armvX* case and pass
the right args for it.
2015-12-11 05:39:45 +00:00
Warner Losh
9ca5434380 Move the inclusion of bsd.cpu.mk from sys.mk to bsd.opts.mk. However,
for historical behavior that ports depends on, include it if we're
inside the ports tree.

Differential Review: https://reviews.freebsd.org/D4383
Ports Exp run: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=205021
2015-12-11 05:39:44 +00:00
Bryan Drewery
de1f9ee234 Convert contrib/ofed libraries to LIBADD.
Sponsored by:	EMC / Isilon Storage Division
2015-12-10 00:07:11 +00:00
Bryan Drewery
5e99f8430d Sort the LIB list.
Sponsored by:	EMC / Isilon Storage Division
2015-12-10 00:07:05 +00:00
Bryan Drewery
b7df39cc12 CCACHE_BUILD: Only export CCACHE_PATH= if it was already set with a value.
Older ccache don't work with an empty CCACHE_PATH value.  They will error with:
  ccache: FATAL: Could not find compiler "cc" in PATH
  make: "/mnt/bdrewery/git/onefs/src/share/mk/bsd.compiler.mk" line 134: Unable to determine compiler type for /usr/local/bin/ccache cc.  Consider setting COMPILER_TYPE.

Sponsored by:	EMC / Isilon Storage Division
2015-12-08 20:20:40 +00:00
Ed Maste
1cee64a8c7 Add comment explaining aarch64's BROKEN_OPTIONS
In-tree bintuils and GCC do not support aarch64 or other recent
architectures.
2015-12-08 19:19:26 +00:00
Bryan Drewery
fb9def88bd META MODE: Define a STAGE_TARGET_OBJTOP and export it alone with
STAGE_OBJTOP and STAGE_HOST_OBJTOP.

These will always be overridden in sub-makes when building in-tree, but
are exported for the benefit of hooking in external builds, such as
ports.

Sponsored by:	EMC / Isilon Storage Division
2015-12-08 17:56:40 +00:00
Bryan Drewery
9229b1797a Fix some makeman issues.
- Don't bother looking up REVISION/BRANCH/etc from release/, or the
  CPUTYPE check, as these are not used for makeman and wastes time.  The also
  invokes auto.obj.mk after I reverted auto.obj.mk ignoring -V in r291312.
- Don't modify CC or PATH when WITH_CCACHE_BUILD or WITH_META_MODE is enabled
  as it leads to bsd.compiler.mk errors.

Sponsored by:	EMC / Isilon Storage Division
2015-12-08 17:09:17 +00:00
Ed Maste
015dfda6c6 Build and install userland .debug files by default
Debug data files are now built by default with 'make buildworld' and
installed with 'make installworld'. This facilitates debugging but
requires more disk space both during the build and for the installed
world. Debug files may be disabled by setting WITHOUT_DEBUG_FILES=yes
in src.conf(5).

Reviewed by:	bdrewery, eadler, vangyzen
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D4018
2015-12-07 19:15:52 +00:00
Bryan Drewery
10f696a52d 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
2015-12-07 16:08:22 +00:00
Bryan Drewery
b9964333e0 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
2015-12-07 16:08:19 +00:00
Bryan Drewery
69afbf0275 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
2015-12-07 16:08:16 +00:00
Enji Cooper
765086c5da Remove unused atf.test.mk variables
- ATF_BUILD_CC
- ATF_BUILD_CPP
- ATF_BUILD_CXX
- ATF_SHELL
- ATF_PREFIX

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-12-06 07:30:18 +00:00
Enji Cooper
7254383959 Remove redundant default TESTSDIR that is already defined in bsd.test.mk
after r289158

MFC after: 1 week
X-MFC with: r289158
Sponsored by: EMC / Isilon Storage Division
2015-12-06 07:00:23 +00:00
Bryan Drewery
2231cd21d8 Fix 'install*' and many other missing targets with DIRDEPS_BUILD.
My changes in r291635 broke 'make install*' for DIRDEPS_BUILD but also
revealed that some other targets were not guaranteed to be created if
there was a SUBDIR defined.  One example is 'installfiles' was never
defined if SUBDIR was not empty.

Sponsored by:	EMC / Isilon Storage Division
2015-12-04 07:54:19 +00:00
Bryan Drewery
0368d219ac The .if redirection on .WAIT is no longer needed with bmake.
Sponsored by:	EMC / Isilon Storage Division
2015-12-04 07:54:16 +00:00
Bryan Drewery
85874b565c Fix 'afterinstall' order not being respected after my changes in r291635.
The problem was that 'afterinstall' was not coming after SUBDIRs were
installed which was the expectation at least in sys/modules for kldxref.

Reported by:	np
Pointyhat to:	bdrewery
Sponsored by:	EMC / Isilon Storage Division
2015-12-04 07:54:13 +00:00
Bryan Drewery
b4f9ba38ee Rearrange some common logic. 2015-12-04 07:54:04 +00:00
Bryan Drewery
7b861220df Add assertion for when LIBADD should be used rather than LDADD/DPADD.
Sponsored by:	EMC / Isilon Storage Division
2015-12-04 03:17:59 +00:00
Bryan Drewery
eacae6dc66 Fix LDADD/DPADD that should be LIBADD.
Sponsored by:	EMC / Isilon Storage Division
2015-12-04 03:17:47 +00:00
Bryan Drewery
2fd6394d34 Rework unknown LIBADD assertion to be more clear and to not suggest adding
DPADD/LDADD_<foo> variables that are a special case.

Sponsored by:	EMC / Isilon Storage Division
2015-12-04 03:17:24 +00:00
Bryan Drewery
3530922240 Support all of the CDDL/ZFS libraries for LIBADD.
Sponsored by:	EMC / Isilon Storage Division
2015-12-04 03:17:21 +00:00
Bryan Drewery
7aab86d59d For INTERNALLIB always add in the corresponding _DP_ and use LIBADD in
the real build file.

This lessens the need to define DPADD_<lib> and LDADD_<lib> to just very
special cases.

Sponsored by:	EMC / Isilon Storage Division
2015-12-04 03:17:17 +00:00
Bryan Drewery
568f2ee158 Don't create a Makefile.depend in share/mk.
This would cause it to be included everywhere in the build since it is
the MAKESYSPATH.  This leads to including dirdeps.mk more times than
desired.

Sponsored by:	EMC / Isilon Storage Division
2015-12-04 03:17:10 +00:00
Bryan Drewery
249f51a492 DIRDEPS_BUILD: Install new Makefile.depend files atomically.
Sponsored by:	EMC / Isilon Storage Division
2015-12-04 03:17:07 +00:00
Bryan Drewery
bd1944cacc DIRDEPS_BUILD: For the bootstrapped LIBADD from DPADD, resolve paths to RELDIR.
This allows the LIBDEPS/DPADD for the clang build to not have
../../../lib/clang/* in DIRDEPS.

Sponsored by:	EMC / Isilon Storage Division
2015-12-04 03:17:04 +00:00
Bryan Drewery
d6b837de97 Revert r288966 as it is redundant and not right.
bsd.prog.mk and bsd.lib.mk already make OBJS depend on headers when there is
not .OBJDIR/.depend file, which is still true for the initial meta mode builds.
If there was something to benefit the meta mode build here then it should be
extended to the non-meta mode build as well.

Some of the problems here were just DPSRCS being hooked up wrongly, fixed in
r291330.

The logic itself is flawed as 'buildfiles' is in a different part of the
dependency tree than the objects and headers are, so the objects will still be
built independent from 'buildfiles'.  'buildfiles' is not ordered in the build
before objects.

Sponsored by:	EMC / Isilon Storage Division
2015-12-03 22:39:42 +00:00
Enji Cooper
1c4ced8fe8 Fix a typo in a comment (spacial -> special)
Sponsored by: EMC / Isilon Storage Division
2015-12-03 07:42:00 +00:00
Bryan Drewery
4b9378e3ba Add LIBNANDFS.
Sponsored by:	EMC / Isilon Storage Division
2015-12-02 05:23:12 +00:00
Bryan Drewery
03173d2ff0 bsd.subdir.mk: Only recurse on called targets, rather than dependencies.
This is to fix 'make all' causing it to recurse on both 'all' and 'buildconfig'
due to 'buildconfig' being in ALL_SUBDIR_TARGETS and being a dependency of
'all'.

This now adds all of the '*includes', '*files' targets as subdir targets,
allowing them to recurse.

This also removes the need for some 'realinstall' hacks in bsd.subdir.mk since
it no longer recurses; only 'install' will recurse and call the proper
'beforeinstall', 'realinstall', and 'afterinstall' in each sub-directory.

This fixes 'make includes' and 'make files' to not be a rerolled ${MAKE}
sub-shell but to rather just recurse on 'inclues' and 'files'.  This avoids
various issues such as the one fixed in r289462.  As such revert Makefile.inc1
back to using 'includes' which avoids an extra tree walk and parallelizes
the includes phases better.

Makefile.inc1 includes a guard so that 'make all' will not use SUBDIR_PARALLEL,
added in r289438.  This is so users do not get a probably broken build if they
run 'make all' from the top-level.  Before the change in this commit, the
workaround for 'make everything' was 'par-all' which would depend on 'all' and
cause a proper parallel recursion.  Now that will not work so a new
_PARALLEL_SUBUDIR_OK is used to allow it.

This is still part of an effort to combine bsd.(files|incs|confs).mk and move
some of its logic out of bsd.subdir.mk, as attempted in r289282 and reverted in
r289331.  This commit fixes the problems found there which was mostly double
recursing during 'includes' which would recurse on itself and 'buildincludes'
and 'installincludes', all in parallel.  The logic is still in bsd.subdir.mk
for now.

I've been cautious about this commit but have experienced no breakage on the
tree except for the 'par-all' case which was already a hack.  If something foo
is depending on something bar that should recurse, it is very likely that the
foo target is being recursed on already meaning that bar will still effectively
recurse once sub-directories call foo.

Discussed on:	arch@
MFC after:	never
Sponsored by:	EMC / Isilon Storage Division
2015-12-02 01:50:22 +00:00
Bryan Drewery
70d3d39e78 Revert r291633. Some files were missed. 2015-12-02 01:49:22 +00:00
Bryan Drewery
2cdf1c99f0 bsd.subdir.mk: Only recurse on called targets, rather than dependencies.
This is to fix 'make all' causing it to recurse on both 'all' and 'buildconfig'
due to 'buildconfig' being in ALL_SUBDIR_TARGETS and being a dependency of
'all'.

This now adds all of the '*includes', '*files' targets as subdir targets,
allowing them to recurse.

This also removes the need for some 'realinstall' hacks in bsd.subdir.mk since
it no longer recurses; only 'install' will recurse and call the proper
'beforeinstall', 'realinstall', and 'afterinstall' in each sub-directory.

This fixes 'make includes' and 'make files' to not be a rerolled ${MAKE}
sub-shell but to rather just recurse on 'inclues' and 'files'.  This avoids
various issues such as the one fixed in r289462.  As such revert Makefile.inc1
back to using 'includes' which avoids an extra tree walk and parallelizes
the includes phases better.

Makefile.inc1 includes a guard so that 'make all' will not use SUBDIR_PARALLEL,
added in r289438.  This is so users do not get a probably broken build if they
run 'make all' from the top-level.  Before the change in this commit, the
workaround for 'make everything' was 'par-all' which would depend on 'all' and
cause a proper parallel recursion.  Now that will not work so a new
_PARALLEL_SUBUDIR_OK is used to allow it.

This is still part of an effort to combine bsd.(files|incs|confs).mk and move
some of its logic out of bsd.subdir.mk, as attempted in r289282 and reverted in
r289331.  This commit fixes the problems found there which was mostly double
recursing during 'includes' which would recurse on itself and 'buildincludes'
and 'installincludes', all in parallel.  The logic is still in bsd.subdir.mk
for now.

I've been cautious about this commit but have experienced no breakage on the
tree except for the 'par-all' case which was already a hack.  If something foo
is depending on something bar that should recurse, it is very likely that the
foo target is being recursed on already meaning that bar will still effectively
recurse once sub-directories call foo.

Discussed on:	arch@
MFC after:	never
Sponsored by:	EMC / Isilon Storage Division
2015-12-02 01:47:27 +00:00
Bryan Drewery
5afa19725e Add assertions that capture invalid configurations for new libraries.
Fix current findings, which should fix cases of NO_SHARED not building
properly.

Given libfoo:
 - Ensure that a LIBFOO is set.  For INTERNALLIBS advise setting this in
   src.libnames.mk, otherwise bsd.libnames.mk.
 - Ensure that a LIBFOODIR is properly set.
 - Ensure that _DP_foo is set and matches the LIBADD in the build of foo's own
   Makefile

Sponsored by:	EMC / Isilon Storage Division
2015-12-02 01:24:31 +00:00
Bryan Drewery
eaab62402b Don't overlink pthread to kerberos library consumers.
I'm not sure why this was here, none of these use pthread themselves and
none of the consumers are broken with removing this.

Sponsored by:	EMC / Isilon Storage Division
2015-12-02 01:23:16 +00:00
Bryan Drewery
7bce873919 Don't overlink pthread to libsqlite3 consumers.
At least usr.bin/mandoc was overlink.

Sponsored by:	EMC / Isilon Storage Division
2015-12-02 01:17:09 +00:00
Bryan Drewery
3d07982db6 Fix truncation of _DP_proc and add missing libelf.
Sponsored by:	EMC / Isilon Storage Division
2015-12-02 00:54:05 +00:00
Bryan Drewery
60648601bf Reduce overlinking of libdtrace consumers with libctf, libelf, libproc.
The proper place for this list is _DP_dtrace.

Due to removing the LDADD_dtrace, more LIBADD are needed in
cddl/usr.sbin/dtrace to prevent underlinking.

This fixes overlinking in cddl/usr.sbin/lockstat and
cddl/usr.sbin/plockstat.

Sponsored by:	EMC / Isilon Storage Division
2015-12-02 00:49:49 +00:00
Bryan Drewery
ed8addefb2 Don't overlink libmt consumers with libsbuf.
This change came in r281332 which was reducing overlinking in mt(1) but
currently mt(1) is linked with sbuf when it does not need it due to the
LDADD_mt+=${LDADD_sbuf}.  Only libmt needs sbuf.

Add sbuf to _DP_mt so static linkage of libmt picks it up.

Sponsored by:	EMC / Isilon Storage Division
2015-12-02 00:49:42 +00:00
Bryan Drewery
70b19675cd libssh uses libz even without MK_LDNS
Sponsored by:	EMC / Isilon Storage Division
2015-12-02 00:49:39 +00:00
Bryan Drewery
87a2755dee Revert incomplete r291623. 2015-12-02 00:17:13 +00:00
Bryan Drewery
eaa435e794 Add assertions that capture invalid configurations for new libraries.
Fix current findings.

Given libfoo:
 - Ensure that a LIBFOO is set.  For INTERNALLIBS advise setting this in
   src.libnames.mk, otherwise bsd.libnames.mk.
 - Ensure that a LIBFOODIR is properly set.
 - Ensure that _DP_foo is set and matches the LIBADD in the build of foo's own
   Makefile

Sponsored by:	EMC / Isilon Storage Division
2015-12-02 00:01:09 +00:00
Bryan Drewery
de52e5bdca Define a LIB*SRCDIR for all known _LIBRARIES.
This is a follow-up to r291327 which added a LIB*DIR for all known
_LIBRARIES.

Sponsored by:	EMC / Isilon Storage Division
2015-12-01 22:19:17 +00:00
Bryan Drewery
945ceaafbc Only include src.conf if _WITHOUT_SRCCONF not defined.
This does not really fix anything currently since _WITHOUT_SRCCONF must be
defined in the environment or local.sys.*.mk, but is proper and needed for
downstream fixes.  I am working towards reworking src.conf inclusion still.

Sponsored by:	EMC / Isilon Storage Division
2015-12-01 20:56:16 +00:00
Bryan Drewery
f3dd2bc756 Support LOCAL_LIBRARIES for LIBADD.
Sponsored by:	EMC / Isilon Storage Division
2015-12-01 20:50:14 +00:00
Bryan Drewery
4910373ca8 Add missing LIB80211 entry for DPADD needs.
Sponsored by:	EMC / Isilon Storage Division
2015-12-01 18:09:40 +00:00
Bryan Drewery
3a42764af7 Fix underlinking in lib80211 and define static dependencies in src.libnames.mk
so NO_SHARED works properly.

Reported by:	Manfred Antar <null@pozo.com>
Sponsored by:	EMC / Isilon Storage Division
2015-12-01 17:38:52 +00:00
Bryan Drewery
6feede08e1 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
2015-12-01 15:50:35 +00:00
Bryan Drewery
4902050fa5 META MODE: Add some basic bootstrapping support for no Makefile.depend.
This will not work for bootstrapping dependencies, it will only
bootstrap the top-level build directory.

Sponsored by:	EMC / Isilon Storage Division
2015-12-01 05:29:30 +00:00
Bryan Drewery
b1f92fa229 META MODE: Update dependencies with 'the-lot' and add missing directories.
This is not properly respecting WITHOUT or ARCH dependencies in target/.
Doing so requires a massive effort to rework targets/ to do so.  A
better approach will be to either include the SUBDIR Makefiles directly
and map to DIRDEPS or just dynamically lookup the SUBDIR.  These lose
the benefit of having a userland/lib, userland/libexec, etc, though and
results in a massive package.  The current implementation of targets/ is
very unmaintainable.

Currently rescue/rescue and sys/modules are still not connected.

Sponsored by:	EMC / Isilon Storage Division
2015-12-01 05:23:19 +00:00
Bryan Drewery
3bed45ab81 META MODE: Rework [bootstrapped] tools PATH support.
- Support more of the toolchain from TOOLSDIR.
- This also improves 'make bootstrap-tools' to pass, for example,
  AS=/usr/bin/as to Makefile.inc1, which will tell cross-tools to use
  external toolchain support and avoid building things we won't be using
  in the build.
- Always set the PATH to contain the staged TOOLSDIR directories when
  not building the bootstrap targets.

  The previous version was only setting this at MAKE.LEVEL==0 and if the
  TOOLSDIR existed.  Both of these prevented using staged tools that were
  built during the build though as DIRDEPS with .host dependencies, such
  as the fix for needing usr.bin/localedef.host in r291311.
  This is not a common tool so we must build and use it during the build,
  and need to be prepared to change PATH as soon as it appears.

  This should also fix the issue of host dependencies disappearing from
  Makefile.depend and then reappearing due to the start of the fresh build not
  having the directory yet, resulting in the tools that were built not actually
  being used.
- Only use LEGACY_TOOLS while building in Makefile.inc1.  After r291317
  and r291546 there is no need to add LEGACY_TOOLS into the PATH for
  the pseudo/targets/toolchain build.
- Because the pseudo/targets/toolchain will now build its own
  [clang-]tblgen, the special logic in clang.build.mk is no longer needed.
- LEGACY_TOOLS is no longer used outside of targets/pseudo/bootstrap-tools
  so is no longer passed into the environment in its build.

Sponsored by:	EMC / Isilon Storage Division
2015-12-01 05:19:02 +00:00
Bryan Drewery
3c42abd89d META MODE: Don't trim out lib/clang/include dependency.
Doing this causes more trouble than it is worth regarding cyclic
dependencies.  It should not be needed after cleaning up MACHINE=host
builds in r291324.

Sponsored by:	EMC / Isilon Storage Division
2015-12-01 05:18:55 +00:00
Bryan Drewery
b6725ecdb2 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
2015-12-01 03:09:54 +00:00
Bryan Drewery
593e465913 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
2015-12-01 03:00:10 +00:00
Bryan Drewery
c7f8dda118 META MODE: Always define HOST_*, even if not using them.
Sponsored by:	EMC / Isilon Storage Division
2015-12-01 00:53:17 +00:00
Adrian Chadd
5c15e5d044 Add missing lib declaration. 2015-11-30 06:56:25 +00:00
John Baldwin
7f911abe54 Add support to libkvm for reading vmcores from other architectures.
- Add a kvaddr_type to represent kernel virtual addresses instead of
  unsigned long.
- Add a struct kvm_nlist which is a stripped down version of struct nlist
  that uses kvaddr_t for n_value.
- Add a kvm_native() routine that returns true if an open kvm descriptor
  is for a native kernel and memory image.
- Add a kvm_open2() function similar to kvm_openfiles().  It drops the
  unused 'swapfile' argument and adds a new function pointer argument for
  a symbol resolving function.  Native kernels still use _fdnlist() from
  libc to resolve symbols if a resolver function is not supplied, but cross
  kernels require a resolver.
- Add a kvm_nlist2() function similar to kvm_nlist() except that it uses
  struct kvm_nlist instead of struct nlist.
- Add a kvm_read2() function similar to kvm_read() except that it uses
  kvaddr_t instead of unsigned long for the kernel virtual address.
- Add a new kvm_arch switch of routines needed by a vmcore backend.
  Each backend is responsible for implementing kvm_read2() for a given
  vmcore format.
- Use libelf to read headers from ELF kernels and cores (except for
  powerpc cores).
- Add internal helper routines for the common page offset hash table used
  by the minidump backends.
- Port all of the existing kvm backends to implement a kvm_arch switch and
  to be cross-friendly by using private constants instead of ones that
  vary by platform (e.g. PAGE_SIZE).  Static assertions are present when
  a given backend is compiled natively to ensure the private constants
  match the real ones.
- Enable all of the existing vmcore backends on all platforms.  This means
  that libkvm on any platform should be able to perform KVA translation
  and read data from a vmcore of any platform.

Tested on:	amd64, i386, sparc64 (marius)
Differential Revision:	https://reviews.freebsd.org/D3341
2015-11-27 18:58:26 +00:00
Bryan Drewery
11ffa20fa0 Standardize on OBJTOP in and outside of META MODE.
Sponsored by:	EMC / Isilon Storage Division
2015-11-26 01:47:56 +00:00
Bryan Drewery
93e779a26c META MODE: These need object directories to handle staging.
Sponsored by:	EMC / Isilon Storage Division
2015-11-26 01:14:27 +00:00
Bryan Drewery
8ffe95d60f Follow-up r291338 to handle .d, .y and .l files better as well.
X-MFC-With:	r291338
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-11-25 22:40:14 +00:00
Bryan Drewery
c3d4829ed1 Fix the "common object" handling to not depend on ".o" if SRCS only contains
headers.

This resulted in 'don't know how to make .o.' errors after the changes in
r289286.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-11-25 22:32:16 +00:00
Bryan Drewery
ebf076dfa5 Define a LIB<NAME>DIR for every library that LIBADD provides.
This is going to be used to allow DIRDEPS to be bootstrapped off of
LIBADD/DPADD.  It currently works for internal libraries which have a
DIR defined for them but also use the .a library from a src-mapped obj
directory.  It can also be useful for using -L without a --sysroot per
LIBADD to use the OBJDIR version of the libraries.

I didn't review every LIBADD, so it is possible this is missing some.

Sponsored by:	EMC / Isilon Storage Division
2015-11-25 19:49:55 +00:00
Bryan Drewery
2802302e64 META MODE: Fix MACHINE=host builds.
We need to not use -nostdinc since it breaks building of clang itself.  Use
-isystem rather than -I/usr/include and -nostdinc which gets us using
the stage include directory before searching the real host headers.
This allows removing more of the -I hacks to get host headers since the
headers are no longer excluded.  The -B seemed unneeded.

This fixes building of secure/lib/libcrypto which was looking at the
/usr/include/openssl/asn1.h header rather than the staged one.

This fixes building of clang which wants to find its own internal
headers in the STAGEDIR/usr/lib/clang/* path.

Sponsored by:	EMC / Isilon Storage Division
2015-11-25 19:45:01 +00:00
Bryan Drewery
cf10dd450d Stop looking up the same id(1) results in sub-makes.
Sponsored by:	EMC / Isilon Storage Division
2015-11-25 19:44:58 +00:00
Bryan Drewery
4aa63711a7 META MODE: Fix 'make bootstrap-tools'.
The main problem was bitrot after elftoolchain being swapped in for the
GNU toolchain.

This also reworks how the list of 'host allowed' libraries is determined
to only allow INTERNALLIBs, which is needed for libelftc to come in.

For usr.bin/readelf use the same hack, as libelf and libdward, to bring in
the needed sys/ headers for host builds.  This has not yet been a problem due
to readelf not being built as a host tool in buildworld.  This is possible
in the meta build though when building the toolchain.

Sponsored by:	EMC / Isilon Storage Division
2015-11-25 19:44:51 +00:00
Bryan Drewery
b791fbe630 META MODE: Don't create .meta files when symlinking sources into the obj directory.
Tracking these leads to situations where meta mode will consider the
file to be out of date if /bin/sh or /bin/ln are newer than the source
file.  There's no reason for meta mode to do this as make is already
handling the rebuild dependency fine.

Sponsored by:	EMC / Isilon Storage Division
2015-11-25 19:44:43 +00:00
Bryan Drewery
80dfd0d4a2 META MODE: Show PATH on errors.
Sponsored by:	EMC / Isilon Storage Division
2015-11-25 19:44:31 +00:00
Bryan Drewery
08b20c637c META MODE: Don't add staged DPADDs to DIRDEPS when bootstrapping gendirdeps.
This was finding libraries that were installed into DESTDIR/usr/lib,
where DESTDIR is the stage directory, and then adding in usr/lib to
DIRDEPS.  Just exclude the STAGE_ROOT if defined.

Discussed with:	sjg
Sponsored by:	EMC / Isilon Storage Division
2015-11-25 19:13:45 +00:00
Bryan Drewery
5e2f7161d7 META MODE: Define variables this file uses that were defined elsewhere.
Discussed with:	sjg
Sponsored by:	EMC / Isilon Storage Division
2015-11-25 19:13:42 +00:00
Bryan Drewery
02d37cd3e4 META MODE: Don't truncate DIRDEPS for bootstrapping during gendirdeps.
Reviewed by:	sjg
Sponsored by:	EMC / Isilon Storage Division
2015-11-25 19:13:39 +00:00
Bryan Drewery
bb8cd0c6f0 META MODE: Revert r287879 so that 'make -V' still uses AUTO_OBJ.
This has caused much confusion for myself as there are quite a lot of
variables that depend on having a proper ${.OBJDIR}.

Sponsored by:	EMC / Isilon Storage Division
2015-11-25 19:13:32 +00:00
Bryan Drewery
7b3ea376a2 META MODE: Prefer INSTALL=tools/install.sh to lessen the need for xinstall.host.
This both avoids some dependencies on xinstall.host and allows
bootstrapping on older releases to work due to lack of at least 'install -l'
support.

Sponsored by:	EMC / Isilon Storage Division
2015-11-25 19:10:28 +00:00
Bryan Drewery
440ffb7e1e There seems to be no reason to duplicate CANONICALOBJDIR logic from bsd.obj.mk,
which is included for crunchgen builds.

No change in build output occurred with this change.

Sponsored by:	EMC / Isilon Storage Division
2015-11-23 23:04:52 +00:00
Dag-Erling Smørgrav
1765946ba9 Retire the NONE cipher option. 2015-11-23 12:48:13 +00:00
Warner Losh
dbd69b0dc4 Add aarch64 support to CPUTYPE 2015-11-20 21:49:49 +00:00
Bryan Drewery
1da1353262 META MODE: Don't stage INTERNALPROGs.
This is only for sys/boot.  INTERNALPROG is not a build tool, it is just a way
to generate OBJS from a list of SRCS and use those objects elsewhere.

Sponsored by:	EMC / Isilon Storage Division
2015-11-20 00:22:55 +00:00
Bryan Drewery
86dd299005 Remove unsupported ia64.
Sponsored by:	EMC / Isilon Storage Division
2015-11-19 22:54:37 +00:00
Warner Losh
828b0885d9 Add arm CPUTYPE values typically used on FreeBSD. 2015-11-19 17:06:12 +00:00
Warner Losh
17f6dfcca0 Fix missing endif. 2015-11-19 03:55:44 +00:00
Warner Losh
129898e521 Fix mips CPUTYPE so that we can pass it through to gcc.
Keep old CPUTYPEs around for compatibility. Also include
a list of typical values for FreeBSD.

# Split out from other changes in D4155

Differential Revision: https://reviews.freebsd.org/D4155
2015-11-19 03:11:20 +00:00
Bryan Drewery
f35c8b65a6 FAST_DEPEND: Similar to r290629, do always depend on headers if 'make depend'
has not ran yet.

This fixes building objects directly, or skipping 'make depend', not generating
required headers first.  This case did work without FAST_DEPEND so there's no
reason it should not work here as well.

An example of this can be seen building in gnu/usr.bin/binutils/libbfd
without running 'make depend' first to generate config.h.

Sponsored by:	EMC / Isilon Storage Division
MFC after:	3 weeks
X-MFC-With:	r290433
2015-11-19 00:45:36 +00:00
Simon J. Gerraty
dba62d8dcf Default MK_META_MODE from MK_DIRDEPS_BUILD
This allows most of the build to simply consider MK_META_MODE

Update to latest dirdeps.mk so we can do:

make -f dirdeps.mk bin/cat.i386

Reviewed by:	bdrewery
2015-11-16 22:50:23 +00:00
Enji Cooper
6c40e2d68c Add NO_WERROR and WARNS to PROG_OVERRIDE_VARS for bsd.prog.mk compatibility
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-11-15 18:51:48 +00:00
Warner Losh
f894f17244 Fix URL for powerpc cpu options. Remove reference to ia64 options as
no longer relevant.
2015-11-14 06:18:50 +00:00
Simon J. Gerraty
948f327ee4 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
2015-11-14 03:24:48 +00:00
Bryan Drewery
2224fae179 META MODE: Don't double stage SYMLINKS for shared libraries.
This also fixes truncating the path that the links were installed to, which
was most likely going to be the same directory the library was in anyhow.

Let bsd.sys.mk handle SYMLINKS via stage_symlinks.  stage_libs continues to
handle the SHLIB_LINK though since it is not a SYMLINKS.

This fixes a race, seen easily in lib/libthr, where libpthread_p.a is created
by both stage_libs and stage_symlinks resulting in 'ln: File exists'.

Sponsored by:	EMC / Isilon Storage Division
Discussed with:	sjg
2015-11-13 22:27:24 +00:00
Bryan Drewery
c04d716b55 Revert r290740.
Discussing with sjg@, we agree the better fix is to be done in meta.stage.mk.

This also broke staging of SYMLINKS for non-shared libraries, such as for
lib/libcompiler_rt, which results in all Makefile.depend removing it.

Sponsored by:	EMC / Isilon Storage Division
2015-11-13 20:25:30 +00:00
Bryan Drewery
08682b1bdf bsd.doc.mk: Similar to r289391, make installing to a missing directory an error.
This avoids the problems fixed in r290772.

Sponsored by:	EMC / Isilon Storage Division
MFC after:	2 weeks
2015-11-13 17:27:23 +00:00
Bryan Drewery
e13d8c1244 META MODE: Don't double stage SYMLINKS for libraries.
meta.stage.mk is handling ${SYMLINKS:T} for stage_libs already.  The logic in
bsd.sys.mk to handle ${SYMLINKS} was brought in r247817 when it was moved out
of bsd.prog.mk and bsd.lib.mk into bsd.sys.mk.  The logic previously was
limited to bsd.prog.mk.

This fixes a race, seen easily in lib/libthr, where libpthread_p.a is created
by both stage_libs and stage_symlinks resulting in 'ln: File exists'.

Sponsored by:	EMC / Isilon Storage Division
2015-11-13 01:47:56 +00:00
Bryan Drewery
00bd6d0f08 Move META MODE's HOST_CC/CXX/CPP setting to local.meta.sys.mk, which
centralizes the handling of CC and HOST_CC.

This fixes a bug with WITH_CCACHE_BUILD when using MACHINE=host since
CC is overridden in local.init.mk via src.opts.mk long before bsd.compiler.mk
is included.

Originally the ccache implementation was placed in local.init.mk but moved
to bsd.compiler.mk as it seemed more proper and avoided other ordering
issues.

Sponsored by:	EMC / Isilon Storage Division
2015-11-11 23:52:08 +00:00
Bryan Drewery
b03ca5c3ec 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
2015-11-09 23:37:04 +00:00
Bryan Drewery
9160419c7a 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
2015-11-08 00:50:18 +00:00
Bryan Drewery
dbced32af5 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
2015-11-08 00:50:13 +00:00
Bryan Drewery
3cccdc9d58 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
2015-11-08 00:50:09 +00:00
Baptiste Daroussin
3e4f384ed2 Merge from head r290483 2015-11-07 11:02:33 +00:00
Bryan Drewery
8260928dfd The 'buildenv' target can safely be ran with '+'. 2015-11-06 21:49:17 +00:00
Bryan Drewery
cf1eeb33be 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
Bryan Drewery
0e9c4ca8b1 Correct a comment which appears to be mistakingly mechanically changed in r265420.
MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2015-11-05 22:42:40 +00:00
Bryan Drewery
208f108362 Allow 'make buildenv' to work anywhere in the src tree.
Sponsored by:	EMC / Isilon Storage Division
2015-11-05 22:28:31 +00:00
Craig Rodrigues
a36eca08bb Rename libohash to libopenbsd.
libopenbsd is an internal library which
to bring in compatibility stuff from OpenBSD.
This will allow us to bring in more
OpenBSD utilities into the FreeBSD base system.

We similarly use libnetbsd for bringing in stuff from NetBSD.

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D4078
2015-11-04 07:20:55 +00:00
Baptiste Daroussin
3c3feed41a Merge from head 2015-11-01 21:17:38 +00:00
Bryan Drewery
4e461ce12d Don't hide stderr when checking ${CC} --version.
This can have important debugging information such as 'cc: not found' or
'ccache: error: Could not find compiler "cc" in PATH'.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-10-31 02:07:30 +00:00
Enji Cooper
d04fda6cc4 Unbreak bsd.progs.mk with PROGS (but not PROGS_CXX) and when invoking the
"one of many" targets, e.g. `make hello_world`, where hello_world is a C
program

Tested with: PROGS and PROGS_CXX
MFC after: 1 week
X-MFC with: r289289
Sponsored by: EMC / Isilon Storage Division
2015-10-30 06:07:41 +00:00
Bryan Drewery
0edd283235 Fix regression from using .USEBEFORE in _SUBDIR in r289705.
Using .USEBEFORE had the unintended side-effect of changing the directory for
the real target ran in the current directory.  For example this meant that
the 'make clean' would run in one of the SUBDIR.

Sponsored by:	EMC / Isilon Storage Division
Pointyhat to:	bdrewery
2015-10-29 00:41:03 +00:00
Bryan Drewery
523e46d486 Use proper CONFDIR after r289148 2015-10-27 23:49:32 +00:00
Bryan Drewery
222c700312 Spell CONFGROUPS properly. 2015-10-27 02:04:21 +00:00
Bryan Drewery
99330d7a24 META MODE: Fix after addition of bsd.confs.mk: Stage in "files" set.
The "files" staging name is not the same as "bsd.files.mk" but seems to just be
a group of extra files that are not the essential includes or libraries, which
include .

Sponsored by:	EMC / Isilon Storage Division
2015-10-27 01:29:38 +00:00
Bryan Drewery
b0be2b128f META MODE: Fix FILESNAME not being respected sans other FILES_group overrides.
This was fixed in bsd.incs.mk in r242801 already.

Sponsored by:	EMC / Isilon Storage Division
2015-10-26 23:28:35 +00:00
Bryan Drewery
7847b2337e META MODE: bsd.files.mk and bsd.confs.mk don't handle symlinks so there is no
need to set STAGE_SYMLINKS_DIR.${STAGE_SET}.

Sponsored by:	EMC / Isilon Storage Division
2015-10-26 22:31:57 +00:00
Bryan Drewery
8870ad3609 Sort properly.
MFC after:	1 week
X-MFC-With:	r289870
2015-10-24 05:00:20 +00:00
Bryan Drewery
ce3c9a36c5 Add bsd.crunchgen.mk to bsd.README.
MFC after:	1 week
2015-10-24 04:55:17 +00:00
Bryan Drewery
8758abd5b3 Slightly rework the comments and logic for default Clang/GCC.
This is because the previous version was very obscure about the fact
that despite having Clang "on by default" for architectures such as powerpc, it
does not actually build due to the GCC it uses not having C++11 support.
Using an external compiler that supports C++11 does allow this to work.
This whole block should be rethought more given "on by default" is not
really default without extra work which could actually be surprising for
why Clang is showing up when using a newer GCC.

Sponsored by:	EMC / Isilon Storage Division
2015-10-24 04:03:32 +00:00
Bryan Drewery
de606f83e0 Configs should not be under MK_INCLUDES control.
'buildconfig' is connected to 'all', but 'installconfig' is only called
manually.  There is not much need to conditionalize this file right
now due to how it is hooked up and its impact on various build phases.

Sponsored by:	EMC / Isilon Storage Division
2015-10-24 04:03:29 +00:00
Bryan Drewery
ccfb12d63a Rework r289778 to always parallelize known targets, without ordering.
- Rather than allow 'make clean*' to ignore dependencies, make a static
  list of targets in STANDALONE_SUBDIR_TARGETS that are known to be safe.
  This allows a user to override them if needed and avoids adding this feature
  to user-defined targets that are in ${SUBDIR_TARGETS}. [1]
- This now also allows to force SUBDIR_PARALLEL when calling these
  targets, since no dependencies are needed.

Reported by:	ian [1]
Sponsored by:	EMC / Isilon Storage Division
MFC after:	3 weeks
X-MFC-With:	r289778
2015-10-23 21:30:27 +00:00
Bryan Drewery
0d2a1539d1 Fix regression from r289734 that caused crunchgen "subdirs" to not be
properly recursed.

The .for loop was defining a ${__dir} variable that was being set at a
different evaluation time than the target itself, so every 'cd ${__dir}'
became the last value that was in ${__dir}.  This resulted in 'make obj'
not properly being ran in the tree that would leave .depend files
scattered around when 'make all' was ran in rescue/.

To fix this, define a CRUNCH_SRCDIR_* for every prog if it does not
already have one and then use that variable in every relevant place.
This allows simplifying some logic as well.

Reported by:	emaste
X-MFC-With:	r289734
MFC after:	3 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-10-23 19:41:58 +00:00
Bryan Drewery
2e35a44ce5 For SUBDIR_PARALLEL, when doing 'make clean*' or 'make obj' there is no need to
respect SUBDIR_DEPEND_* or .WAIT.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-10-22 23:41:56 +00:00
Bryan Drewery
c22afe52f4 Fix installation of manpages with WITHOUT_COMPRESS broken since r284685.
This partially reverts r284685.  An attempt was made in r285295 to fix this
but was not enough.  There were still $${} vars in the code that should have
been using the ${_page} and ${_sect} vars, but the bigger problem was that
.for cannot be used on .ALLSRC as it is not defined when the .for is evaluated.

Using ${MAN} here in a .for loop doesn't work either as the paths are not
expanded right for lib/libc/ subdirs despite having a .PATH set for all
of them.

Add some comments around long .else and .endif as well.

Sponsored by:	EMC / Isilon Storage Division
2015-10-22 22:29:25 +00:00
Bryan Drewery
cc104c812d Fix incorrect defined() usage from style clean up in r289735.
Submitted by:	ngie
MFC after:	2 weeks
X-MFC-With:	r289735
Sponsored by:	EMC / Isilon Storage Division
2015-10-22 04:52:37 +00:00
Bryan Drewery
d4f564c588 Fix style. Namely use {} rather than ().
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-10-22 04:47:52 +00:00
Bryan Drewery
5583e49be6 Rewrite crunchgen target handling for progs so that it can be parallelized.
This covers 'clean', 'cleandepend', 'cleandir', 'obj', 'objlink' and
'build-tools'.

This uses the same method as bsd.subdir.mk.

MFC after:	2 weeks
X-MFC-With:	r289731
Sponsored by:	EMC / Isilon Storage Division
2015-10-22 04:42:17 +00:00
Bryan Drewery
01d591d45b Clean up some bsd.crunchgen.mk issues.
- Remove handling of 'make -P' since that is for fmake only.
- Add '+' where appropriate for sub-make calls.
- Pass MK_TESTS=no to all of the sub-makes to prevent recursing into test
  directories for targets such as 'obj', 'clean', 'depend', etc.

Sponsored by:	EMC / Isilon Storage Division
2015-10-22 04:28:22 +00:00
Bryan Drewery
7f5f4b449d Remove indirection of _sub target for using _SUBDIR.
This reverts r266473 as the need for it, working around .MAKE and '+'
issues, is no longer needed after r289460.  This avoids extra log
output in -j builds of '-- _sub.TARGET --' that are redundant with the
'-- TARGET --' and '-- TARGET_subdir_DIR --' entries already showing.

r266473 also made a subtle change in the ordering of _SUBDIR handling.  Before
the change, SUBDIRS were recursed into after building the TARGET due to the
.USE of _SUBDIR *appending* the commands onto the TARGET.  After the change
though the indirection caused TARGET to depend on _sub.TARGET which had the
_SUBDIR handling in it.  This TARGET would run after recursing.  However, the
SUBDIR_PARALLEL handling from r263778 has this ordering as well.  Since
this has so far not been a problem, for now make this behavior for
non-SUBDIR_PARALLEL use of _SUBDIR explicit by using .USEBEFORE.
Further research may change this back to .USE as well as the
SUBDIR_PARALLEL handling and bsd.progs.mk recursing.

Sponsored by:	EMC / Isilon Storage Division
2015-10-21 16:24:44 +00:00
Bryan Drewery
5d6be39a4b Fix building in a directory with SUBDIRs and SUBDIR_PARALLEL.
The SUBDIR_PARALLEL feature uses a .for dir in ${SUBDIR} loop.  The old code
here for recursing was setting SUBDIR= as a make *argument*.  The SUBDIR=
replacement was not actually handled until after the .for loop was unrolled.
This could be seen with a '.info ${SUBDIR} ${dir}' inside of the loop which
showed an empty ${SUBDIR} and a set ${dir}.  Setting NO_SUBIDR= before calling
${MAKE} as an *environment* variable handles the case fine and is a more
proper mechanism for disabling subdir handling.

This could be seen with 'make -C tests/sys/kern -j15 SUBDIR_PARALLEL=yes'.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-10-21 00:25:18 +00:00
Bryan Drewery
13569c0ae5 Improve safety of caching from r289659 by only importing of none of the
variables are already set.  This should cover odd cases such as the
COMPILER_TYPE override in lib/csu/powerpc64.

X-MFC-With:	r289659
MFC after:	3 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-10-20 20:37:00 +00:00
Bryan Drewery
16a5c008cc Pass COMPILER_TYPE and COMPILER_VERSION to sub-makes to avoid redundant
lookups.

This uses a special variable name based on a hash of ${CC}, ${PATH}, and
${MACHINE} to ensure that a cached value is not used if any of these
values changes to use a new compiler.

Before this there were 34,620 fork/exec from bsd.compiler.mk during a buildworld.
After this there are 608.  More improvement is needed to cache a value from
the top-level before descending into subdirs in the various build phases.

Reviewed by:	brooks (earlier version)
MFC after:	3 weeks
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D3898
2015-10-20 20:15:25 +00:00
Bryan Drewery
65d88005ef Replace all of the duplicated logic for recursing into a subdir with one
implementation.  It is duplicated at run-time but is more easily
maintainable now.

Sponsored by:	EMC / Isilon Storage Division
2015-10-19 23:34:35 +00:00
Bryan Drewery
e92818f2e6 Add missing .PHONY for parallel subdir target.
MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2015-10-19 22:27:32 +00:00
Baptiste Daroussin
031c294c1d Merge from head 2015-10-19 11:51:10 +00:00
Enji Cooper
550d2b80ec Make libxo depend on libutil because it uses humanize_number after r287111
Remove overlinking in lib/libxo/tests, sbin/savecore, and
usr.bin/{iscsictl,wc,xo}

PR: 203673
Sponsored by: EMC / Isilon Storage Division
2015-10-18 07:30:50 +00:00
Enji Cooper
a52bef9c99 Only enable -fstack-protector-strong on gcc 4.9+ and default to -fstack-protector
when -fstack-protector-strong is not available, like it was implicitly before
r288669

As noted by antoine@, devel/gcc (which is 4.8.5) lacks -fstack-protector-strong
support, whereas 4.8.4i (devel/gcc48) has the support.

Until a version is available which has -fstack-protector-strong support, be
conservative and only enable support with 4.9+.

Reviewed by: pfg
X-MFC with: r288669, r289465
Differential Revision: https://reviews.freebsd.org/D3924
2015-10-18 04:07:40 +00:00
Enji Cooper
835f328986 Only use -fstack-protector-strong with supported compilers
This includes clang 3.5.0+, gcc 4.2.1, gcc 4.8.4+

This allows me to do subdirectory makes again after setting
MAKESYSPATH on 10.2-RELEASE as it comes with clang 3.4.1.

As a sidenote: this isn't technically correct for all vintages
of gcc 4.2.1, but will be correct when gcc is rebuilt/reinstalled
after r286074, so this version check should be good enough.

X-MFC with: r288669
Differential Revision: https://reviews.freebsd.org/D3924
Reviewed by: emaste, pfg
2015-10-17 19:48:17 +00:00
Bryan Drewery
56585ab576 Rework the 'make -n -n' feature such that '-n' recurses and '-N' does not.
Bmake has a documented feature of '-N' to skip executing commands which is
specifically intended for debugging top-level builds and not recursing into
sub-directories.  This matches the older 'make -n' behavior we added which made
'-n -n' the recursing target and '-n' a non-recursing target.

Removing the '-n -n' feature allows the build to work as documented in
the bmake manpage with '-n' and '-N'.  The older '-n -n' feature was also
not documented anywhere that I could see.

Note that the ${_+_} var is still needed as currently bmake incorrectly
executes '+' commands when '-N' is specified.

The '-n' and '-n -n' features were broken for several reasons prior to this.
r251748 made '_+_' never expand with '-n -n' which resulted in many
sub-directories not being visited until fixed 2 years later in r288391, and
many targets were given .MAKE over the past few years which resulted in
non-sub-make commands, such as rm and ln and mtree, to be executed.

This should also allow removing some indirection hacks in bsd.subdir.mk and
other cases of .USE that have a .MAKE by using '+'.

Sponsored by:	EMC / Isilon Storage Division
Discussed on:	arch@ (mostly silence)
2015-10-17 16:42:54 +00:00
Bryan Drewery
29f297420d Similar to r289355, /usr/tests is within the base system so put the symbols
into /usr/lib/debug.

This covers some missing files:
  /usr/tests/libexec/rtld-elf/.debug
  /usr/tests/libexec/rtld-elf/.debug/libpythagoras.so.0.debug
  /usr/tests/lib/libc/tls/.debug
  /usr/tests/lib/libc/tls/.debug/libh_tls_dynamic.so.1.debug
  /usr/tests/lib/libc/tls/.debug/h_tls_dlopen.so.debug
  /usr/tests/lib/libthr/dlopen/.debug
  /usr/tests/lib/libthr/dlopen/.debug/h_pthread_dlopen.so.1.debug
  /usr/tests/lib/libxo/.debug
  /usr/tests/lib/libxo/.debug/libenc_test.so.debug

Sponsored by:	EMC / Isilon Storage Division
2015-10-16 05:06:43 +00:00
Bryan Drewery
61c20fc782 Make installing to a non-existent directory an error.
Before this, if a file was installed to DESTDIR/some/dir and that directory
was missing due to not having ran 'make distrib-dirs' yet, the file would
be installed as 'some/dir'.  For something like bsd.incs.mk with INCLUDEDIR
being a sub-directory of /usr/include, this could result in all of the headers
being installed to a file rather than getting a directory of them.

Now it will error that the file/directory does not exist rather than hide
the issue.

Another option being discussed is to implement GNU's install -D flag which
would auto create any missing directories.

This is a mitigation of the problem.  The proper order to the build is to
run 'make distrib-dirs' first, but that can be forgotten if building from
a sub-directory after updating the source code to the latest revision.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-10-15 22:49:56 +00:00
Glen Barber
bc7f5841b3 MFH r289372-r289382
Sponsored by:	The FreeBSD Foundation
2015-10-15 19:57:13 +00:00
Bryan Drewery
8251c561bf Fix wrong use of .for; the iteration variable is not used in the loop.
MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2015-10-15 18:55:43 +00:00
Bryan Drewery
dcbf2188c1 Remove excess .else
MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2015-10-15 18:53:26 +00:00
Glen Barber
324fd1ce05 MFH to r289370
Sponsored by:	The FreeBSD Foundation
2015-10-15 17:36:56 +00:00
Ed Maste
692432bb20 /usr/tests is part of the base system (for *.debug files)
Sponsored by:	The FreeBSD Foundation
2015-10-15 02:52:30 +00:00