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
This commit is contained in:
parent
b3d8f67703
commit
eb9b07bb77
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user