Commit Graph

2241 Commits

Author SHA1 Message Date
Baptiste Daroussin
f98f68bd50 Use existing CONFDIR instead of adding a new CONFIGDIR
Reported by:	jbeich
2015-10-11 19:25:39 +00:00
Baptiste Daroussin
2c9976e37e Install bsd.confs.mk
Rename ETCDIR into CONFIGDIR to avoid conflicts with the ports tree
2015-10-10 10:48:09 +00:00
Baptiste Daroussin
c8cbf0d5ea Install configuration files with CONFMODE instead of SHAREMODE 2015-10-09 22:15:31 +00:00
Baptiste Daroussin
9b4f4918ca Add a new bsd.confs.mk similar to bsd.files.mk or bsd.incs.mk
It defines a CONFS variable for all files supposed to be installed as a
configuration file and handle as such
2015-10-09 21:57:42 +00:00
Simon J. Gerraty
f76824ed31 To help bootstrap new local depends,
if SRCS contains *.h for which there are targets,
make buildfiles depend on them - so they get generated early.
2015-10-07 00:32:33 +00:00
Simon J. Gerraty
857b8cc71d Do not assume host toolchain supports sysroot 2015-10-07 00:28:24 +00:00
Simon J. Gerraty
eef72759b5 In jobs mode we can use .ORDER to force stage_links to run after other
stage_* targets.
In non-jobs mode we can achieve the same result by simply introducing
the targets in the correct order.
Thus in bsd*.mk we simply add targets to STAGE_TARGETS which we
realize in meta.stage.mk

Reviewed by: bdrewery
2015-10-07 00:24:27 +00:00
Dimitry Andric
88750be440 Merge ^/head r288836 through r288925. 2015-10-06 16:25:13 +00:00
Warner Losh
b946bedd09 Previous versions of bsd.own.mk included bsd.compiler.mk
only when _WITHOUT_SRCCONF wasn't defined. Restore this
behavior because bsd.ports.mk depends on this in subtle
ways. The compat include of bsd.compiler.mk should
be removed in 12 anyway.

PR:	203540
2015-10-06 04:18:48 +00:00
Dimitry Andric
c710e87b3b Merge ^/head r288457 through r288830. 2015-10-05 17:54:54 +00:00
Pedro F. Giffuni
c621a626db Bump the stack protector to level "strong".
The general stack protector is known to be weak and has pretty small
coverage. While setting stack-protector-all would give better protection
it would come with a performance cost: for this reason Google's Chrome OS
team developed a new stack-protector-strong variant.

In addition to the protections offered by -fstack-protector, the new option
will guard any function that declares any type or length of local array,
even those in structs or unions. It will also protect functions that use a
local variable's address in a function argument or on the right-hand side
of an assignment.

The option was introduced in GCC-4.9, but support for it has been
back-ported to our base GCC (r286074) and is also available in clang.

The change was tested with dbench and doesn't introduce performance
regressions. An exp-run over the ports tree revealed no failures when
using the stricter stack-protector-all. Thanks to all testers involved.

Reference:
https://outflux.net/blog/archives/2014/01/27/fstack-protector-strong/

Tested by:	pho, portmgr (antoine)
Discussed with:	secteam (delphij)

Differential Revision: https://reviews.freebsd.org/D3463
PR:		203394 (exp-run)

Relnotes:	yes
MFC:		no (not supported in older clang)
2015-10-04 18:54:02 +00:00
Bryan Drewery
1b6f33d9ac META_MODE: Fix stage_links not running in the right order without -j.
This fixes staging errors for non-parallel builds that have LINKS.

Creating hardlinks must always happen after the actual files are installed.
The staging code was protected by an .ORDER statement that only affected
parallel -j builds but not non-parallel builds.  Fix this by making the
real stage_links.SET (stage_links.links, stage_links.mlinks, etc) targets
depend on the main targets for all of the other possible staging needs.  For
example, stage_links.links will depend on stage_as and stage_files, which have
their own dependencies to stage_as.prog or stage_files.prog or stage_files.SET,
which is enough to satistfy the ordering.

Also remove the requirement that symlinks be created last, as they can
safely be made without the source being present unlike hardlinks.  This also
fixes symlinks to come before hardlinks as it is possible, in theory, to
hardlink a symlink.  This is not actually supported here though.

