From 219bee74c723cd1d4c23798c75899b01115172ef Mon Sep 17 00:00:00 2001 From: rahnds Date: Fri, 31 Jan 1997 19:40:42 +0000 Subject: [PATCH] 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. --- distrib/crunch/crunchgen/crunchgen.c | 20 ++++++++++++-------- 1 file 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) { -- 2.20.1