summaryrefslogtreecommitdiffstats
path: root/usr.sbin/crunch/crunchgen
diff options
context:
space:
mode:
authorjoe <joe@FreeBSD.org>2000-11-15 14:33:29 +0000
committerjoe <joe@FreeBSD.org>2000-11-15 14:33:29 +0000
commit05dff2fbdf1b46796150172e8822953564781c4b (patch)
tree0c70594761dcee7734edac6889a7f783097ed334 /usr.sbin/crunch/crunchgen
parenta70cac6a710bde84c2c7afcd9c3b5fcf817ff902 (diff)
downloadFreeBSD-src-05dff2fbdf1b46796150172e8822953564781c4b.zip
FreeBSD-src-05dff2fbdf1b46796150172e8822953564781c4b.tar.gz
Add and document a new configuration command: buildopts.
This allows global make options to be specified within the crunch configuration file.
Diffstat (limited to 'usr.sbin/crunch/crunchgen')
-rw-r--r--usr.sbin/crunch/crunchgen/crunchgen.14
-rw-r--r--usr.sbin/crunch/crunchgen/crunchgen.c27
2 files changed, 28 insertions, 3 deletions
diff --git a/usr.sbin/crunch/crunchgen/crunchgen.1 b/usr.sbin/crunch/crunchgen/crunchgen.1
index e50002e..3105913 100644
--- a/usr.sbin/crunch/crunchgen/crunchgen.1
+++ b/usr.sbin/crunch/crunchgen/crunchgen.1
@@ -157,6 +157,8 @@ A list of library specifications to be included in the crunched binary link.
Multiple
.Nm libs
lines can be specified.
+.It Nm buildopts Ar buildopts ...
+A list of build options to be added to every make target.
.It Nm ln Ar progname linkname
Causes the crunched binary to invoke
.Ar progname
@@ -192,6 +194,8 @@ itself becomes the
.Ar objdir .
.It Nm special Ar progname Nm buildopts Ar buildopts
Define a set of build options that should be added to make targets
+in addition to those specified using
+.Nm buildopts
when processing
.Ar progname .
.It Nm special Ar progname Nm objs Ar object-file-name ...
diff --git a/usr.sbin/crunch/crunchgen/crunchgen.c b/usr.sbin/crunch/crunchgen/crunchgen.c
index 9566d9f..f51bf7a 100644
--- a/usr.sbin/crunch/crunchgen/crunchgen.c
+++ b/usr.sbin/crunch/crunchgen/crunchgen.c
@@ -77,6 +77,7 @@ typedef struct prog {
/* global state */
+strlst_t *buildopts = NULL;
strlst_t *srcdirs = NULL;
strlst_t *libs = NULL;
prog_t *progs = NULL;
@@ -198,6 +199,7 @@ void add_srcdirs(int argc, char **argv);
void add_progs(int argc, char **argv);
void add_link(int argc, char **argv);
void add_libs(int argc, char **argv);
+void add_buildopts(int argc, char **argv);
void add_special(int argc, char **argv);
prog_t *find_prog(char *str);
@@ -242,6 +244,7 @@ void parse_one_file(char *filename)
else if(!strcmp(fieldv[0], "progs")) f = add_progs;
else if(!strcmp(fieldv[0], "ln")) f = add_link;
else if(!strcmp(fieldv[0], "libs")) f = add_libs;
+ else if(!strcmp(fieldv[0], "buildopts")) f = add_buildopts;
else if(!strcmp(fieldv[0], "special")) f = add_special;
else {
warnx("%s:%d: skipping unknown command `%s'",
@@ -368,6 +371,15 @@ void add_libs(int argc, char **argv)
}
+void add_buildopts(int argc, char **argv)
+{
+ int i;
+
+ for (i = 1; i < argc; i++)
+ add_string(&buildopts, argv[i]);
+}
+
+
void add_special(int argc, char **argv)
{
int i;
@@ -579,12 +591,16 @@ void fillin_program_objs(prog_t *p, char *path)
if (outhdrname[0] != '\0')
fprintf(f, ".include \"%s\"\n", outhdrname);
fprintf(f, ".include \"%s\"\n", path);
+ if (buildopts) {
+ fprintf(f, "BUILDOPTS+=");
+ output_strlst(f, buildopts);
+ }
fprintf(f, ".if defined(PROG) && !defined(%s)\n", objvar);
fprintf(f, "%s=${PROG}.o\n", objvar);
fprintf(f, ".endif\n");
fprintf(f, "loop:\n\t@echo 'OBJS= '${%s}\n", objvar);
- fprintf(f, "crunchgen_objs:\n\t@make -f %s $(OPTS) $(%s_OPTS)",
+ fprintf(f, "crunchgen_objs:\n\t@make -f %s $(BUILDOPTS) $(%s_OPTS)",
tempfname, p->ident);
for (s = p->buildopts; s != NULL; s = s->next)
fprintf(f, " %s", s->str);
@@ -788,6 +804,11 @@ void top_makefile_rules(FILE *outmk)
fprintf(outmk, "LIBS=");
output_strlst(outmk, libs);
+ if (buildopts) {
+ fprintf(outmk, "BUILDOPTS+=");
+ output_strlst(outmk, buildopts);
+ }
+
fprintf(outmk, "CRUNCHED_OBJS=");
for(p = progs; p != NULL; p = p->next)
fprintf(outmk, " %s.lo", p->name);
@@ -834,8 +855,8 @@ void prog_makefile_rules(FILE *outmk, prog_t *p)
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",
+ fprintf(outmk, "\t\tmake $(BUILDOPTS) $(%s_OPTS) depend && \\\n"
+ "\t\tmake $(BUILDOPTS) $(%s_OPTS) $(%s_OBJS))\n",
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