1*69606e3fSchristos# -*-perl-*- 2*69606e3fSchristos$description = "Test the -n option.\n"; 3*69606e3fSchristos 4*69606e3fSchristos$details = "Try various uses of -n and ensure they all give the correct results.\n"; 5*69606e3fSchristos 6*69606e3fSchristosopen(MAKEFILE, "> $makefile"); 7*69606e3fSchristos 8*69606e3fSchristos# The Contents of the MAKEFILE ... 9*69606e3fSchristos 10*69606e3fSchristosprint MAKEFILE <<'EOMAKE'; 11*69606e3fSchristos 12*69606e3fSchristosfinal: intermediate ; echo >> $@ 13*69606e3fSchristosintermediate: orig ; echo >> $@ 14*69606e3fSchristos 15*69606e3fSchristosEOMAKE 16*69606e3fSchristos 17*69606e3fSchristosclose(MAKEFILE); 18*69606e3fSchristos 19*69606e3fSchristos&touch('orig'); 20*69606e3fSchristos 21*69606e3fSchristos# TEST 0 22*69606e3fSchristos 23*69606e3fSchristos&run_make_with_options($makefile, "", &get_logfile); 24*69606e3fSchristos$answer = "echo >> intermediate\necho >> final\n"; 25*69606e3fSchristos&compare_output($answer, &get_logfile(1)); 26*69606e3fSchristos 27*69606e3fSchristos# TEST 1 28*69606e3fSchristos 29*69606e3fSchristos&run_make_with_options($makefile, "-Worig -n", &get_logfile); 30*69606e3fSchristos$answer = "echo >> intermediate\necho >> final\n"; 31*69606e3fSchristos&compare_output($answer, &get_logfile(1)); 32*69606e3fSchristos 33*69606e3fSchristosunlink('orig', 'intermediate', 'final'); 34*69606e3fSchristos 35*69606e3fSchristos# We consider the actual updated timestamp of targets with all 36*69606e3fSchristos# recursive commands, even with -n. 37*69606e3fSchristos 38*69606e3fSchristos$makefile2 = &get_tmpfile; 39*69606e3fSchristos 40*69606e3fSchristosopen(MAKEFILE, "> $makefile2"); 41*69606e3fSchristos 42*69606e3fSchristosprint MAKEFILE <<'EOF'; 43*69606e3fSchristos.SUFFIXES: 44*69606e3fSchristosBAR = # nothing 45*69606e3fSchristosFOO = +$(BAR) 46*69606e3fSchristosa: b; echo > $@ 47*69606e3fSchristosb: c; $(FOO) 48*69606e3fSchristosEOF 49*69606e3fSchristos 50*69606e3fSchristosclose(MAKEFILE); 51*69606e3fSchristos 52*69606e3fSchristos&utouch(-20, 'b'); 53*69606e3fSchristos&utouch(-10, 'a'); 54*69606e3fSchristos&touch('c'); 55*69606e3fSchristos 56*69606e3fSchristos# TEST 2 57*69606e3fSchristos 58*69606e3fSchristos&run_make_with_options($makefile2, "", &get_logfile); 59*69606e3fSchristos$answer = "$make_name: `a' is up to date.\n"; 60*69606e3fSchristos&compare_output($answer, &get_logfile(1)); 61*69606e3fSchristos 62*69606e3fSchristos# TEST 3 63*69606e3fSchristos 64*69606e3fSchristos&run_make_with_options($makefile2, "-n", &get_logfile); 65*69606e3fSchristos$answer = "$make_name: `a' is up to date.\n"; 66*69606e3fSchristos&compare_output($answer, &get_logfile(1)); 67*69606e3fSchristos 68*69606e3fSchristosunlink('a', 'b', 'c'); 69*69606e3fSchristos 70*69606e3fSchristos1; 71