Index: branches/GNU/src/gmake/tests/scripts/features/patternrules
===================================================================
--- branches/GNU/src/gmake/tests/scripts/features/patternrules	(revision 283)
+++ branches/GNU/src/gmake/tests/scripts/features/patternrules	(revision 283)
@@ -0,0 +1,99 @@
+#                                                                    -*-perl-*-
+
+$description = "Test pattern rules.";
+
+$details = "";
+
+use Cwd;
+
+$dir = cwd;
+$dir =~ s,.*/([^/]+)$,../$1,;
+
+
+#  TEST #1: Make sure that multiple patterns where the same target
+#           can be built are searched even if the first one fails
+#           to match properly.
+#
+
+run_make_test('
+.PHONY: all
+
+all: case.1 case.2 case.3
+a: void
+
+# 1 - existing file
+%.1: void
+	@false
+%.1: #MAKEFILE#
+	@true
+
+# 2 - phony
+%.2: void
+	@false
+%.2: 2.phony
+	@true
+.PHONY: 2.phony
+
+# 3 - implicit-phony
+%.3: void
+	@false
+%.3: 3.implicit-phony
+	@true
+
+3.implicit-phony:
+',
+'',
+'');
+
+# TEST #2: make sure files that are built via implicit rules are marked
+#          as targets (Savannah bug #12202).
+#
+run_make_test('
+TARGETS := foo foo.out
+
+.PHONY: all foo.in
+
+all: $(TARGETS)
+
+%: %.in
+	@echo $@
+
+%.out: %
+	@echo $@
+
+foo.in: ; @:
+
+',
+'',
+'foo
+foo.out');
+
+
+# TEST #3: make sure intermidite files that also happened to be
+#          prerequisites are not removed (Savannah bug #12267).
+#
+run_make_test('
+$(dir)/foo.o:
+
+$(dir)/foo.y:
+	@echo $@
+
+%.c: %.y
+	touch $@
+
+%.o: %.c
+	@echo $@
+
+.PHONY: install
+install: $(dir)/foo.c
+
+',
+"dir=$dir",
+"$dir/foo.y
+touch $dir/foo.c
+$dir/foo.o");
+
+unlink("$dir/foo.c");
+
+# This tells the test driver that the perl test script executed properly.
+1;
Index: branches/GNU/src/gmake/tests/scripts/features/se_explicit
===================================================================
--- branches/GNU/src/gmake/tests/scripts/features/se_explicit	(revision 283)
+++ branches/GNU/src/gmake/tests/scripts/features/se_explicit	(revision 283)
@@ -0,0 +1,105 @@
+#                                                                    -*-perl-*-
+$description = "Test second expansion in ordinary rules.";
+
+$details = "";
+
+# Test #1: automatic variables.
+#
+run_make_test('
+.DEFAULT: ; @echo $@
+
+foo: bar baz
+
+foo: biz | buz
+
+foo: $$@.1 \
+     $$<.2 \
+     $$(addsuffix .3,$$^) \
+     $$(addsuffix .4,$$+) \
+     $$|.5 \
+     $$*.6
+
+',
+'',
+'bar
+baz
+biz
+buz
+foo.1
+bar.2
+bar.3
+baz.3
+biz.3
+bar.4
+baz.4
+biz.4
+buz.5
+.6
+');
+
+
+# Test #2: target/pattern -specific variables.
+#
+run_make_test('
+.DEFAULT: ; @echo $@
+
+foo.x: $$a $$b
+
+foo.x: a := bar
+
+%.x: b := baz
+
+',
+'',
+'bar
+baz
+');
+
+
+# Test #3: order of prerequisites.
+#
+run_make_test('
+.DEFAULT: ; @echo $@
+
+all: foo bar baz
+
+# Subtest #1
+#
+foo: foo.1; @:
+
+foo: foo.2
+
+foo: foo.3
+
+
+# Subtest #2
+#
+bar: bar.2
+
+bar: bar.1; @:
+
+bar: bar.3
+
+
+# Subtest #3
+#
+baz: baz.1
+
+baz: baz.2
+
+baz: ; @:
+
+',
+'',
+'foo.1
+foo.2
+foo.3
+bar.1
+bar.2
+bar.3
+baz.1
+baz.2
+');
+
+# This tells the test driver that the perl test script executed properly.
+1;
Index: branches/GNU/src/gmake/tests/scripts/features/se_implicit
===================================================================
--- branches/GNU/src/gmake/tests/scripts/features/se_implicit	(revision 283)
+++ branches/GNU/src/gmake/tests/scripts/features/se_implicit	(revision 283)
@@ -0,0 +1,224 @@
+#                                                                    -*-perl-*-
+$description = "Test second expansion in ordinary rules.";
+
+$details = "";
+
+use Cwd;
+
+$dir = cwd;
+$dir =~ s,.*/([^/]+)$,../$1,;
+
+
+# Test #1: automatic variables.
+#
+run_make_test('
+.DEFAULT: ; @echo $@
+
+foo.a: bar baz
+
+foo.a: biz | buz
+
+foo.%: 1.$$@ \
+       2.$$< \
+       $$(addprefix 3.,$$^) \
+       $$(addprefix 4.,$$+) \
+       5.$$| \
+       6.$$*
+	@:
+
+1.foo.a \
+2.bar \
+3.bar \
+3.baz \
+3.biz \
+4.bar \
+4.baz \
+4.biz \
+5.buz \
+6.a:
+	@echo $@
+
+',
+'',
+'1.foo.a
+2.bar
+3.bar
+3.baz
+3.biz
+4.bar
+4.baz
+4.biz
+5.buz
+6.a
+bar
+baz
+biz
+buz
+');
+
+
+# Test #2: target/pattern -specific variables.
+#
+run_make_test('
+foo.x:
+
+foo.%: $$(%_a) $$(%_b) bar
+	@:
+
+foo.x: x_a := bar
+
+%.x: x_b := baz
+
+bar baz: ; @echo $@
+
+',
+'',
+'bar
+baz
+');
+
+
+# Test #3: order of prerequisites.
+#
+run_make_test('
+.DEFAULT: ; @echo $@
+
+all: foo bar baz
+
+
+# Subtest #1
+#
+%oo: %oo.1; @:
+
+foo: foo.2
+
+foo: foo.3
+
+foo.1: ; @echo $@
+
+
+# Subtest #2
+#
+bar: bar.2
+
+%ar: %ar.1; @:
+
+bar: bar.3
+
+bar.1: ; @echo $@
+
+
+# Subtest #3
+#
+baz: baz.1
+
+baz: baz.2
+
+%az: ; @:
+
+',
+'',
+'foo.1
+foo.2
+foo.3
+bar.1
+bar.2
+bar.3
+baz.1
+baz.2
+');
+
+
+# Test #4: stem splitting logic.
+#
+run_make_test('
+$(dir)/tmp/bar.o:
+
+$(dir)/tmp/foo/bar.c: ; @echo $@
+$(dir)/tmp/bar/bar.c: ; @echo $@
+foo.h: ; @echo $@
+
+%.o: $$(addsuffix /%.c,foo bar) foo.h
+	@echo $@: {$<} $^
+
+',
+"dir=$dir",
+"$dir/tmp/foo/bar.c
+$dir/tmp/bar/bar.c
+foo.h
+$dir/tmp/bar.o: {$dir/tmp/foo/bar.c} $dir/tmp/foo/bar.c $dir/tmp/bar/bar.c foo.h
+");
+
+
+# Test #5: stem splitting logic and order-only prerequisites.
+#
+run_make_test('
+$(dir)/tmp/foo.o: $(dir)/tmp/foo.c
+$(dir)/tmp/foo.c: ; @echo $@
+bar.h: ; @echo $@
+
+%.o: %.c|bar.h
+	@echo $@: {$<} {$|} $^
+
+',
+"dir=$dir",
+"$dir/tmp/foo.c
+bar.h
+$dir/tmp/foo.o: {$dir/tmp/foo.c} {bar.h} $dir/tmp/foo.c
+");
+
+
+# Test #6: lack of implicit prerequisites.
+#
+run_make_test('
+foo.o: foo.c
+foo.c: ; @echo $@
+
+%.o:
+	@echo $@: {$<} $^
+
+',
+'',
+'foo.c
+foo.o: {foo.c} foo.c
+');
+
+# Test #7: Test stem from the middle of the name.
+#
+run_make_test('
+foobarbaz:
+
+foo%baz: % $$*.1
+	@echo $*
+
+bar bar.1:
+	@echo $@
+
+',
+'',
+'bar
+bar.1
+bar
+');
+
+# Test #8: Make sure stem triple-expansion does not happen.
+#
+run_make_test('
+foo$$bar:
+
+f%r: % $$*.1
+	@echo \'$*\'
+
+oo$$ba oo$$ba.1:
+	@echo \'$@\'
+
+',
+'',
+'oo$ba
+oo$ba.1
+oo$ba
+');
+
+
+# This tells the test driver that the perl test script executed properly.
+1;
Index: branches/GNU/src/gmake/tests/scripts/features/se_statpat
===================================================================
--- branches/GNU/src/gmake/tests/scripts/features/se_statpat	(revision 283)
+++ branches/GNU/src/gmake/tests/scripts/features/se_statpat	(revision 283)
@@ -0,0 +1,124 @@
+#                                                                    -*-perl-*-
+$description = "Test second expansion in static pattern rules.";
+
+$details = "";
+
+# Test #1: automatic variables.
+#
+run_make_test('
+.DEFAULT: ; @echo $@
+
+foo.a foo.b: foo.%: bar.% baz.%
+
+foo.a foo.b: foo.%: biz.% | buz.%
+
+foo.a foo.b: foo.%: $$@.1 \
+                    $$<.2 \
+                    $$(addsuffix .3,$$^) \
+                    $$(addsuffix .4,$$+) \
+                    $$|.5 \
+                    $$*.6
+
+',
+'',
+'bar.a
+baz.a
+biz.a
+buz.a
+foo.a.1
+bar.a.2
+bar.a.3
+baz.a.3
+biz.a.3
+bar.a.4
+baz.a.4
+biz.a.4
+buz.a.5
+a.6
+');
+
+
+# Test #2: target/pattern -specific variables.
+#
+run_make_test('
+.DEFAULT: ; @echo $@
+
+foo.x foo.y: foo.%: $$(%_a) $$($$*_b)
+
+foo.x: x_a := bar
+
+%.x: x_b := baz
+
+
+',
+'',
+'bar
+baz
+');
+
+
+# Test #3: order of prerequisites.
+#
+run_make_test('
+.DEFAULT: ; @echo $@
+
+all: foo.a bar.a baz.a
+
+# Subtest #1
+#
+foo.a foo.b: foo.%: foo.%.1; @:
+
+foo.a foo.b: foo.%: foo.%.2
+
+foo.a foo.b: foo.%: foo.%.3
+
+
+# Subtest #2
+#
+bar.a bar.b: bar.%: bar.%.2
+
+bar.a bar.b: bar.%: bar.%.1; @:
+
+bar.a bar.b: bar.%: bar.%.3
+
+
+# Subtest #3
+#
+baz.a baz.b: baz.%: baz.%.1
+
+baz.a baz.b: baz.%: baz.%.2
+
+baz.a baz.b: ; @:
+
+',
+'',
+'foo.a.1
+foo.a.2
+foo.a.3
+bar.a.1
+bar.a.2
+bar.a.3
+baz.a.1
+baz.a.2
+');
+
+
+# Test #4: Make sure stem triple-expansion does not happen.
+#
+run_make_test('
+foo$$bar: f%r: % $$*.1
+	@echo \'$*\'
+
+oo$$ba oo$$ba.1:
+	@echo \'$@\'
+
+',
+'',
+'oo$ba
+oo$ba.1
+oo$ba
+');
+
+
+# This tells the test driver that the perl test script executed properly.
+1;
Index: branches/GNU/src/gmake/tests/scripts/functions/abspath
===================================================================
--- branches/GNU/src/gmake/tests/scripts/functions/abspath	(revision 283)
+++ branches/GNU/src/gmake/tests/scripts/functions/abspath	(revision 283)
@@ -0,0 +1,81 @@
+#                                                                    -*-perl-*-
+$description = "Test the abspath functions.";
+
+$details = "";
+
+run_make_test('
+ifneq ($(realpath $(abspath .)),$(CURDIR))
+  $(error )
+endif
+
+ifneq ($(realpath $(abspath ./)),$(CURDIR))
+  $(error )
+endif
+
+ifneq ($(realpath $(abspath .///)),$(CURDIR))
+  $(error )
+endif
+
+ifneq ($(abspath /),/)
+  $(error )
+endif
+
+ifneq ($(abspath ///),/)
+  $(error )
+endif
+
+ifneq ($(abspath /.),/)
+  $(error )
+endif
+
+ifneq ($(abspath ///.),/)
+  $(error )
+endif
+
+ifneq ($(abspath /./),/)
+  $(error )
+endif
+
+ifneq ($(abspath /.///),/)
+  $(error )
+endif
+
+ifneq ($(abspath /..),/)
+  $(error )
+endif
+
+ifneq ($(abspath ///..),/)
+  $(error )
+endif
+
+ifneq ($(abspath /../),/)
+  $(error )
+endif
+
+ifneq ($(abspath /..///),/)
+  $(error )
+endif
+
+
+ifneq ($(abspath /foo/bar/..),/foo)
+  $(error )
+endif
+
+ifneq ($(abspath /foo/bar/../../../baz),/baz)
+  $(error )
+endif
+
+ifneq ($(abspath /foo/bar/../ /..),/foo /)
+  $(error )
+endif
+
+
+.PHONY: all
+all: ; @:
+',
+'',
+'');
+
+
+# This tells the test driver that the perl test script executed properly.
+1;
Index: branches/GNU/src/gmake/tests/scripts/functions/realpath
===================================================================
--- branches/GNU/src/gmake/tests/scripts/functions/realpath	(revision 283)
+++ branches/GNU/src/gmake/tests/scripts/functions/realpath	(revision 283)
@@ -0,0 +1,71 @@
+#                                                                    -*-perl-*-
+$description = "Test the realpath functions.";
+
+$details = "";
+
+run_make_test('
+ifneq ($(realpath .),$(CURDIR))
+  $(error )
+endif
+
+ifneq ($(realpath ./),$(CURDIR))
+  $(error )
+endif
+
+ifneq ($(realpath .///),$(CURDIR))
+  $(error )
+endif
+
+ifneq ($(realpath /),/)
+  $(error )
+endif
+
+ifneq ($(realpath ///),/)
+  $(error )
+endif
+
+ifneq ($(realpath /.),/)
+  $(error )
+endif
+
+ifneq ($(realpath ///.),/)
+  $(error )
+endif
+
+ifneq ($(realpath /./),/)
+  $(error )
+endif
+
+ifneq ($(realpath /.///),/)
+  $(error )
+endif
+
+ifneq ($(realpath /..),/)
+  $(error )
+endif
+
+ifneq ($(realpath ///..),/)
+  $(error )
+endif
+
+ifneq ($(realpath /../),/)
+  $(error )
+endif
+
+ifneq ($(realpath /..///),/)
+  $(error )
+endif
+
+ifneq ($(realpath . /..),$(CURDIR) /)
+  $(error )
+endif
+
+.PHONY: all
+all: ; @:
+',
+'',
+'');
+
+
+# This tells the test driver that the perl test script executed properly.
+1;
Index: branches/GNU/src/gmake/tests/scripts/options/symlinks
===================================================================
--- branches/GNU/src/gmake/tests/scripts/options/symlinks	(revision 283)
+++ branches/GNU/src/gmake/tests/scripts/options/symlinks	(revision 283)
@@ -0,0 +1,47 @@
+#                                                                    -*-perl-*-
+
+$description = "Test the -L option.";
+
+$details = "Verify that symlink handling with and without -L works properly.";
+
+# Only run these tests if the system sypports symlinks
+if (eval { symlink("",""); 1 }) {
+
+  # Set up a symlink sym -> dep
+  # We'll make both dep and targ older than sym
+  $pwd =~ m%/([^/]+)$%;
+  $dirnm = $1;
+  &utouch(-10, 'dep');
+  &utouch(-5, 'targ');
+  symlink("../$dirnm/dep", 'sym');
+
+  # Without -L, nothing should happen
+  # With -L, it should update targ
+  run_make_test('targ: sym ; @echo make $@ from $<', '',
+                "#MAKE#: `targ' is up to date.");
+  run_make_test(undef, '-L', "make targ from sym");
+
+  # Now update dep; in all cases targ should be out of date.
+  &touch('dep');
+  run_make_test(undef, '', "make targ from sym");
+  run_make_test(undef, '-L', "make targ from sym");
+
+  # Now update targ; in all cases targ should be up to date.
+  &touch('targ');
+  run_make_test(undef, '', "#MAKE#: `targ' is up to date.");
+  run_make_test(undef, '-L', "#MAKE#: `targ' is up to date.");
+
+  # Add in a new link between sym and dep.  Be sure it's newer than targ.
+  sleep(1);
+  rename('dep', 'dep1');
+  symlink('dep1', 'dep');
+
+  # Without -L, nothing should happen
+  # With -L, it should update targ
+  run_make_test(undef, '', "#MAKE#: `targ' is up to date.");
+  run_make_test(undef, '-L', "make targ from sym");
+
+  rmfiles('targ', 'dep', 'sym', 'dep1');
+}
+
+1;
Index: branches/GNU/src/gmake/tests/scripts/variables/DEFAULT_GOAL
===================================================================
--- branches/GNU/src/gmake/tests/scripts/variables/DEFAULT_GOAL	(revision 283)
+++ branches/GNU/src/gmake/tests/scripts/variables/DEFAULT_GOAL	(revision 283)
@@ -0,0 +1,78 @@
+#                                                                    -*-perl-*-
+$description = "Test the .DEFAULT_GOAL special variable.";
+
+$details = "";
+
+
+# Test #1: basic logic.
+#
+run_make_test('
+# Basics.
+#
+foo: ; @:
+
+ifneq ($(.DEFAULT_GOAL),foo)
+$(error )
+endif
+
+# Reset to empty.
+#
+.DEFAULT_GOAL :=
+
+bar: ; @:
+
+ifneq ($(.DEFAULT_GOAL),bar)
+$(error )
+endif
+
+# Change to a different goal.
+#
+
+.DEFAULT_GOAL := baz
+
+baz: ; @echo $@
+',
+'',
+'baz');
+
+
+# Test #2: unknown goal.
+#
+run_make_test('
+.DEFAULT_GOAL = foo
+',
+'',
+'#MAKE#: *** No rule to make target `foo\'.  Stop.',
+512);
+
+
+# Test #3: more than one goal.
+#
+run_make_test('
+.DEFAULT_GOAL := foo bar
+',
+'',
+'#MAKE#: *** .DEFAULT_GOAL contains more than one target.  Stop.',
+512);
+
+
+# Test #4: Savannah bug #12226.
+#
+run_make_test('
+define rule
+foo: ; @echo $$@
+endef
+
+define make-rule
+$(eval $(rule))
+endef
+
+$(call make-rule)
+
+',
+'',
+'foo');
+
+
+# This tells the test driver that the perl test script executed properly.
+1;
Index: branches/GNU/src/gmake/tests/scripts/variables/MFILE_LIST
===================================================================
--- branches/GNU/src/gmake/tests/scripts/variables/MFILE_LIST	(revision 283)
+++ branches/GNU/src/gmake/tests/scripts/variables/MFILE_LIST	(revision 283)
@@ -0,0 +1,30 @@
+#                                                                    -*-perl-*-
+
+$description = "Test the MAKEFILE_LIST variable.";
+
+$makefile2 = &get_tmpfile;
+
+open(MAKEFILE,"> $makefile");
+print MAKEFILE <<EOF;
+m1 := \$(MAKEFILE_LIST)
+include $makefile2
+m3 := \$(MAKEFILE_LIST)
+
+all:
+\t\@echo \$(m1)
+\t\@echo \$(m2)
+\t\@echo \$(m3)
+EOF
+close(MAKEFILE);
+
+
+open(MAKEFILE,"> $makefile2");
+print MAKEFILE "m2 := \$(MAKEFILE_LIST)\n";
+close(MAKEFILE);
+
+
+&run_make_with_options($makefile, "", &get_logfile);
+$answer = "$makefile\n$makefile $makefile2\n$makefile $makefile2\n";
+&compare_output($answer,&get_logfile(1));
+
+1;
Index: branches/GNU/src/gmake/tests/scripts/variables/SHELL
===================================================================
--- branches/GNU/src/gmake/tests/scripts/variables/SHELL	(revision 283)
+++ branches/GNU/src/gmake/tests/scripts/variables/SHELL	(revision 283)
@@ -0,0 +1,49 @@
+#                                                                    -*-perl-*-
+
+$description = "Test proper handling of SHELL.";
+
+# Find the default value when SHELL is not set.  On UNIX it will be /bin/sh,
+# but on other platforms who knows?
+$oshell = $ENV{SHELL};
+delete $ENV{SHELL};
+$mshell = `echo 'all:;\@echo \$(SHELL)' | $make_name -f-`;
+chop $mshell;
+
+# According to POSIX, the value of SHELL in the environment has no impact on
+# the value in the makefile.
+
+$ENV{SHELL} = '/dev/null';
+run_make_test('all:;@echo "$(SHELL)"', '', $mshell);
+
+# According to POSIX, any value of SHELL set in the makefile should _NOT_ be
+# exported to the subshell!  I wanted to set SHELL to be $^X (perl) in the
+# makefile, but make runs $(SHELL) -c 'commandline' and that doesn't work at
+# all when $(SHELL) is perl :-/.  So, we just add an extra initial / and hope
+# for the best on non-UNIX platforms :-/.
+
+$ENV{SHELL} = $mshell;
+
+run_make_test("SHELL := /$mshell\n".'
+all:;@echo "$(SHELL) $$SHELL"
+', '', "/$mshell $mshell");
+
+# As a GNU make extension, if make's SHELL variable is explicitly exported,
+# then we really _DO_ export it.
+
+run_make_test("export SHELL := /$mshell\n".'
+all:;@echo "$(SHELL) $$SHELL"
+', '', "/$mshell /$mshell");
+
+
+# Test out setting of SHELL, both exported and not, as a target-specific
+# variable.
+
+run_make_test("all: SHELL := /$mshell\n".'
+all:;@echo "$(SHELL) $$SHELL"
+', '', "/$mshell $mshell");
+
+run_make_test("all: export SHELL := /$mshell\n".'
+all:;@echo "$(SHELL) $$SHELL"
+', '', "/$mshell $mshell");
+
+1;
Index: branches/GNU/src/gmake/w32/.cvsignore
===================================================================
--- branches/GNU/src/gmake/w32/.cvsignore	(revision 283)
+++ branches/GNU/src/gmake/w32/.cvsignore	(revision 283)
@@ -0,0 +1,1 @@
+Makefile Makefile.in
Index: branches/GNU/src/gmake/w32/Makefile.am
===================================================================
--- branches/GNU/src/gmake/w32/Makefile.am	(revision 283)
+++ branches/GNU/src/gmake/w32/Makefile.am	(revision 283)
@@ -0,0 +1,8 @@
+# Makefile.am to create libw32.a for mingw32 host.
+
+noinst_LIBRARIES = libw32.a
+
+libw32_a_SOURCES =  subproc/misc.c subproc/sub_proc.c subproc/w32err.c \
+		    pathstuff.c
+
+libw32_a_CPPFLAGS = -I$(srcdir)/include -I$(srcdir)/subproc -I$(top_srcdir)
