summaryrefslogtreecommitdiffstats
path: root/usr.sbin/crunch
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2012-06-25 21:56:36 +0000
committerobrien <obrien@FreeBSD.org>2012-06-25 21:56:36 +0000
commite7fd66eb8d4fbe22a9c38b44ab97fef129177e46 (patch)
treee357af1a848e9c4e620f67c9dc14247f9118ab57 /usr.sbin/crunch
parent478b5e520236430c6ebf8f7b026cb28fff8edf22 (diff)
downloadFreeBSD-src-e7fd66eb8d4fbe22a9c38b44ab97fef129177e46.zip
FreeBSD-src-e7fd66eb8d4fbe22a9c38b44ab97fef129177e46.tar.gz
Ensure crunchen uses the same make binary as the rest of the build.
Submitted by: Simon Gerraty <sjg@juniper.net>
Diffstat (limited to 'usr.sbin/crunch')
-rw-r--r--usr.sbin/crunch/crunchgen/crunchgen.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/usr.sbin/crunch/crunchgen/crunchgen.c b/usr.sbin/crunch/crunchgen/crunchgen.c
index 752acc6..2440b3e 100644
--- a/usr.sbin/crunch/crunchgen/crunchgen.c
+++ b/usr.sbin/crunch/crunchgen/crunchgen.c
@@ -92,6 +92,7 @@ char outmkname[MAXPATHLEN], outcfname[MAXPATHLEN], execfname[MAXPATHLEN];
char tempfname[MAXPATHLEN], cachename[MAXPATHLEN], curfilename[MAXPATHLEN];
char outhdrname[MAXPATHLEN] ; /* user-supplied header for *.mk */
char *objprefix; /* where are the objects ? */
+char *path_make;
int linenum = -1;
int goterror = 0;
@@ -127,6 +128,10 @@ int main(int argc, char **argv)
readcache = 1;
*outmkname = *outcfname = *execfname = '\0';
+ path_make = getenv("MAKE");
+ if (path_make == NULL || *path_make == '\0')
+ path_make = "make";
+
p = getenv("MAKEOBJDIRPREFIX");
if (p == NULL || *p == '\0')
objprefix = "/usr/obj"; /* default */
@@ -599,7 +604,8 @@ void gen_outputs(void)
gen_output_makefile();
status("");
fprintf(stderr,
- "Run \"make -f %s\" to build crunched binary.\n", outmkname);
+ "Run \"%s -f %s\" to build crunched binary.\n",
+ path_make, outmkname);
}
/*
@@ -720,16 +726,16 @@ void fillin_program_objs(prog_t *p, char *path)
fprintf(f, "loop:\n\t@echo 'OBJS= '${%s}\n", objvar);
fprintf(f, "crunchgen_objs:\n"
- "\t@cd %s && make -f %s $(BUILDOPTS) $(%s_OPTS)",
- p->srcdir, tempfname, p->ident);
+ "\t@cd %s && %s -f %s $(BUILDOPTS) $(%s_OPTS)",
+ p->srcdir, path_make, tempfname, p->ident);
for (s = p->buildopts; s != NULL; s = s->next)
fprintf(f, " %s", s->str);
fprintf(f, " loop\n");
fclose(f);
- snprintf(line, MAXLINELEN, "cd %s && make -f %s -B crunchgen_objs",
- p->srcdir, tempfname);
+ snprintf(line, MAXLINELEN, "cd %s && %s -f %s -B crunchgen_objs",
+ p->srcdir, path_make, tempfname);
if ((f = popen(line, "r")) == NULL) {
warn("submake pipe");
goterror = 1;
OpenPOWER on IntegriCloud