Wed Nov 4 13:22:15 2020 UTC ()
make(1): rename MAKEFILE_PREFERENCE for consistency

The names of the other special variables are all prefixed with MAKE_.


(rillig)
diff -r1.423 -r1.424 src/usr.bin/make/main.c
diff -r1.184 -r1.185 src/usr.bin/make/make.h

cvs diff -r1.423 -r1.424 src/usr.bin/make/main.c (expand / switch to unified diff)

--- src/usr.bin/make/main.c 2020/11/04 04:49:32 1.423
+++ src/usr.bin/make/main.c 2020/11/04 13:22:15 1.424
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: main.c,v 1.423 2020/11/04 04:49:32 rillig Exp $ */ 1/* $NetBSD: main.c,v 1.424 2020/11/04 13:22:15 rillig Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1988, 1989, 1990, 1993 4 * Copyright (c) 1988, 1989, 1990, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor. 8 * Adam de Boor.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -108,27 +108,27 @@ @@ -108,27 +108,27 @@
108 108
109#include <errno.h> 109#include <errno.h>
110#include <signal.h> 110#include <signal.h>
111#include <stdarg.h> 111#include <stdarg.h>
112#include <time.h> 112#include <time.h>
113 113
114#include "make.h" 114#include "make.h"
115#include "dir.h" 115#include "dir.h"
116#include "job.h" 116#include "job.h"
117#include "pathnames.h" 117#include "pathnames.h"
118#include "trace.h" 118#include "trace.h"
119 119
120/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ 120/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
121MAKE_RCSID("$NetBSD: main.c,v 1.423 2020/11/04 04:49:32 rillig Exp $"); 121MAKE_RCSID("$NetBSD: main.c,v 1.424 2020/11/04 13:22:15 rillig Exp $");
122#if defined(MAKE_NATIVE) && !defined(lint) 122#if defined(MAKE_NATIVE) && !defined(lint)
123__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " 123__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
124 "The Regents of the University of California. " 124 "The Regents of the University of California. "
125 "All rights reserved."); 125 "All rights reserved.");
126#endif 126#endif
127 127
128#ifndef DEFMAXLOCAL 128#ifndef DEFMAXLOCAL
129#define DEFMAXLOCAL DEFMAXJOBS 129#define DEFMAXLOCAL DEFMAXJOBS
130#endif 130#endif
131 131
132CmdOpts opts; 132CmdOpts opts;
133time_t now; /* Time at start of make */ 133time_t now; /* Time at start of make */
134GNode *DEFAULT; /* .DEFAULT node */ 134GNode *DEFAULT; /* .DEFAULT node */
@@ -1262,27 +1262,27 @@ InitVpath(void) @@ -1262,27 +1262,27 @@ InitVpath(void)
1262static void 1262static void
1263ReadMakefiles(void) 1263ReadMakefiles(void)
1264{ 1264{
1265 if (opts.makefiles->first != NULL) { 1265 if (opts.makefiles->first != NULL) {
1266 StringListNode *ln; 1266 StringListNode *ln;
1267 1267
1268 for (ln = opts.makefiles->first; ln != NULL; ln = ln->next) { 1268 for (ln = opts.makefiles->first; ln != NULL; ln = ln->next) {
1269 if (ReadMakefile(ln->datum) != 0) 1269 if (ReadMakefile(ln->datum) != 0)
1270 Fatal("%s: cannot open %s.", 1270 Fatal("%s: cannot open %s.",
1271 progname, (char *)ln->datum); 1271 progname, (char *)ln->datum);
1272 } 1272 }
1273 } else { 1273 } else {
1274 char *p1; 1274 char *p1;
1275 (void)Var_Subst("${" MAKEFILE_PREFERENCE "}", 1275 (void)Var_Subst("${" MAKE_MAKEFILE_PREFERENCE "}",
1276 VAR_CMDLINE, VARE_WANTRES, &p1); 1276 VAR_CMDLINE, VARE_WANTRES, &p1);
1277 /* TODO: handle errors */ 1277 /* TODO: handle errors */
1278 (void)str2Lst_Append(opts.makefiles, p1, NULL); 1278 (void)str2Lst_Append(opts.makefiles, p1, NULL);
1279 (void)Lst_ForEachUntil(opts.makefiles, 1279 (void)Lst_ForEachUntil(opts.makefiles,
1280 ReadMakefileSucceeded, NULL); 1280 ReadMakefileSucceeded, NULL);
1281 free(p1); 1281 free(p1);
1282 } 1282 }
1283} 1283}
1284 1284
1285static void 1285static void
1286CleanUp(void) 1286CleanUp(void)
1287{ 1287{
1288#ifdef CLEANUP 1288#ifdef CLEANUP
@@ -1385,27 +1385,27 @@ main(int argc, char **argv) @@ -1385,27 +1385,27 @@ main(int argc, char **argv)
1385 Var_Set(".MAKE.OS", utsname.sysname, VAR_GLOBAL); 1385 Var_Set(".MAKE.OS", utsname.sysname, VAR_GLOBAL);
1386 Var_Set("MACHINE", machine, VAR_GLOBAL); 1386 Var_Set("MACHINE", machine, VAR_GLOBAL);
1387 Var_Set("MACHINE_ARCH", machine_arch, VAR_GLOBAL); 1387 Var_Set("MACHINE_ARCH", machine_arch, VAR_GLOBAL);
1388#ifdef MAKE_VERSION 1388#ifdef MAKE_VERSION
1389 Var_Set("MAKE_VERSION", MAKE_VERSION, VAR_GLOBAL); 1389 Var_Set("MAKE_VERSION", MAKE_VERSION, VAR_GLOBAL);
1390#endif 1390#endif
1391 Var_Set(".newline", "\n", VAR_GLOBAL); /* handy for :@ loops */ 1391 Var_Set(".newline", "\n", VAR_GLOBAL); /* handy for :@ loops */
1392 /* 1392 /*
1393 * This is the traditional preference for makefiles. 1393 * This is the traditional preference for makefiles.
1394 */ 1394 */
1395#ifndef MAKEFILE_PREFERENCE_LIST 1395#ifndef MAKEFILE_PREFERENCE_LIST
1396# define MAKEFILE_PREFERENCE_LIST "makefile Makefile" 1396# define MAKEFILE_PREFERENCE_LIST "makefile Makefile"
1397#endif 1397#endif
1398 Var_Set(MAKEFILE_PREFERENCE, MAKEFILE_PREFERENCE_LIST, 1398 Var_Set(MAKE_MAKEFILE_PREFERENCE, MAKEFILE_PREFERENCE_LIST,
1399 VAR_GLOBAL); 1399 VAR_GLOBAL);
1400 Var_Set(MAKE_DEPENDFILE, ".depend", VAR_GLOBAL); 1400 Var_Set(MAKE_DEPENDFILE, ".depend", VAR_GLOBAL);
1401 1401
1402 CmdOpts_Init(); 1402 CmdOpts_Init();
1403 allPrecious = FALSE; /* Remove targets when interrupted */ 1403 allPrecious = FALSE; /* Remove targets when interrupted */
1404 deleteOnError = FALSE; /* Historical default behavior */ 1404 deleteOnError = FALSE; /* Historical default behavior */
1405 jobsRunning = FALSE; 1405 jobsRunning = FALSE;
1406 1406
1407 maxJobTokens = opts.maxJobs; 1407 maxJobTokens = opts.maxJobs;
1408 ignorePWD = FALSE; 1408 ignorePWD = FALSE;
1409 1409
1410 /* 1410 /*
1411 * Initialize the parsing, directory and variable modules to prepare 1411 * Initialize the parsing, directory and variable modules to prepare

cvs diff -r1.184 -r1.185 src/usr.bin/make/make.h (expand / switch to unified diff)

--- src/usr.bin/make/make.h 2020/11/04 13:04:56 1.184
+++ src/usr.bin/make/make.h 2020/11/04 13:22:15 1.185
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: make.h,v 1.184 2020/11/04 13:04:56 rillig Exp $ */ 1/* $NetBSD: make.h,v 1.185 2020/11/04 13:22:15 rillig Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1988, 1989, 1990, 1993 4 * Copyright (c) 1988, 1989, 1990, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor. 8 * Adam de Boor.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -465,27 +465,27 @@ extern int makelevel; @@ -465,27 +465,27 @@ extern int makelevel;
465/* 465/*
466 * We cannot vfork() in a child of vfork(). 466 * We cannot vfork() in a child of vfork().
467 * Most systems do not enforce this but some do. 467 * Most systems do not enforce this but some do.
468 */ 468 */
469#define vFork() ((getpid() == myPid) ? vfork() : fork()) 469#define vFork() ((getpid() == myPid) ? vfork() : fork())
470extern pid_t myPid; 470extern pid_t myPid;
471 471
472#define MAKEFLAGS ".MAKEFLAGS" 472#define MAKEFLAGS ".MAKEFLAGS"
473#define MAKEOVERRIDES ".MAKEOVERRIDES" 473#define MAKEOVERRIDES ".MAKEOVERRIDES"
474#define MAKE_JOB_PREFIX ".MAKE.JOB.PREFIX" /* prefix for job target output */ 474#define MAKE_JOB_PREFIX ".MAKE.JOB.PREFIX" /* prefix for job target output */
475#define MAKE_EXPORTED ".MAKE.EXPORTED" /* variables we export */ 475#define MAKE_EXPORTED ".MAKE.EXPORTED" /* variables we export */
476#define MAKE_MAKEFILES ".MAKE.MAKEFILES" /* all makefiles already loaded */ 476#define MAKE_MAKEFILES ".MAKE.MAKEFILES" /* all makefiles already loaded */
477#define MAKE_LEVEL ".MAKE.LEVEL" /* recursion level */ 477#define MAKE_LEVEL ".MAKE.LEVEL" /* recursion level */
478#define MAKEFILE_PREFERENCE ".MAKE.MAKEFILE_PREFERENCE" 478#define MAKE_MAKEFILE_PREFERENCE ".MAKE.MAKEFILE_PREFERENCE"
479#define MAKE_DEPENDFILE ".MAKE.DEPENDFILE" /* .depend */ 479#define MAKE_DEPENDFILE ".MAKE.DEPENDFILE" /* .depend */
480#define MAKE_MODE ".MAKE.MODE" 480#define MAKE_MODE ".MAKE.MODE"
481#ifndef MAKE_LEVEL_ENV 481#ifndef MAKE_LEVEL_ENV
482# define MAKE_LEVEL_ENV "MAKELEVEL" 482# define MAKE_LEVEL_ENV "MAKELEVEL"
483#endif 483#endif
484 484
485typedef enum DebugFlags { 485typedef enum DebugFlags {
486 DEBUG_ARCH = 1 << 0, 486 DEBUG_ARCH = 1 << 0,
487 DEBUG_COND = 1 << 1, 487 DEBUG_COND = 1 << 1,
488 DEBUG_DIR = 1 << 2, 488 DEBUG_DIR = 1 << 2,
489 DEBUG_GRAPH1 = 1 << 3, 489 DEBUG_GRAPH1 = 1 << 3,
490 DEBUG_GRAPH2 = 1 << 4, 490 DEBUG_GRAPH2 = 1 << 4,
491 DEBUG_JOB = 1 << 5, 491 DEBUG_JOB = 1 << 5,