summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>1999-07-08 06:49:52 +0000
committerPaul Smith <psmith@gnu.org>1999-07-08 06:49:52 +0000
commite1d72ad3f1f9fd9dc72b43b7c618230e0c7d190f (patch)
tree9deed22ea903857c11aac5375cc115f8e073a2b9
parent012254e81e045cc7af01f3ef0d7b63d9d9b9a0d5 (diff)
downloadgunmake-e1d72ad3f1f9fd9dc72b43b7c618230e0c7d190f.tar.gz
* Added -R / --no-builtin-variables flag.
-rw-r--r--ChangeLog11
-rw-r--r--NEWS5
-rw-r--r--default.c3
-rw-r--r--main.c18
-rw-r--r--make.h6
-rw-r--r--make.texinfo16
6 files changed, 49 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 080ea6f..5f93445 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+1999-07-08 Paul D. Smith <psmith@gnu.org>
+
+ * main.c (switches): Define a new switch -R (or
+ --no-builtin-variables). This option disables the defining of all
+ the GNU make builtin variables.
+ (main): If -R was given, force -r as well.
+ * default.c (define_default_variables): Test the new flag.
+ * make.h: Declare global flag.
+ * make.texinfo (Options Summary): Document the new option.
+ (Implicit Variables): Ditto.
+
1999-07-06 Paul D. Smith <psmith@gnu.org>
* make.texinfo (Options Summary): Correct examples in
diff --git a/NEWS b/NEWS
index 897232b..53e1c33 100644
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,11 @@ Version 3.78
* Make allows CRLF sequences as well as traditional LF, for
compatibility with makefiles created on other operating systems.
+* Make accepts a new option: -R, or --no-builtin-variables. This option
+ disables the definition of the rule-specific builtin variables (CC,
+ LD, AR, etc.). Specifying this option forces -r (--no-builtin-rules)
+ as well.
+
* A "job server" feature, proposed by Howard Chu <hyc@highlandsun.com>.
On systems that support POSIX pipe(2) semantics, GNU make can now pass
diff --git a/default.c b/default.c
index 902909f..1681144 100644
--- a/default.c
+++ b/default.c
@@ -509,6 +509,9 @@ define_default_variables ()
{
register char **s;
+ if (no_builtin_variables_flag)
+ return;
+
for (s = default_variables; *s != 0; s += 2)
(void) define_variable (s[0], strlen (s[0]), s[1], o_default, 1);
}
diff --git a/main.c b/main.c
index fc5b335..c315827 100644
--- a/main.c
+++ b/main.c
@@ -27,8 +27,8 @@ MA 02111-1307, USA. */
#include "getopt.h"
#include <assert.h>
#ifdef _AMIGA
-# include <dos/dos.h>
-# include <proto/dos.h>
+# include <dos/dos.h>
+# include <proto/dos.h>
#endif
#ifdef WINDOWS32
#include <windows.h>
@@ -61,9 +61,9 @@ extern void print_vpath_data_base PARAMS ((void));
extern int chdir ();
#endif
#ifndef STDC_HEADERS
-#ifndef sun /* Sun has an incorrect decl in a header. */
+# ifndef sun /* Sun has an incorrect decl in a header. */
extern void exit PARAMS ((int)) __attribute__ ((noreturn));
-#endif
+# endif
extern double atof ();
#endif
extern char *mktemp ();
@@ -163,9 +163,10 @@ int print_data_base_flag = 0;
int question_flag = 0;
-/* Nonzero means do not use any of the builtin rules (-r). */
+/* Nonzero means do not use any of the builtin rules (-r) / variables (-R). */
int no_builtin_rules_flag = 0;
+int no_builtin_variables_flag = 0;
/* Nonzero means keep going even if remaking some file fails (-k). */
@@ -317,6 +318,9 @@ static const struct command_switch switches[] =
{ 'r', flag, (char *) &no_builtin_rules_flag, 1, 1, 0, 0, 0,
"no-builtin-rules", 0,
"Disable the built-in implicit rules" },
+ { 'R', flag, (char *) &no_builtin_variables_flag, 1, 1, 0, 0, 0,
+ "no-builtin-variables", 0,
+ "Disable the built-in variable settings" },
{ 's', flag, (char *) &silent_flag, 1, 1, 0, 0, 0,
"silent", 0,
"Don't echo commands" },
@@ -1065,6 +1069,10 @@ int main (int argc, char ** argv)
if (inhibit_print_directory_flag)
print_directory_flag = 0;
+ /* If -R was given, set -r too (doesn't make sense otherwise!) */
+ if (no_builtin_variables_flag)
+ no_builtin_rules_flag = 1;
+
/* Construct the list of include directories to search. */
construct_include_path (include_directories == 0 ? (char **) 0
diff --git a/make.h b/make.h
index 9123992..e3bd8e3 100644
--- a/make.h
+++ b/make.h
@@ -449,9 +449,9 @@ extern char **environ;
extern int just_print_flag, silent_flag, ignore_errors_flag, keep_going_flag;
extern int debug_flag, print_data_base_flag, question_flag, touch_flag;
-extern int env_overrides, no_builtin_rules_flag, print_version_flag;
-extern int print_directory_flag, warn_undefined_variables_flag;
-extern int posix_pedantic;
+extern int env_overrides, no_builtin_rules_flag, no_builtin_variables_flag;
+extern int print_version_flag, print_directory_flag;
+extern int warn_undefined_variables_flag, posix_pedantic;
extern int clock_skew_detected;
/* can we run commands via 'sh -c xxx' or must we use batch files? */
diff --git a/make.texinfo b/make.texinfo
index 7fe5917..1e61183 100644
--- a/make.texinfo
+++ b/make.texinfo
@@ -6668,7 +6668,17 @@ Rules}). But you can still define your own suffixes with a rule for
@code{.SUFFIXES}, and then define your own suffix rules. Note that only
@emph{rules} are affected by the @code{-r} option; default variables
remain in effect (@pxref{Implicit Variables, ,Variables Used by Implicit
-Rules}).
+Rules}); see the @samp{-R} option below.
+
+@item -R
+@cindex @code{-R}
+@itemx --no-builtin-variables
+@cindex @code{--no-builtin-variables}
+Eliminate use of the built-in rule-specific variables (@pxref{Implicit
+Variables, ,Variables Used by Implicit Rules}). You can still define
+your own, of course. The @samp{-R} option also automatically enables
+the @samp{-r} option (see above), since it doesn't make sense to have
+implicit rules without any definitions for the variables that they use.
@item -s
@cindex @code{-s}
@@ -7201,7 +7211,9 @@ the value @w{@samp{; mv $*.o $@@}}.
The commands in built-in implicit rules make liberal use of certain
predefined variables. You can alter these variables in the makefile,
with arguments to @code{make}, or in the environment to alter how the
-implicit rules work without redefining the rules themselves.
+implicit rules work without redefining the rules themselves. You can
+cancel all variables used by implicit rules with the @samp{-R} or
+@samp{--no-builtin-variables} option.
For example, the command used to compile a C source file actually says
@samp{$(CC) -c $(CFLAGS) $(CPPFLAGS)}. The default values of the variables