Home | History | Annotate | Download | only in variables
      1 #                                                                    -*-perl-*-
      2 
      3 $description = "Test the MAKE_RESTARTS variable.";
      4 
      5 # Test basic capability
      6 
      7 run_make_test('
      8 all: ; @:
      9 $(info MAKE_RESTARTS=$(MAKE_RESTARTS))
     10 include foo.x
     11 foo.x: ; @touch $@
     12 ',
     13               '', 'MAKE_RESTARTS=
     14 #MAKEFILE#:4: foo.x: No such file or directory
     15 MAKE_RESTARTS=1');
     16 
     17 rmfiles('foo.x');
     18 
     19 # Test multiple restarts
     20 
     21 run_make_test('
     22 all: ; @:
     23 $(info MAKE_RESTARTS=$(MAKE_RESTARTS))
     24 include foo.x
     25 foo.x: ; @echo "include bar.x" > $@
     26 bar.x: ; @touch $@
     27 ',
     28               '', 'MAKE_RESTARTS=
     29 #MAKEFILE#:4: foo.x: No such file or directory
     30 MAKE_RESTARTS=1
     31 foo.x:1: bar.x: No such file or directory
     32 MAKE_RESTARTS=2');
     33 
     34 rmfiles('foo.x', 'bar.x');
     35 
     36 # Test multiple restarts and make sure the variable is cleaned up
     37 
     38 run_make_test('
     39 recurse:
     40 	@echo recurse MAKE_RESTARTS=$$MAKE_RESTARTS
     41 	@$(MAKE) -f #MAKEFILE# all
     42 all:
     43 	@echo all MAKE_RESTARTS=$$MAKE_RESTARTS
     44 $(info MAKE_RESTARTS=$(MAKE_RESTARTS))
     45 include foo.x
     46 foo.x: ; @echo "include bar.x" > $@
     47 bar.x: ; @touch $@
     48 ',
     49               '', "MAKE_RESTARTS=
     50 #MAKEFILE#:8: foo.x: No such file or directory
     51 MAKE_RESTARTS=1
     52 foo.x:1: bar.x: No such file or directory
     53 MAKE_RESTARTS=2
     54 recurse MAKE_RESTARTS=
     55 MAKE_RESTARTS=
     56 #MAKE#[1]: Entering directory `#PWD#'
     57 all MAKE_RESTARTS=
     58 #MAKE#[1]: Leaving directory `#PWD#'");
     59 
     60 rmfiles('foo.x', 'bar.x');
     61 
     62 1;
     63