summaryrefslogtreecommitdiffstats
path: root/usr.sbin/crunch/crunchgen
diff options
context:
space:
mode:
authorjoe <joe@FreeBSD.org>2000-11-03 15:48:58 +0000
committerjoe <joe@FreeBSD.org>2000-11-03 15:48:58 +0000
commit78809b1a0ac60c27d22ffe7f842a92896118bfd3 (patch)
tree9a7e92d369c3a8fdf8310f8e73a4c3fd92aba240 /usr.sbin/crunch/crunchgen
parenta39072b06dbbedcedf43501eb8cafd7287850ec3 (diff)
downloadFreeBSD-src-78809b1a0ac60c27d22ffe7f842a92896118bfd3.zip
FreeBSD-src-78809b1a0ac60c27d22ffe7f842a92896118bfd3.tar.gz
Cause prog_make targets to include a ``make obj'' rule if the -o flag
is given to crunchgen. [ This fixes the previous commit which silently added ``make obj'' ]
Diffstat (limited to 'usr.sbin/crunch/crunchgen')
-rw-r--r--usr.sbin/crunch/crunchgen/crunchgen.14
-rw-r--r--usr.sbin/crunch/crunchgen/crunchgen.c15
2 files changed, 13 insertions, 6 deletions
diff --git a/usr.sbin/crunch/crunchgen/crunchgen.1 b/usr.sbin/crunch/crunchgen/crunchgen.1
index 825b00a..f0cbe05 100644
--- a/usr.sbin/crunch/crunchgen/crunchgen.1
+++ b/usr.sbin/crunch/crunchgen/crunchgen.1
@@ -32,7 +32,7 @@
.Nd generates build environment for a crunched binary
.Sh SYNOPSIS
.Nm \&crunchgen
-.Op Fl fql
+.Op Fl foql
.Op Fl h Ar makefile-header-name
.Op Fl m Ar makefile-name
.Op Fl c Ar c-file-name
@@ -123,6 +123,8 @@ are annoying to pass through environment variables.
Set output Makefile name to
.Ar makefile-name .
The default name is ``<conf-name>.mk''.
+.It Fl o
+Add ``make obj'' rules to each program make target.
.It Fl q
Quiet operation. Status messages are suppressed.
.El
diff --git a/usr.sbin/crunch/crunchgen/crunchgen.c b/usr.sbin/crunch/crunchgen/crunchgen.c
index ae7b0cb..92f7efc 100644
--- a/usr.sbin/crunch/crunchgen/crunchgen.c
+++ b/usr.sbin/crunch/crunchgen/crunchgen.c
@@ -91,6 +91,7 @@ int goterror = 0;
int verbose, readcache; /* options */
int reading_cache;
+int makeobj = 0; /* add 'make obj' rules to the makefile */
int list_mode;
@@ -118,9 +119,10 @@ int main(int argc, char **argv)
readcache = 1;
*outmkname = *outcfname = *execfname = '\0';
- while((optc = getopt(argc, argv, "lh:m:c:e:fq")) != -1) {
+ while((optc = getopt(argc, argv, "lh:m:c:e:foq")) != -1) {
switch(optc) {
case 'f': readcache = 0; break;
+ case 'o': makeobj = 1; break;
case 'q': verbose = 0; break;
case 'm': strcpy(outmkname, optarg); break;
@@ -175,7 +177,7 @@ int main(int argc, char **argv)
void usage(void)
{
fprintf(stderr, "%s\n%s\n",
- "usage: crunchgen [-fq] [-m <makefile>] [-c <c file>]",
+ "usage: crunchgen [-foq] [-m <makefile>] [-c <c file>]",
" [-e <exec file>] <conffile>");
exit(1);
}
@@ -811,10 +813,13 @@ void prog_makefile_rules(FILE *outmk, prog_t *p)
fprintf(outmk, "%s_OBJS=", p->ident);
output_strlst(outmk, p->objs);
fprintf(outmk, "%s_make:\n", p->ident);
- fprintf(outmk, "\t(cd $(%s_SRCDIR) && make obj && \\\n"
- "\t\tmake $(OPTS) $(%s_OPTS) depend && \\\n"
+ fprintf(outmk, "\t(cd $(%s_SRCDIR) && ", p->ident);
+ if (makeobj)
+ fprintf(outmk, "make obj && ");
+ fprintf(outmk, "\\\n");
+ fprintf(outmk, "\t\tmake $(OPTS) $(%s_OPTS) depend && \\\n"
"\t\tmake $(OPTS) $(%s_OPTS) $(%s_OBJS))\n",
- p->ident, p->ident, p->ident, p->ident);
+ p->ident, p->ident, p->ident);
fprintf(outmk, "%s_clean:\n", p->ident);
fprintf(outmk, "\t(cd $(%s_SRCDIR) && make clean)\n\n", p->ident);
}
OpenPOWER on IntegriCloud