+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
* 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
{
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);
}
#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>
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 ();
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). */
{ '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" },
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
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? */
@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}
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