aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Drewery <bdrewery@FreeBSD.org>2016-05-26 23:20:36 +0000
committerBryan Drewery <bdrewery@FreeBSD.org>2016-05-26 23:20:36 +0000
commiteb9b07bb777a881bebf027c3f77d8f2dd4026c29 (patch)
treef4cef5e981b122cb9a01b3f4f8fe5632516f8c4a
parentb3d8f6770381d64f959c95305090955a3cbdfcd9 (diff)
downloadsrc-eb9b07bb777a881bebf027c3f77d8f2dd4026c29.tar.gz
src-eb9b07bb777a881bebf027c3f77d8f2dd4026c29.zip
WITH_AUTO_OBJ: Fix crunchgen builds.
Passing MAKEOBJDIRPREFIX to the main prog build (rescue) would confuse WITH_AUTO_OBJ and cause it to create a recursed object directory that then broke the actual prog build. This is normally not a problem since we do not call 'make -f prog.mk obj' before building anything in it. Crunchgen(1) also assumes that if -o is not passed then if an object directory does not already exist then it should build in the source directories. The normal buildworld process will have already ran 'make obj' in each of the component directories so this is not a problem. With WITH_AUTO_OBJ though this is not the case. So we must tell crunchgen(1) that MK_AUTO_OBJ=yes will create the directory and to not require it be present before generating its Makefile. Sponsored by: EMC / Isilon Storage Division
Notes
Notes: svn path=/head/; revision=300806
-rw-r--r--Makefile.inc113
-rw-r--r--share/mk/bsd.crunchgen.mk14
-rw-r--r--sys/sys/param.h2
-rw-r--r--usr.sbin/crunch/crunchgen/crunchgen.c7
4 files changed, 27 insertions, 9 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1
index 2a32e364cf04..f6b4579e9546 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -1570,9 +1570,15 @@ _dd= bin/dd
# r277259 crunchide: Correct 64-bit section header offset
# r281674 crunchide: always include both 32- and 64-bit ELF support
-# r285986 crunchen: use STRIPBIN rather than STRIP
.if ${BOOTSTRAPPING} < 1100078
-_crunch= usr.sbin/crunch
+_crunchide= usr.sbin/crunch/crunchide
+.endif
+
+# r285986 crunchen: use STRIPBIN rather than STRIP
+# 1100113: Support MK_AUTO_OBJ
+.if ${BOOTSTRAPPING} < 1100078 || \
+ (${MK_AUTO_OBJ} == "yes" && ${BOOTSTRAPPING} < 1100114)
+_crunchgen= usr.sbin/crunch/crunchgen
.endif
.if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
@@ -1661,7 +1667,8 @@ bootstrap-tools: .PHONY
usr.bin/xinstall \
${_gensnmptree} \
usr.sbin/config \
- ${_crunch} \
+ ${_crunchide} \
+ ${_crunchgen} \
${_nmtree} \
${_vtfontcvt} \
usr.bin/localedef
diff --git a/share/mk/bsd.crunchgen.mk b/share/mk/bsd.crunchgen.mk
index a0190cf77187..b8085b2f1605 100644
--- a/share/mk/bsd.crunchgen.mk
+++ b/share/mk/bsd.crunchgen.mk
@@ -39,6 +39,10 @@ OUTC= ${PROG}.c
OUTPUTS=${OUTMK} ${OUTC} ${PROG}.cache
CRUNCHOBJS= ${.OBJDIR}
CRUNCH_GENERATE_LINKS?= yes
+# Don't let the prog.mk use MK_AUTO_OBJ, but do let the component builds use
+# it.
+CRUNCHENV+= MK_AUTO_OBJ=no
+CRUNCH_BUILDOPTS+= MK_AUTO_OBJ=${MK_AUTO_OBJ}
CLEANFILES+= ${CONF} *.o *.lo *.c *.mk *.cache *.a *.h
@@ -103,12 +107,13 @@ ${CONF}: Makefile
.endfor
CRUNCHGEN?= crunchgen
-CRUNCHENV?= MK_TESTS=no \
+CRUNCHENV+= MK_TESTS=no \
_RECURSING_CRUNCH=1
.ORDER: ${OUTPUTS} objs
${OUTPUTS:[1]}: .META
${OUTPUTS}: ${CONF}
- MAKE=${MAKE} ${CRUNCHENV} MAKEOBJDIRPREFIX=${CRUNCHOBJS} \
+ MAKE=${MAKE} ${CRUNCHENV:NMK_AUTO_OBJ=*} MAKEOBJDIRPREFIX=${CRUNCHOBJS} \
+ MK_AUTO_OBJ=${MK_AUTO_OBJ} \
${CRUNCHGEN} -fq -m ${OUTMK} -c ${OUTC} ${CONF}
# Avoid redundantly calling 'make objs' which we've done by our
# own dependencies.
@@ -117,13 +122,14 @@ ${OUTPUTS}: ${CONF}
# These 2 targets cannot use .MAKE since they depend on the generated
# ${OUTMK} above.
${PROG}: ${OUTPUTS} objs
- ${CRUNCHENV} MAKEOBJDIRPREFIX=${CRUNCHOBJS} \
+ ${CRUNCHENV} \
CC="${CC} ${CFLAGS} ${LDFLAGS}" \
CXX="${CXX} ${CXXFLAGS} ${LDFLAGS}" \
${MAKE} -f ${OUTMK} exe
objs: ${OUTMK}
- ${CRUNCHENV} MAKEOBJDIRPREFIX=${CRUNCHOBJS} ${MAKE} -f ${OUTMK} objs
+ ${CRUNCHENV} MAKEOBJDIRPREFIX=${CRUNCHOBJS} \
+ ${MAKE} -f ${OUTMK} objs
# <sigh> Someone should replace the bin/csh and bin/sh build-tools with
# shell scripts so we can remove this nonsense.
diff --git a/sys/sys/param.h b/sys/sys/param.h
index bf6d6d328b9a..3ed202885127 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -58,7 +58,7 @@
* in the range 5 to 9.
*/
#undef __FreeBSD_version
-#define __FreeBSD_version 1100113 /* Master, propagated to newvers */
+#define __FreeBSD_version 1100114 /* Master, propagated to newvers */
/*
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
diff --git a/usr.sbin/crunch/crunchgen/crunchgen.c b/usr.sbin/crunch/crunchgen/crunchgen.c
index 8ace15add1f8..7a63c915e8f2 100644
--- a/usr.sbin/crunch/crunchgen/crunchgen.c
+++ b/usr.sbin/crunch/crunchgen/crunchgen.c
@@ -670,8 +670,13 @@ fillin_program(prog_t *p)
* an object directory already exists.
*/
if (!makeobj && !p->objdir && p->srcdir) {
+ char *auto_obj;
+
+ auto_obj = NULL;
snprintf(line, sizeof line, "%s/%s", objprefix, p->realsrcdir);
- if (is_dir(line)) {
+ if (is_dir(line) ||
+ ((auto_obj = getenv("MK_AUTO_OBJ")) != NULL &&
+ strcmp(auto_obj, "yes") == 0)) {
if ((p->objdir = strdup(line)) == NULL)
out_of_memory();
} else