diff options
-rw-r--r-- | distrib/crunch/crunchgen/Makefile | 10 | ||||
-rw-r--r-- | distrib/crunch/crunchgen/crunchgen.c | 33 |
2 files changed, 28 insertions, 15 deletions
diff --git a/distrib/crunch/crunchgen/Makefile b/distrib/crunch/crunchgen/Makefile index 98e5fae82ee..23625f09b60 100644 --- a/distrib/crunch/crunchgen/Makefile +++ b/distrib/crunch/crunchgen/Makefile @@ -1,8 +1,10 @@ +# $OpenBSD: Makefile,v 1.2 1996/09/25 06:40:52 etheisen Exp $ -PROG=crunchgen -SRCS=crunchgen.c crunched_skel.c -CFLAGS+=-g -Wall -CLEANFILES+= crunched_skel.c +PROG= crunchgen +SRCS= crunchgen.c crunched_skel.c +CFLAGS+= -g -Wall +CPPFLAGS+= -DMF_NAMES='"Makefile.bsd-wrapper","Makefile"' +CLEANFILES+= crunched_skel.c crunched_skel.c: crunched_main.c sh ${.CURDIR}/mkskel.sh ${.CURDIR}/crunched_main.c > crunched_skel.c diff --git a/distrib/crunch/crunchgen/crunchgen.c b/distrib/crunch/crunchgen/crunchgen.c index a181fda29d5..40dd7e37a87 100644 --- a/distrib/crunch/crunchgen/crunchgen.c +++ b/distrib/crunch/crunchgen/crunchgen.c @@ -1,3 +1,4 @@ +/* $OpenBSD: crunchgen.c,v 1.4 1996/09/25 06:40:52 etheisen Exp $ */ /* * Copyright (c) 1994 University of Maryland * All Rights Reserved. @@ -45,6 +46,20 @@ #define MAXLINELEN 16384 #define MAXFIELDS 2048 +/* XXX - This should be runtime configurable */ +/* + * We might have more than one makefile + * name on any given platform. Make sure + * default name is last though. + */ +char *mf_name[] = { +#if defined(MF_NAMES) + MF_NAMES, +#else + "Makefile", +#endif + NULL +}; /* internal representation of conf file: */ @@ -59,7 +74,7 @@ typedef struct strlst { typedef struct prog { struct prog *next; - char *name, *ident; + char *name, *ident, *mf_name; char *srcdir, *objdir; strlst_t *objs, *objpaths; strlst_t *links; @@ -477,11 +492,6 @@ void fillin_program(prog_t *p) char *srcparent; strlst_t *s; int i; - char *mf_name[] = { - "Makefile.bsd-wrapper", - "Makefile", - NULL - }; sprintf(line, "filling in parms for %s", p->name); status(line); @@ -508,13 +518,14 @@ void fillin_program(prog_t *p) } } - /* XXX - This should be runtime configurable */ - // We have a sourcedir and no explict objs, try - // to get objs from makefile. + // emt + /* 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 = strdup(mf_name[i]); fillin_program_objs(p, path); break; } @@ -796,8 +807,8 @@ void prog_makefile_rules(FILE *outmk, prog_t *p) fprintf(outmk, "%s_OBJS=", p->ident); output_strlst(outmk, p->objs); fprintf(outmk, "%s_make:\n", p->ident); - fprintf(outmk, "\t(cd $(%s_SRCDIR); make $(%s_OBJS))\n\n", - p->ident, p->ident); + fprintf(outmk, "\t(cd $(%s_SRCDIR); make -f %s $(%s_OBJS))\n\n", + p->ident, p->mf_name, p->ident); } else fprintf(outmk, "%s_make:\n\t@echo \"** cannot make objs for %s\"\n\n", |