Sponsored by:	EMC / Isilon Storage Division
2015-10-02 06:24:09 +00:00
Dimitry Andric
65dcb5bcb1 Merge ^/head r288197 through r288456. 2015-10-01 19:02:45 +00:00
Bryan Drewery
5c5948ac30 META_MODE: Set HOST_CXX and HOST_CPP and chain them down into CXX/CPP for host builds.
Sponsored by:	EMC / Isilon Storage Division
2015-09-30 23:14:23 +00:00
Bryan Drewery
a0a7796dc0 META_MODE: Remove unneeded groff/tmac special GENDIRDEPS_FILTER.
This is converting the path usr/share/tmac.*stage to something else, but
nothing ever installs or reads from such a path.  They might look in
stage.*usr/share/tmac, but that's not what this is matching.  Additionally
the .dirdeps match all of the tmac files back to gnu/usr.bin/groff/tmac
fine.

Sponsored by:	EMC / Isilon Storage Division
2015-09-30 20:40:51 +00:00
Bryan Drewery
e56a42ab8c Remove 'set -e' that are no longer needed as it is already default.
When bmake was initially imported at r241298 shell commands were no longer
ran with 'set -e' as they were before.  This was fixed in r254980 so they
again always use 'set -e'.

Sponsored by:	EMC / Isilon Storage Division
2015-09-25 23:03:32 +00:00
Bryan Drewery
c41b621878 Explicitly enable .MAKE.ALWAYS_PASS_JOB_QUEUE for bmake.
This is a NOP as r254419 enabled this by default in bmake.  Add it here though
to ensure it is known that we are using this as a default and in case a
bmake import removes the default we have.

This tells bmake to always pass job tokens into sub-commands.  Otherwise
it would only do so if the target being built depended on the special
.MAKE target (which causes _all_ commands to be executed with -n as well)
or if the command matches '${MAKE}/${.MAKE}/$(MAKE)/$(.MAKE)/make' (before
expansion, so ${LIB32WMAKE} would not qualify).  Using '+' on a command
(which runs the command with -n) would not pass the job token even though it
is a documented way to achieve the .MAKE effect on a command.

Sponsored by:	EMC / Isilon Storage Division
2015-09-25 22:51:30 +00:00
Bryan Drewery
14bb2c3003 The bsd.progs.mk -> bsd.prog.mk rework did not pan out yet.
It may still in the future but for now unmark this deprecated.  bsd.progs.mk
is less bad after r288158.
2015-09-25 16:27:11 +00:00
Bryan Drewery
66788feea0 PROGS: Let the parent run the children in parallel.
This seems to work fine.

MFC after:	3 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-09-25 15:57:00 +00:00
Bryan Drewery
509301d918 META_MODE: Fix staging not respecting _DIR overrides.
This fixes atf-c.h not properly being installed to /usr/include/ (in
the stagedir) via its override of 'INCSDIR_atf-c.h= ${INCLUDEDIR}'.

This fixes building things that depend on atf.

Staging seems to ignore OWN/GRP/MODE settings and needs further exploration.

Sponsored by:	EMC / Isilon Storage Division
2015-09-25 05:15:27 +00:00
Bryan Drewery
e05c9e31e9 Don't recurse with cleanobj.
bsd.obj.mk handles the needs fine.  When an objdir exists it will
just rm -Rf the objdir.  When it does not exist though it will
call 'clean' and 'cleandepend', which properly recurse in bsd.progs.mk.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-09-25 00:07:31 +00:00
Dimitry Andric
98e67009c0 Merge ^/head r288126 through r288196. 2015-09-24 21:48:04 +00:00
Bryan Drewery
a00dbfa82b Fix running make in src directories without a Makefile giving confusing errors.
This fixes the following errors:
  make: don't know how to make bsd.README. Stop
  make: don't know how to make auto.obj.mk. Stop

