Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/config Output ${ALLFILES}, the list of selected *.[c...



details:   https://anonhg.NetBSD.org/src/rev/3de188d04cea
branches:  trunk
changeset: 340422:3de188d04cea
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Fri Sep 04 05:52:15 2015 +0000

description:
Output ${ALLFILES}, the list of selected *.[csSo] files, sorted in the exact
order config(1) parses "file ..." commands in config(5) files.  Define
${CFILES}, ${SFILES}, and ${OFILES} as subset of ${ALLFILES} selected by
suffix.

diffstat:

 usr.bin/config/mkmakefile.c |  35 ++++++++++++++++++++---------------
 1 files changed, 20 insertions(+), 15 deletions(-)

diffs (99 lines):

diff -r 7050690f32eb -r 3de188d04cea usr.bin/config/mkmakefile.c
--- a/usr.bin/config/mkmakefile.c       Fri Sep 04 05:33:23 2015 +0000
+++ b/usr.bin/config/mkmakefile.c       Fri Sep 04 05:52:15 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mkmakefile.c,v 1.65 2015/09/04 05:13:32 uebayasi Exp $ */
+/*     $NetBSD: mkmakefile.c,v 1.66 2015/09/04 05:52:15 uebayasi Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: mkmakefile.c,v 1.65 2015/09/04 05:13:32 uebayasi Exp $");
+__RCSID("$NetBSD: mkmakefile.c,v 1.66 2015/09/04 05:52:15 uebayasi Exp $");
 
 #include <sys/param.h>
 #include <ctype.h>
@@ -63,9 +63,9 @@
  */
 
 static void emitdefs(FILE *);
-static void emitfiles(FILE *, struct filelist *, int);
+static void emitallfiles(FILE *);
 
-static void emitobjs(FILE *);
+static void emitofiles(FILE *);
 static void emitallkobjs(FILE *);
 static int emitallkobjscb(const char *, void *, void *);
 static void emitattrkobjs(FILE *);
@@ -145,7 +145,7 @@
                        continue;
                }
                if (strcmp(line, "%OBJS\n") == 0)
-                       fn = Mflag ? emitkobjs : emitobjs;
+                       fn = Mflag ? emitkobjs : emitofiles;
                else if (strcmp(line, "%CFILES\n") == 0)
                        fn = emitcfiles;
                else if (strcmp(line, "%SFILES\n") == 0)
@@ -332,10 +332,11 @@
 }
 
 static void
-emitobjs(FILE *fp)
+emitofiles(FILE *fp)
 {
 
-       emitfiles(fp, &allofiles, 'o');
+       emitallfiles(fp);
+       fprintf(fp, "OFILES=\t${ALLFILES:M*.o}\n");
 }
 
 static void
@@ -452,33 +453,37 @@
 emitcfiles(FILE *fp)
 {
 
-       emitfiles(fp, &allcfiles, 'c');
+       emitallfiles(fp);
+       fprintf(fp, "CFILES=\t${ALLFILES:M*.c}\n");
 }
 
 static void
 emitsfiles(FILE *fp)
 {
 
-       emitfiles(fp, &allsfiles, 's');
+       emitallfiles(fp);
+       fprintf(fp, "SFILES=\t${ALLFILES:M*.[sS]}\n");
 }
 
 static void
-emitfiles(FILE *fp, struct filelist *filelist, int suffix)
+emitallfiles(FILE *fp)
 {
        struct files *fi;
+       static int called;
        int found = 0;
 
-       TAILQ_FOREACH(fi, filelist, fi_snext) {
-               if (found++ == 0)
-                       fprintf(fp, "%cFILES= \\\n", toupper(suffix));
+       if (called++ != 0)
+               return;
+       TAILQ_FOREACH(fi, &allfiles, fi_next) {
                if ((fi->fi_flags & FI_SEL) == 0)
                        continue;
+               if (found++ == 0)
+                       fprintf(fp, "ALLFILES= \\\n");
                putc('\t', fp);
                emitfilerel(fp, fi);
                fputs(" \\\n", fp);
        }
-       if (found == 0)
-               fprintf(fp, "#%%%cFILES\n", toupper(suffix));
+       fputc('\n', fp);
 }
 
 /*



Home | Main Index | Thread Index | Old Index