Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make Allow "-m" to be used in a .MAKEFLAGS: special ...



details:   https://anonhg.NetBSD.org/src/rev/e35c9149b7f8
branches:  trunk
changeset: 516816:e35c9149b7f8
user:      tv <tv%NetBSD.org@localhost>
date:      Wed Oct 31 01:15:57 2001 +0000

description:
Allow "-m" to be used in a .MAKEFLAGS: special target and get it to work.
(This splits out the "default system include paths" into its own Lst
variable, and uses it only if sysIncPath is empty.  This allows sysIncPath
to be filled in by the Makefile itself.)

diffstat:

 usr.bin/make/main.c  |  51 ++++++++++++++++++++++++++-------------------------
 usr.bin/make/make.h  |   5 +++--
 usr.bin/make/parse.c |  16 ++++++++++------
 3 files changed, 39 insertions(+), 33 deletions(-)

diffs (212 lines):

diff -r d70c73380859 -r e35c9149b7f8 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Wed Oct 31 00:08:03 2001 +0000
+++ b/usr.bin/make/main.c       Wed Oct 31 01:15:57 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.72 2001/09/16 16:34:43 wiz Exp $    */
+/*     $NetBSD: main.c,v 1.73 2001/10/31 01:15:57 tv Exp $     */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -39,7 +39,7 @@
  */
 
 #ifdef MAKE_BOOTSTRAP
