summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2005-10-24 13:01:39 +0000
committerPaul Smith <psmith@gnu.org>2005-10-24 13:01:39 +0000
commit11095a90f120545c915c92b8ebf48f04723d1837 (patch)
tree73dba88903ea90cdac930057fe8619a8a04fb869 /main.c
parent66459baee27374577d32a78564604ad64228f71d (diff)
downloadgunmake-11095a90f120545c915c92b8ebf48f04723d1837.tar.gz
Make second expansion optional (partial implementation).
I decided this feature was too impacting to make the permanent default behavior. This set of changes makes the default behavior of make the old behavior (no second expansion). If you want second expansion, you must define the .SECONDEXPANSION: special target before the first target that needs it. This set of changes ONLY fixes explicit and static pattern rules to work like this. Implicit rules still have second expansion enabled all the time: I'll work on that next. Note that there is still a backward-incompatibility: now to get the old SysV behavior using $$@ etc. in the prerequisites list you need to set .SECONDEXPANSION: as well.
Diffstat (limited to 'main.c')
-rw-r--r--main.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/main.c b/main.c
index 37c6ef6..8c52724 100644
--- a/main.c
+++ b/main.c
@@ -486,6 +486,11 @@ struct file *default_file;
int posix_pedantic;
+/* Nonzero if we have seen the '.SECONDEXPANSION' target.
+ This turns on secondary expansion of prerequisites. */
+
+int second_expansion;
+
/* Nonzero if we have seen the `.NOTPARALLEL' target.
This turns off parallel builds for this invocation of make. */
@@ -1437,7 +1442,7 @@ main (int argc, char **argv, char **envp)
starting_directory = current_directory;
}
- (void) define_variable ("CURDIR", 6, current_directory, o_default, 0);
+ (void) define_variable ("CURDIR", 6, current_directory, o_file, 0);
/* Read any stdin makefiles into temporary files. */
@@ -2174,6 +2179,7 @@ main (int argc, char **argv, char **envp)
goals->next = 0;
goals->name = 0;
goals->ignore_mtime = 0;
+ goals->staticpattern = 0;
goals->need_2nd_expansion = 0;
goals->file = default_goal_file;
}
@@ -2341,6 +2347,7 @@ handle_non_switch_argument (char *arg, int env)
lastgoal->name = 0;
lastgoal->file = f;
lastgoal->ignore_mtime = 0;
+ lastgoal->staticpattern = 0;
lastgoal->need_2nd_expansion = 0;
{