Date: Thu, 10 Jan 2002 18:28:14 -0800 (PST) From: Sam Leffler <sam@errno.com> To: freebsd-gnats-submit@FreeBSD.org Subject: misc/33778: crunchgen enhancements Message-ID: <200201110228.g0B2SEr89565@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 33778
>Category: misc
>Synopsis: crunchgen enhancements
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Thu Jan 10 18:30:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Sam Leffler
>Release: 4.5-PRERELEASE
>Organization:
>Environment:
>Description:
crunchgen is hard to use for certain programs because you can't specify per-prog libraries to link into the .lo. An example is dhcpd in ISC DHCP v3.0.1r4. Included is a change to crunchgen.c that implements
special <prog> lib <pathname>
Also included is a "hack" to permit passing make variables through to the generated .mk file. This lets you, for example, specify common pathnames in one place.
>How-To-Repeat:
>Fix:
cut&paste will ruin this diff so you'll probably want to ask me to send it by mail.
RCS file: /usr/ncvs/src/usr.sbin/crunch/crunchgen/crunchgen.c,v
retrieving revision 1.12.2.9
diff -r1.12.2.9 crunchgen.c
75a76
> strlst_t *libs;
85a87
> strlst_t *vars = NULL;
241a244
> void add_var(int argc, char **argv);
295a299,300
> else if(!strcmp(fieldv[0], "var"))
> f = add_var;
411a417
> p2->libs = NULL;
457a464,472
> void add_var(int argc, char **argv)
> {
> int i;
>
> for (i = 1; i < argc; i++)
> add_string(&vars, argv[i]);
> }
>
>
508a524,526
> } else if (!strcmp(argv[2], "lib")) {
> for (i = 3; i < argc; i++)
> add_string(&p->libs, argv[i]);
580a599
> strlst_t *s;
595c614,620
< snprintf(line, MAXLINELEN, "cd %s && echo -n `/bin/pwd`",
---
> char *cp = line;
> for (s = vars; s != NULL; s = s->next) {
> snprintf(cp, MAXLINELEN - (cp-line), "%s;", s->str);
> cp = strchr(cp, '\0');
> }
> snprintf(cp, MAXLINELEN - (cp-line),
> "cd %s && echo -n `/bin/pwd`",
635c660
< snprintf(path, sizeof(path), "%s/Makefile", p->srcdir);
---
> snprintf(path, sizeof(path), "%s/Makefile", p->realsrcdir);
679a705,706
> for (s = vars; s != NULL; s = s->next)
> fprintf(f, "%s\n", s->str);
916a944,947
> strlst_t *s;
>
> for (s = vars; s != NULL; s = s->next)
> fprintf(outmk, "%s\n", s->str);
1012a1044,1047
> if (p->libs) {
> fprintf(outmk, "%s_LIBS=", p->ident);
> output_strlst(outmk, p->libs);
> }
1019c1054
< fprintf(outmk, "%s.lo: %s_stub.o $(%s_OBJPATHS)\n",
---
> fprintf(outmk, "%s.lo: %s_stub.o $(%s_OBJPATHS)",
1021c1056,1059
< fprintf(outmk, "\tld -dc -r -o %s.lo %s_stub.o $(%s_OBJPATHS)\n",
---
> if (p->libs)
> fprintf(outmk, " $(%s_LIBS)", p->ident);
> fprintf(outmk, "\n");
> fprintf(outmk, "\tld -dc -r -o %s.lo %s_stub.o $(%s_OBJPATHS)",
1022a1061,1063
> if (p->libs)
> fprintf(outmk, " $(%s_LIBS)", p->ident);
> fprintf(outmk, "\n");
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200201110228.g0B2SEr89565>
