diff options
author | Dale S. Rahn <rahnds@cvs.openbsd.org> | 1997-01-31 19:40:43 +0000 |
---|---|---|
committer | Dale S. Rahn <rahnds@cvs.openbsd.org> | 1997-01-31 19:40:43 +0000 |
commit | 16da1118ce7326422ef560e4289a2f37d5f87dd0 (patch) | |
tree | eab5801b2b429485ad46c25959510510b8429566 /distrib/crunch | |
parent | e02b2fc1a17b023d11801a5ae2a9a8e84e3029c0 (diff) |
fix the problem with makefiles in a different way, this steps on the last
commit, but works faster.
Instead of always looking up the makefile and then deciding to
get the objects or not. Cache the makefile name along with the objects.
Diffstat (limited to 'distrib/crunch')
-rw-r--r-- | distrib/crunch/crunchgen/crunchgen.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/distrib/crunch/crunchgen/crunchgen.c b/distrib/crunch/crunchgen/crunchgen.c index c165ad40753..2165d7ae9e1 100644 --- a/distrib/crunch/crunchgen/crunchgen.c +++ b/distrib/crunch/crunchgen/crunchgen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crunchgen.c,v 1.8 1997/01/26 12:57:14 niklas Exp $ */ +/* $OpenBSD: crunchgen.c,v 1.9 1997/01/31 19:40:42 rahnds Exp $ */ /* * Copyright (c) 1994 University of Maryland * All Rights Reserved. @@ -405,6 +405,11 @@ void add_special(int argc, char **argv) if((p->srcdir = strdup(argv[3])) == NULL) out_of_memory(); } + else if(!strcmp(argv[2], "mf_name")) { + if(argc != 4) goto argcount; + if((p->mf_name = strdup(argv[3])) == NULL) + out_of_memory(); + } else if(!strcmp(argv[2], "objdir")) { if(argc != 4) goto argcount; if((p->objdir = strdup(argv[3])) == NULL) @@ -519,17 +524,14 @@ void fillin_program(prog_t *p) } } - /* - * We have a sourcedir try to find a makefile and get objs from it, - * unless we already have objs cached. - */ - if (p->srcdir) { + /* We have a sourcedir and no explict objs, try */ + /* to find makefile and get objs from it. */ + if (p->srcdir && !p->objs) { for (i = 0; mf_name[i] != NULL; i++) { sprintf(path, "%s/%s", p->srcdir, mf_name[i]); if (is_nonempty_file(path)) { p->mf_name = mf_name[i]; - if (!p->objs) - fillin_program_objs(p, path); + fillin_program_objs(p, path); break; } } @@ -653,6 +655,8 @@ void gen_specials_cache(void) fprintf(cachef, "\n"); if(p->srcdir) fprintf(cachef, "special %s srcdir %s\n", p->name, p->srcdir); + if(p->mf_name) + fprintf(cachef, "special %s mf_name %s\n", p->name, p->mf_name); if(p->objdir) fprintf(cachef, "special %s objdir %s\n", p->name, p->objdir); if(p->objs) { |