Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Jun 2012 21:56:37 +0000 (UTC)
From:      "David E. O'Brien" <obrien@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r237574 - in head: share/mk usr.sbin/crunch/crunchgen
Message-ID:  <201206252156.q5PLub35097616@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: obrien
Date: Mon Jun 25 21:56:36 2012
New Revision: 237574
URL: http://svn.freebsd.org/changeset/base/237574

Log:
  Ensure crunchen uses the same make binary as the rest of the build.
  
  Submitted by:	Simon Gerraty <sjg@juniper.net>

Modified:
  head/share/mk/bsd.crunchgen.mk
  head/usr.sbin/crunch/crunchgen/crunchgen.c

Modified: head/share/mk/bsd.crunchgen.mk
==============================================================================
--- head/share/mk/bsd.crunchgen.mk	Mon Jun 25 21:51:40 2012	(r237573)
+++ head/share/mk/bsd.crunchgen.mk	Mon Jun 25 21:56:36 2012	(r237574)
@@ -105,7 +105,7 @@ $(CONF): Makefile
 .MAKEFLAGS:= ${.MAKEFLAGS:N-P}
 .ORDER: $(OUTPUTS) objs
 $(OUTPUTS): $(CONF)
-	MAKEOBJDIRPREFIX=${CRUNCHOBJS} crunchgen -fq -m $(OUTMK) \
+	MAKE=${MAKE} MAKEOBJDIRPREFIX=${CRUNCHOBJS} crunchgen -fq -m $(OUTMK) \
 	    -c $(OUTC) $(CONF)
 
 $(PROG): $(OUTPUTS) objs

Modified: head/usr.sbin/crunch/crunchgen/crunchgen.c
==============================================================================
--- head/usr.sbin/crunch/crunchgen/crunchgen.c	Mon Jun 25 21:51:40 2012	(r237573)
+++ head/usr.sbin/crunch/crunchgen/crunchgen.c	Mon Jun 25 21:56:36 2012	(r237574)
@@ -92,6 +92,7 @@ char outmkname[MAXPATHLEN], outcfname[MA
 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
 	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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206252156.q5PLub35097616>