-static char rcsid[] = "$NetBSD: main.c,v 1.72 2001/09/16 16:34:43 wiz Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.73 2001/10/31 01:15:57 tv Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
@@ -51,7 +51,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c     8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.72 2001/09/16 16:34:43 wiz Exp $");
+__RCSID("$NetBSD: main.c,v 1.73 2001/10/31 01:15:57 tv Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -771,25 +771,23 @@
         * add the directories from the DEFSYSPATH (more than one may be given
         * as dir1:...:dirn) to the system include path.
         */
-       if (Lst_IsEmpty(sysIncPath)) {
-               if (syspath == NULL || *syspath == '\0')
-                       syspath = defsyspath;
-               else
-                       syspath = strdup(syspath);
-           
-               for (start = syspath; *start != '\0'; start = cp) {
-                       for (cp = start; *cp != '\0' && *cp != ':'; cp++)
-                               continue;
-                       if (*cp == '\0') {
-                               (void) Dir_AddDir(sysIncPath, start);
-                       } else {
-                               *cp++ = '\0';
-                               (void) Dir_AddDir(sysIncPath, start);
-                       }
+       if (syspath == NULL || *syspath == '\0')
+               syspath = defsyspath;
+       else
+               syspath = strdup(syspath);
+
+       for (start = syspath; *start != '\0'; start = cp) {
+               for (cp = start; *cp != '\0' && *cp != ':'; cp++)
+                       continue;
+               if (*cp == '\0') {
+                       (void) Dir_AddDir(defIncPath, start);
+               } else {
+                       *cp++ = '\0';
+                       (void) Dir_AddDir(defIncPath, start);
                }
-               if (syspath != defsyspath)
-                   free(syspath);
        }
+       if (syspath != defsyspath)
+               free(syspath);
 
        /*
         * Read in the built-in rules first, followed by the specified
@@ -800,7 +798,9 @@
                LstNode ln;
 
                sysMkPath = Lst_Init (FALSE);
-               Dir_Expand (_PATH_DEFSYSMK, sysIncPath, sysMkPath);
+               Dir_Expand(_PATH_DEFSYSMK,
+                          Lst_IsEmpty(sysIncPath) ? defIncPath : sysIncPath,
+                          sysMkPath);
                if (Lst_IsEmpty(sysMkPath))
                        Fatal("%s: no system rules (%s).", progname,
                            _PATH_DEFSYSMK);
@@ -832,7 +832,7 @@
            printf("job_pipe %d %d, maxjobs %d maxlocal %d compat %d\n", job_pipe[0], job_pipe[1], maxJobs,
                   maxLocal, compatMake);
 
-       ExportMAKEFLAGS(1);             /* initial export */
+       Main_ExportMAKEFLAGS(TRUE);     /* initial export */
 
        Check_Cwd_av(0, NULL, 0);       /* initialize it */
        
@@ -1003,7 +1003,8 @@
                /* look in -I and system include directories. */
                name = Dir_FindFile(fname, parseIncPath);
                if (!name)
-                       name = Dir_FindFile(fname, sysIncPath);
+                       name = Dir_FindFile(fname,
+                               Lst_IsEmpty(sysIncPath) ? defIncPath : sysIncPath);
                if (!name || !(stream = fopen(name, "r"))) {
                        free(path);
                        return(FALSE);
@@ -1654,8 +1655,8 @@
 }
 
 void
-ExportMAKEFLAGS(first)
-     int first;
+Main_ExportMAKEFLAGS(first)
+     Boolean first;
 {
     static int once = 1;
     char tmp[64];
diff -r d70c73380859 -r e35c9149b7f8 usr.bin/make/make.h
--- a/usr.bin/make/make.h       Wed Oct 31 00:08:03 2001 +0000
+++ b/usr.bin/make/make.h       Wed Oct 31 01:15:57 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.h,v 1.37 2001/09/16 16:34:43 wiz Exp $    */
+/*     $NetBSD: make.h,v 1.38 2001/10/31 01:15:57 tv Exp $     */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -364,6 +364,7 @@
 extern Boolean oldVars;        /* Do old-style variable substitution */
 
 extern Lst     sysIncPath;     /* The system include path. */
+extern Lst     defIncPath;     /* The default include path. */
 
 extern char    *progname;      /* The program name */
 
@@ -415,6 +416,6 @@
 char * Check_Cwd_Cmd __P((char *));
 void Check_Cwd __P((char **));
 void PrintOnError __P((char *));
-void ExportMAKEFLAGS __P((int));
+void Main_ExportMAKEFLAGS __P((Boolean));
 
 #endif /* _MAKE_H_ */
diff -r d70c73380859 -r e35c9149b7f8 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Wed Oct 31 00:08:03 2001 +0000
+++ b/usr.bin/make/parse.c      Wed Oct 31 01:15:57 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.73 2001/09/24 13:22:35 wiz Exp $   */
+/*     $NetBSD: parse.c,v 1.74 2001/10/31 01:15:57 tv Exp $    */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -39,14 +39,14 @@
  */
 
 #ifdef MAKE_BOOTSTRAP
-static char rcsid[] = "$NetBSD: parse.c,v 1.73 2001/09/24 13:22:35 wiz Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.74 2001/10/31 01:15:57 tv Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)parse.c    8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.73 2001/09/24 13:22:35 wiz Exp $");
+__RCSID("$NetBSD: parse.c,v 1.74 2001/10/31 01:15:57 tv Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -151,6 +151,7 @@
                                 * #includes */
 Lst            parseIncPath;   /* list of directories for "..." includes */
 Lst            sysIncPath;     /* list of directories for <...> includes */
+Lst            defIncPath;     /* default directories for <...> includes */
 
 /*-
  * specType contains the SPECial TYPE of the current target. It is
@@ -1587,7 +1588,7 @@
        Var_Set(line, cp, ctxt, 0);
     }
     if (strcmp(line, MAKEOVERRIDES) == 0)
-       ExportMAKEFLAGS(0);             /* re-export MAKEFLAGS */
+       Main_ExportMAKEFLAGS(FALSE);    /* re-export MAKEFLAGS */
 }
 
 
@@ -1816,7 +1817,7 @@
         * Still haven't found the makefile. Look for it on the system
         * path as a last resort.
         */
-       fullname = Dir_FindFile(file, sysIncPath);
+       fullname = Dir_FindFile(file, Lst_IsEmpty(sysIncPath) ? defIncPath : sysIncPath);
     }
 
     if (fullname == (char *) NULL) {
@@ -2046,7 +2047,8 @@
             * Still haven't found the makefile. Look for it on the system
             * path as a last resort.
             */
-           fullname = Dir_FindFile(file, sysIncPath);
+           fullname = Dir_FindFile(file,
+                       Lst_IsEmpty(sysIncPath) ? defIncPath : sysIncPath);
        }
 
        if (fullname == NULL) {
@@ -2748,6 +2750,7 @@
     mainNode = NILGNODE;
     parseIncPath = Lst_Init (FALSE);
     sysIncPath = Lst_Init (FALSE);
+    defIncPath = Lst_Init (FALSE);
     includes = Lst_Init (FALSE);
 #ifdef CLEANUP
     targCmds = Lst_Init (FALSE);
@@ -2761,6 +2764,7 @@
     Lst_Destroy(targCmds, (void (*) __P((ClientData))) free);
     if (targets)
        Lst_Destroy(targets, NOFREE);
+    Lst_Destroy(defIncPath, Dir_Destroy);
     Lst_Destroy(sysIncPath, Dir_Destroy);
     Lst_Destroy(parseIncPath, Dir_Destroy);
     Lst_Destroy(includes, NOFREE);     /* Should be empty now */



Home | Main Index | Thread Index | Old Index