1999-09-14 02:03:19 +00:00
|
|
|
# -*-perl-*-
|
|
|
|
|
|
|
|
$description = "Test the behaviour of the .INTERMEDIATE target.";
|
|
|
|
|
|
|
|
$details = "\
|
|
|
|
Test the behavior of the .INTERMEDIATE special target.
|
|
|
|
Create a makefile where a file would not normally be considered
|
|
|
|
intermediate, then specify it as .INTERMEDIATE. Build and ensure it's
|
|
|
|
deleted properly. Rebuild to ensure that it's not created if it doesn't
|
|
|
|
exist but doesn't need to be built. Change the original and ensure
|
|
|
|
that the intermediate file and the ultimate target are both rebuilt, and
|
|
|
|
that the intermediate file is again deleted.
|
|
|
|
|
|
|
|
Try this with implicit rules and explicit rules: both should work.\n";
|
|
|
|
|
|
|
|
open(MAKEFILE,"> $makefile");
|
|
|
|
|
|
|
|
print MAKEFILE <<'EOF';
|
|
|
|
|
|
|
|
.INTERMEDIATE: foo.e bar.e
|
|
|
|
|
|
|
|
# Implicit rule test
|
|
|
|
%.d : %.e ; cp $< $@
|
|
|
|
%.e : %.f ; cp $< $@
|
|
|
|
|
|
|
|
foo.d: foo.e
|
|
|
|
|
|
|
|
# Explicit rule test
|
|
|
|
foo.c: foo.e bar.e; cat $^ > $@
|
|
|
|
EOF
|
|
|
|
|
|
|
|
close(MAKEFILE);
|
|
|
|
|
|
|
|
# TEST #0
|
|
|
|
|
2002-09-04 07:26:19 +00:00
|
|
|
&utouch(-20, 'foo.f', 'bar.f');
|
1999-09-14 02:03:19 +00:00
|
|
|
|
|
|
|
&run_make_with_options($makefile,'foo.d',&get_logfile);
|
|
|
|
$answer = "cp foo.f foo.e\ncp foo.e foo.d\nrm foo.e\n";
|
|
|
|
&compare_output($answer, &get_logfile(1));
|
|
|
|
|
|
|
|
# TEST #1
|
|
|
|
|
|
|
|
&run_make_with_options($makefile,'foo.d',&get_logfile);
|
2012-03-04 00:24:20 +00:00
|
|
|
$answer = "$make_name: 'foo.d' is up to date.\n";
|
1999-09-14 02:03:19 +00:00
|
|
|
&compare_output($answer, &get_logfile(1));
|
|
|
|
|
|
|
|
# TEST #2
|
|
|
|
|
2002-09-04 07:26:19 +00:00
|
|
|
&utouch(-10, 'foo.d');
|
1999-09-14 02:03:19 +00:00
|
|
|
&touch('foo.f');
|
|
|
|
|
|
|
|
&run_make_with_options($makefile,'foo.d',&get_logfile);
|
|
|
|
$answer = "cp foo.f foo.e\ncp foo.e foo.d\nrm foo.e\n";
|
|
|
|
&compare_output($answer, &get_logfile(1));
|
|
|
|
|
|
|
|
# TEST #3
|
|
|
|
|
|
|
|
&run_make_with_options($makefile,'foo.c',&get_logfile);
|
Use Jenkins hash.
This is about twice as fast as the current hash, and removes the
need for double hashing (improving locality of reference). The
hash function is based on Bob Jenkins' design, slightly adapted
wherever Make needs to hash NUL-terminated strings. The old hash
function is kept for case-insensitive hashing.
This saves 8.5% on QEMU's no-op build (from 12.87s to 11.78s).
* configure.ac: Check endianness.
* hash.c (rol32, jhash_mix, jhash_final, JHASH_INITVAL,
sum_get_unaligned_32, jhash): New.
* hash.h (STRING_HASH_1, STRING_N_HASH_1): Use jhash.
(STRING_HASH_2, STRING_N_HASH_2): Return a dummy value.
(STRING_N_COMPARE, return_STRING_N_COMPARE): Prefer memcmp to strncmp.
2017-08-11 11:44:28 +00:00
|
|
|
$answer = "cp foo.f foo.e\ncp bar.f bar.e\ncat foo.e bar.e > foo.c\nrm foo.e bar.e\n";
|
1999-09-14 02:03:19 +00:00
|
|
|
&compare_output($answer, &get_logfile(1));
|
|
|
|
|
|
|
|
# TEST #4
|
|
|
|
|
|
|
|
&run_make_with_options($makefile,'foo.c',&get_logfile);
|
2012-03-04 00:24:20 +00:00
|
|
|
$answer = "$make_name: 'foo.c' is up to date.\n";
|
1999-09-14 02:03:19 +00:00
|
|
|
&compare_output($answer, &get_logfile(1));
|
|
|
|
|
|
|
|
# TEST #5
|
|
|
|
|
2002-09-04 07:26:19 +00:00
|
|
|
&utouch(-10, 'foo.c');
|
1999-09-14 02:03:19 +00:00
|
|
|
&touch('foo.f');
|
|
|
|
|
|
|
|
&run_make_with_options($makefile,'foo.c',&get_logfile);
|
Use Jenkins hash.
This is about twice as fast as the current hash, and removes the
need for double hashing (improving locality of reference). The
hash function is based on Bob Jenkins' design, slightly adapted
wherever Make needs to hash NUL-terminated strings. The old hash
function is kept for case-insensitive hashing.
This saves 8.5% on QEMU's no-op build (from 12.87s to 11.78s).
* configure.ac: Check endianness.
* hash.c (rol32, jhash_mix, jhash_final, JHASH_INITVAL,
sum_get_unaligned_32, jhash): New.
* hash.h (STRING_HASH_1, STRING_N_HASH_1): Use jhash.
(STRING_HASH_2, STRING_N_HASH_2): Return a dummy value.
(STRING_N_COMPARE, return_STRING_N_COMPARE): Prefer memcmp to strncmp.
2017-08-11 11:44:28 +00:00
|
|
|
$answer = "cp foo.f foo.e\ncp bar.f bar.e\ncat foo.e bar.e > foo.c\nrm foo.e bar.e\n";
|
1999-09-14 02:03:19 +00:00
|
|
|
&compare_output($answer, &get_logfile(1));
|
|
|
|
|
2000-03-26 06:56:54 +00:00
|
|
|
# TEST #6 -- added for PR/1669: don't remove files mentioned on the cmd line.
|
|
|
|
|
|
|
|
&run_make_with_options($makefile,'foo.e',&get_logfile);
|
|
|
|
$answer = "cp foo.f foo.e\n";
|
|
|
|
&compare_output($answer, &get_logfile(1));
|
|
|
|
|
1999-09-14 02:03:19 +00:00
|
|
|
unlink('foo.f', 'foo.e', 'foo.d', 'foo.c', 'bar.f', 'bar.e', 'bar.d', 'bar.c');
|
|
|
|
|
2000-03-26 06:56:54 +00:00
|
|
|
# TEST #7 -- added for PR/1423
|
1999-12-18 17:43:47 +00:00
|
|
|
|
|
|
|
$makefile2 = &get_tmpfile;
|
|
|
|
|
|
|
|
open(MAKEFILE, "> $makefile2");
|
|
|
|
|
|
|
|
print MAKEFILE <<'EOF';
|
|
|
|
all: foo
|
|
|
|
foo.a: ; touch $@
|
|
|
|
%: %.a ; touch $@
|
|
|
|
.INTERMEDIATE: foo.a
|
|
|
|
EOF
|
|
|
|
|
|
|
|
close(MAKEFILE);
|
|
|
|
|
2000-03-26 06:56:54 +00:00
|
|
|
&run_make_with_options($makefile2, '-R', &get_logfile);
|
1999-12-18 17:43:47 +00:00
|
|
|
$answer = "touch foo.a\ntouch foo\nrm foo.a\n";
|
|
|
|
&compare_output($answer, &get_logfile(1));
|
|
|
|
|
|
|
|
unlink('foo');
|
|
|
|
|
1999-09-14 02:03:19 +00:00
|
|
|
# This tells the test driver that the perl test script executed properly.
|
|
|
|
1;
|