summaryrefslogtreecommitdiff
path: root/distrib
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2006-10-14 20:23:30 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2006-10-14 20:23:30 +0000
commit3842f0be91e5a240697f989f6f2df58b1d3fead5 (patch)
treeda95b9f1dca49614effe2a47b5024dce3c61cd84 /distrib
parent40f6f488ebc1e1650279ad4aa067384549bcffad (diff)
Add a new option to crunchgen '-O objdir-name' which allow for a object
directory other than the previously hardcoded 'obj' to be specified. Allows for cross building of ramdisks (down the road).
Diffstat (limited to 'distrib')
-rw-r--r--distrib/crunch/crunchgen/crunchgen.17
-rw-r--r--distrib/crunch/crunchgen/crunchgen.c16
2 files changed, 17 insertions, 6 deletions
diff --git a/distrib/crunch/crunchgen/crunchgen.1 b/distrib/crunch/crunchgen/crunchgen.1
index a727604f3d5..4f783ad848c 100644
--- a/distrib/crunch/crunchgen/crunchgen.1
+++ b/distrib/crunch/crunchgen/crunchgen.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: crunchgen.1,v 1.18 2005/08/04 05:08:15 jmc Exp $
+.\" $OpenBSD: crunchgen.1,v 1.19 2006/10/14 20:23:29 drahn Exp $
.\"
.\"
.\" Copyright (c) 1994 University of Maryland
@@ -40,6 +40,7 @@
.Op Fl e Ar exec-file-name
.Op Fl L Ar lib-dir
.Op Fl m Ar makefile-name
+.Op Fl O Ar objdir-name
.Ar conf-file
.Ek
.Sh DESCRIPTION
@@ -112,6 +113,10 @@ Set output Makefile name to
.Ar makefile-name .
The default name is
.Dq Ao conf-name Ac Ns \&.mk .
+.It Fl O Ar objdir-name
+Specify an object directory to use, defaults to 'obj' however for cross
+building purposes can be used to specify obj.${HOST}.${MACHINE} normally
+used with the make variable ${MAKEOBJDIR}.
.It Fl q
Quiet operation.
Status messages are suppressed.
diff --git a/distrib/crunch/crunchgen/crunchgen.c b/distrib/crunch/crunchgen/crunchgen.c
index 6cf11b8a058..30c6477e09c 100644
--- a/distrib/crunch/crunchgen/crunchgen.c
+++ b/distrib/crunch/crunchgen/crunchgen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: crunchgen.c,v 1.24 2006/02/06 16:49:31 jmc Exp $ */
+/* $OpenBSD: crunchgen.c,v 1.25 2006/10/14 20:23:29 drahn Exp $ */
/*
* Copyright (c) 1994 University of Maryland
@@ -85,6 +85,7 @@ typedef struct prog {
strlst_t *srcdirs = NULL;
strlst_t *libs = NULL;
strlst_t *libdirs = NULL;
+char objdir[MAXPATHLEN] = "obj";
prog_t *progs = NULL;
char line[MAXLINELEN];
@@ -125,7 +126,7 @@ main(int argc, char *argv[])
if (argc > 0)
progname = argv[0];
- while ((optc = getopt(argc, argv, "m:c:e:fqD:EL:")) != -1) {
+ while ((optc = getopt(argc, argv, "m:c:e:fqD:EL:O:")) != -1) {
switch (optc) {
case 'f':
readcache = 0;
@@ -162,6 +163,11 @@ main(int argc, char *argv[])
usage();
add_string(&libdirs, optarg);
break;
+ case 'O':
+ if (strlcpy(objdir, optarg, sizeof(objdir)) >=
+ sizeof(objdir))
+ usage();
+ break;
default:
usage();
}
@@ -210,7 +216,7 @@ void
usage(void)
{
fprintf(stderr, "%s [-Efq] [-c c-file-name] [-D src-root] [-e exec-file-name]\n"
- "\t[-L lib-dir] [-m makefile-name] conf-file\n",
+ "\t[-L lib-dir] [-m makefile-name] [-O objdir-name ] conf-file\n",
progname);
exit(1);
}
@@ -598,7 +604,7 @@ fillin_program(prog_t * p)
p->srcdir = strdup(path);
}
if (!p->objdir && p->srcdir) {
- snprintf(path, sizeof(path), "%s/obj", p->srcdir);
+ snprintf(path, sizeof(path), "%s/%s", p->srcdir, objdir);
if (is_dir(path))
p->objdir = strdup(path);
else {
@@ -871,7 +877,7 @@ top_makefile_rules(FILE * outmk)
strlst_t *l;
- fprintf(outmk, "STRIP=strip\n");
+ fprintf(outmk, "STRIP?=strip\n");
fprintf(outmk, "LINK=$(LD) -dc -r\n");
fprintf(outmk, "LIBS=");
for (l = libdirs; l != NULL; l = l->next)