Fix a 4.X -> 5.X upgrade problem: crunchgen used to emit a line 'MAKE=make'

or 'env MAKEOBJDIRPREFIX=... make' depending on the setting of
MAKEOBJDIRPREFIX in the environment. In any case this line kills the
original value of ${MAKE}. When during buildworld a new make is built (as
is the case during the upgrade) this causes a wrong make to be picked up
(the first one in the path). Use the same technique as Makefile.inc1:
create a MAKEENV variable and a CRUNCHMAKE that calls ${MAKE} with that
MAKEENV prefixed. Use CRUNCHMAKE instead of MAKE throughout the generated
makefile. This leaves the original ${MAKE} undisturbed.
This commit is contained in:
Hartmut Brandt 2004-08-09 19:18:19 +00:00
parent 8673599662
commit a8595b6640
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=133399

View file

@ -927,10 +927,10 @@ void top_makefile_rules(FILE *outmk)
if (makeobj) {
fprintf(outmk, "MAKEOBJDIRPREFIX?=%s\n", objprefix);
fprintf(outmk, "MAKE=env MAKEOBJDIRPREFIX=$(MAKEOBJDIRPREFIX) "
"make\n");
fprintf(outmk, "MAKEENV=env MAKEOBJDIRPREFIX=$(MAKEOBJDIRPREFIX)\n");
fprintf(outmk, "CRUNCHMAKE=$(MAKEENV) $(MAKE)\n");
} else {
fprintf(outmk, "MAKE=make\n");
fprintf(outmk, "CRUNCHMAKE=$(MAKE)\n");
}
if (buildopts) {
@ -990,17 +990,17 @@ void prog_makefile_rules(FILE *outmk, prog_t *p)
fprintf(outmk, "%s_make:\n", p->ident);
fprintf(outmk, "\t(cd $(%s_SRCDIR) && ", p->ident);
if (makeobj)
fprintf(outmk, "$(MAKE) obj && ");
fprintf(outmk, "$(CRUNCHMAKE) obj && ");
fprintf(outmk, "\\\n");
fprintf(outmk, "\t\t$(MAKE) $(BUILDOPTS) $(%s_OPTS) depend &&",
fprintf(outmk, "\t\t$(CRUNCHMAKE) $(BUILDOPTS) $(%s_OPTS) depend &&",
p->ident);
fprintf(outmk, "\\\n");
fprintf(outmk, "\t\t$(MAKE) $(BUILDOPTS) $(%s_OPTS) "
fprintf(outmk, "\t\t$(CRUNCHMAKE) $(BUILDOPTS) $(%s_OPTS) "
"$(%s_OBJS))",
p->ident, p->ident);
fprintf(outmk, "\n");
fprintf(outmk, "%s_clean:\n", p->ident);
fprintf(outmk, "\t(cd $(%s_SRCDIR) && $(MAKE) $(BUILDOPTS) clean cleandepend)\n\n",
fprintf(outmk, "\t(cd $(%s_SRCDIR) && $(CRUNCHMAKE) $(BUILDOPTS) clean cleandepend)\n\n",
p->ident);
} else {
fprintf(outmk, "%s_make:\n", p->ident);