This is easily seen in sys/dev/*.

The new behavior is now the expected output:
  make: no target to make.

This would happen as MAKESYSPATH (.../share/mk) is auto added to the -I list.
Any directory where make is ran in the src tree that has no local Makefile
would then try executing the target in share/mk/Makefile, which by default
was to build the first entry in FILES.  Of course, because bsd.README and
auto.obj.mk are not in the current directory the error is shown.

This check only works for bmake, but I will still MFC it with an extra
'!defined(.PARSEDIR) ||' guard for stable/10.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-09-24 17:36:18 +00:00
Bryan Drewery
64d6acd5e7 Note that LIBADD is only valid in /usr/src.
Sponsored by:	EMC / Isilon Storage Division
2015-09-24 00:22:48 +00:00
Bryan Drewery
fa3423b9a7 Add very basic LIBADD documentation.
Sponsored by:	EMC / Isilon Storage Division
2015-09-24 00:20:34 +00:00
Bryan Drewery
538c8eea82 Document bsd.progs.mk and add more variables overrides.
BINGRP BINMODE BINOWN LINKS MLINKS PROGNAME.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-09-24 00:17:00 +00:00
Bryan Drewery
ba7a7c1b82 RELDIR is useful without META_MODE. Always define it.
It is the CURDIR without the SRC base location in it.

Sponsored by:	EMC / Isilon Storage Division
2015-09-23 23:30:57 +00:00
Bryan Drewery
abb02fa2f9 Fix most cases of bsd.progs.mk running duplicate or missing commands.
This mostly fixes an interaction with bsd.test.mk with PROGS and SCRIPTS.
This was most notable with 'make clean' and 'make install', which r281055
and r272055 attempted to address but were inadequate.

It also addresses similar issues in bsd.progs.mk when not using bsd.test.mk.

This also fixes cases of NOT running commands in the parent when using
bsd.progs.mk:
  - 'make clean' was not run for the main process for Makefiles which had both
    FILES and SUBDIR but no PROGS or SCRIPTS.  This usually was just a
    leftover Kyuafile.auto.  One such example is usr.bin/bmake/tests/sysmk/t1/2.
  - 'make obj' was not running in the current directory with bsd.test.mk due
    to early inclusion of bsd.subdir.mk.  This was not really a problem due to
    the SUBDIRS using 'mkdir -p' for their objdirs.

There were subtle bugs causing this wrong behavior:
  1. bsd.progs.mk needs to set SCRIPTS to empty when recursing to avoid
     the sub-makes from installing, cleaning or building the SCRIPTS;
     only the parent make should be doing this.  r281055 effectively did
     the same but wasn't enough.
  2. CLEANFILES may contain (especially from *.test.mk) files which only
     the parent should clean, such as from FILES and SCRIPTS.  To resolve
     sub-makes also cleaning these, reset CLEANFILES and CLEANDIRS in the
     children before including bsd.prog.mk.  A tempting alternative would be
     to only handle CLEANFILES in the parent but then the child bsd.prog.mk
     CLEANFILES of per-PROGS wouldn't be setup.
  3. bsd.subdir.mk was included too soon in bsd.test.mk.  It needs to be
     included after bsd.prog.mk as the SCRIPTS logic is short-circuitted if
     'install:' is already defined (which bsd.subdir.mk does).  There is
     actually no need to include bsd.subdir.mk from bsd.test.mk as bsd.prog.mk
     and bsd.obj.mk will do so in the proper order.  The description in r257095
     covers this for FILES and was fixed differently, though changing the
     handling of target(install) in bsd.prog.mk may make sense after more
     research.
  4. bsd.progs.mk had extra logic to handle recursing SCRIPTS if PROGS was
     empty, which isn't its business to be doing.  SCRIPTS is handled fine
     by bsd.prog.mk.  This mostly reverts and reworks the fix in r259209 and
     partially reverts r272055.
  5. bsd.progs.mk has no need to depend 'all:' on SCRIPTS and FILES.  These
     are handled by bsd.prog.mk/bsd.files.mk fine.  This also partially reverts
     r272055.
  6. bsd.progs.mk was not drop-in safe for bsd.prog.mk.  Move the PROGS
     check from r273186 to allow it to be used safely.

Specific tested cases:
  SCRIPTS:no PROGS:no FILES:yes SUBDIR:yes
    usr.bin/bmake/tests/sysmk/t1/2

  SCRIPTS:yes PROGS:no FILES:yes SUBDIR:no
    usr.bin/bmake/tests/sysmk/t1/2/1

  SCRIPTS:yes PROGS:yes FILES:yes SUBDIR:yes
    lib/libthr/tests

  SCRIPTS:yes PROGS:no FILES:yes SUBDIR:no
    usr.bin/yacc/tests
    libexec/atf/atf-sh/tests

A full buildworld/installworld/clean comparison with mtree was also done.
The only relevant difference was the new fixed behavior of removing
Kyuafile.auto from the objdir in 'clean'.

Converting SCRIPTS to be a special case FILES group will make this less
fragile and is being explored.

One known remaining issue is 'cleandepend' removing the tags files for
every recursive call.

Note that the 'make clean' command runs for the CURDIR last, which can make
it appear to run multiple times when cleaning in tests/, but each command is
for a SUBDIR returning up the chain.  This is purely bsd.subdir.mk behavior.

PR:		191055
PR:		191955
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-09-23 23:20:49 +00:00
Bryan Drewery
b8aba4fc19 META_MODE: Fix 2nd build causing everything to rebuild due to changed CC.
In the first build the TOOLSDIR does not exit yet which causes CC to default
to the sys.mk version.  Once a TOOLSDIR is created during the build though,
this logic was changing CC to ${TOOLSDIR}/usr/bin/cc even though that file
did not exist.  Thus CC went from 'cc' to '/usr/bin/cc' which forced a
rebuild of everything while using the same compiler.  Check that TOOLSDIR is
not empty to avoid this.  If there is actually a TOOLSDIR cc then it will be
used and properly rebuild.

Sponsored by:	EMC / Isilon Storage Division
2015-09-23 22:36:01 +00:00
Bryan Drewery
4b23c482f4 META_MODE: Avoid // in meta log for tracked --sysroot files.
Sponsored by:	EMC / Isilon Storage Division
2015-09-23 22:23:59 +00:00
Bryan Drewery
075b136250 META_MODE: Follow-up r287865 and define CCACHE_DIR as realpath'd.
Filemon(4) will record paths as they are seen, not as fully resolved.  make(1)
will take the .MAKE.META.IGNORE_PATHS values and resolve them.  This creates
a discrepancy if CCACHE_DIR is a symlink.  Fix this by ensuring it is
resolved for its actual usage.

Submitted by:	sjg
2015-09-23 21:46:58 +00:00
Bryan Drewery
533fbec505 META_MODE: Follow-up r287879 and have 'make -V .OBJDIR' still invoke auto.obj.mk.
When inspecting this value it is more expected to have it show the
automatically-created directory value rather than CURDIR.

Sponsored by:	EMC / Isilon Storage Division
2015-09-23 20:46:23 +00:00
Dimitry Andric
26e065d02e Merge ^/head r288035 through r288099. 2015-09-22 09:50:11 +00:00
Bryan Drewery
491b296065 bsd.lib.mk: Simplify CLEANFILES handling.
This limits CLEANFILES removal to just bsd.obj.mk now and removes the need
for NOPATH_FILES.

This reverts r96529 which was done due to the command line being too long
for libc.  Since then all architectures now use 256k for ARG_MAX (r170102).
Regardless of that, the libc CLEANFILES is only 72k now.  Others
may be larger but not likely to hit the limit.  If needed, we can improve
the bsd.obj.mk clean: target to split up the list via bmake features.

This also removes some workarounds that are no longer needed.
- a.out removal
- OBJS.tmp, which has not been needed since r117080.
- *.so, which has not been needed since a .so->.So rename in r42450.

This also fixes STATICOBJS and SHLIB_LINK not being in the .NOPATH list.

Sponsored by:	EMC / Isilon Storage Division
2015-09-22 05:05:53 +00:00
Dimitry Andric
ae2d96ab3a Merge ^/head r287878 through r288034. 2015-09-20 20:34:17 +00:00
Bryan Drewery
740e5b178f Fix LIBRARIES_ONLY
It was erroring: make: don't know how to make _manpages. Stop

Sponsored by:	EMC / Isilon Storage Division
MFC after:	1 week
2015-09-18 23:25:43 +00:00
Bryan Drewery
db31773f3e Garbage collect _SHLIBDIRPREFIX leftovers from r284898.
Sponsored by:	EMC / Isilon Storage Division
2015-09-18 22:28:13 +00:00
Bryan Drewery
621ce7a5a6 Avoid /usr/obj// from r287899 2015-09-18 18:57:09 +00:00
Bryan Drewery
7356a03090 Trim space 2015-09-17 21:51:48 +00:00
Bryan Drewery
cc92227428 Add a check to ensure that the env-only mkopts are not set via src.conf.
Sponsored by:	EMC / Isilon Storage Division
2015-09-17 21:49:29 +00:00
Bryan Drewery
da6e996de3 src.conf.5: Make it self-documenting that the mkopts are environment-only.
Sponsored by:	EMC / Isilon Storage Division
2015-09-17 20:33:52 +00:00
Bryan Drewery
232af7950c Include bsd.mkopt.mk after local.sys.env.mk (which includes /etc/src-env.conf).
This will allow setting WITH_META_MODE in that file rather that requiring
it to be set in the environment.

Sponsored by:	EMC / Isilon Storage Division
2015-09-17 17:35:06 +00:00
Bryan Drewery
66e5857b42 Fix makeman creating obj directories due to turning on WITH_AUTO_OBJ.
r284708 addressed this slightly but seems to have put the make(showconfig)
guard in the wrong place.  Rather than guard setting the default obj directory,
guard inclusion of auto.obj.mk.  This avoids creating SRCTOP/obj and
SRCTOP/release/obj when running makeman.

Sponsored by:	EMC / Isilon Storage Division
2015-09-17 16:38:32 +00:00
Bryan Drewery
7a46bc8129 META_MODE: Default OBJROOT to the traditional /usr/src/SRCTOP/.
This avoids easily colliding multiple src trees with the same objects.  Having
multiple checkouts in dir/ dir2/ dir3/ would all use obj/ without any unique
identifier inside of obj/.  This pattern is more likely to be used due
to the non-META_MODE behavior working with it fine.

In environments where ../obj/ is wanted as the obj directory the value of
OBJROOT can be set to ${SRCTOP:H}/obj/ instead via src-env.conf (set by
SRC_ENV_CONF) or environment.  For environment it must be single quoted or
escaped.  This will be more likely for vendors who are building images or using
NFS for builds.  In those cases MAKEOBJDIRPREFIX may already be utilized and
is supported.

Discussed with:	imp
Sponsored by:	EMC / Isilon Storage Division
2015-09-17 04:22:00 +00:00
Bryan Drewery
3c35812126 META_MODE: Allow MAKEOBJDIRPREFIX to work more closely to its traditional behavior.
The preferred way to modify the object directory root is to use OBJROOT.
However, setting OBJROOT to ${MAKEOBJDIRPREFIX}/${SRCTOP}/ effectively behaves
as expected.

The problem with this before was that setting OBJROOT to contain SRCTOP
resulted in a recursive replacement (/usr/obj/usr/obj/usr/src/). Anchoring to
the start of the path for replacing SRCCTOP in CURDIR resolves this by
avoiding replacing SRCTOP when CURDIR is within the OBJDIR.

Sponsored by:	EMC / Isilon Storage Division
2015-09-17 04:01:05 +00:00
Bryan Drewery
63c304b083 META_MODE: Don't define the default MAKEOBJDIR twice. Just expand the default.
Sponsored by:	EMC / Isilon Storage Division
2015-09-17 00:17:32 +00:00
Bryan Drewery
5ac0efdba9 Update META_MODE architectures for universe 2015-09-16 23:59:53 +00:00
Bryan Drewery
8d4b8102d5 META_MODE: Don't create obj directories automatically when running make -V.
Sponsored by:	EMC / Isilon Storage Division
2015-09-16 23:01:16 +00:00
Dimitry Andric
a1cb6af119 Merge ^/head r287680 through r287877. 2015-09-16 22:35:59 +00:00
Bryan Drewery
cf25886e34 META_MODE: Fix OBJROOT ending in two // when it does not yet exist.
This would lead to the 2nd build (after the first with a missing OBJROOT) to
always rebuild everything as the 'command' would have changed due to the path
changing from having // to only /.

Sponsored by:	EMC / Isilon Storage Division
2015-09-16 20:58:43 +00:00