1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
|
### SPAR <http://www.cpan.org/scripts/>
### 4 644 1327960486 1380446186 hint
This tests an add-on utility for speeding up your build. The failure
likely does not imply a problem with makepp itself.
Ccache at least up to version 3.1.9 is known to fail this test on `out',
bug report https://bugzilla.samba.org/show_bug.cgi?id=8728 refers.
### 1 644 1329052295 1329052295 is_relevant.pl
have_cc
### 38 644 1227216359 1381956818 makepp_test_script.pl
# This test creates some files, also in other dirs, messes them up and wants mppr to recreate them.
local $ENV{CCACHE_DISABLE} = 1 if $ENV{AUTOMATED_TESTING}; # Else fail with hint to let user know.
local $ENV{X} = 0; # Set up a dependency mpp won't know about.
local $ENV{C} = 1;
eval { makepp '-k' };
c_cp qw(out out1);
c_cp qw(a b); # Mess up results a bit.
unlink qw(c dir/e x.c);
$ENV{X} = 1; # Do a change mpp wouldn't have done.
$ENV{C} = 0;
# Signatures get adjusted, but because mppr doesn't scan x.c, mpp must, to notice x1.h.
for my $file ( qw(dd y.c) ) { # Perform some editing, a standard use case for mppr.
c_sed 's/y0/y/', "-o+<$file"; # Use y.h instead of y0.h, which mppr ignores so mpp must rescan.
}
wait_timestamp 'a'; # Can have same signature after rebuilding in same second.
eval { makepp \'replay', qw(-kI. -Mmod=c_cmd MYVAR=5 a -Cdir . -c b c bb cc d xreal.c x.c), <[xy].o{,bj}>, <[xy]{,.exe}>, 'out' }
and die;
# Use glob to match Unix or Windows files.
c_cp qw(out out2);
c_cp qw(cc cc0);
$ENV{C} = 1;
wait_timestamp qw(x.o y.o); # Can have same signature after rebuilding in same second.
eval { makepp '-k' };
-f '.makepp/x1.h.mk' or die "missing .makepp/x1.h.mk\n";
# Make sure all rescan flags have been cleared.
my $rescan = 0;
local @ARGV = <.makepp/*.mk dir/.makepp/*.mk>;
local $/;
/^RESCAN=/m and $rescan++ while <>;
die 'rescan' if $rescan != 5; # a, d, dir/e, dir/f & xreal.c don't need scanning, so they don't lose this flag.
1;
### 35 644 1227216620 1229020504 RootMakeppfile.mk
$(phony all): a c cc d dir/$( e f) out
load_makefile dir # needed for a
b c:
&echo b -o b
&expr 0 -o c # creates c but fails
bb cc:
&echo bb -o bb
&expr $$ENV{C} -o cc # creates cc but fails depending on C
perl { use mod qw(c_cmd) }
d: MYVAR=5
d: dd
&cmd d
export E=5
dir/e: :env E # check that mppr remembers E
&expr &f_ROOT.$$ENV{E} -o $(output)
xreal.c:
&expr 'qq!#include <stdio.h>\n#include "x$$ENV{X}.h"!' -o $(output)
x.c: xreal.c
&cp -fs --verbose $(input) $(output) # Test symlink if available
CFLAGS = -Idir # Make dir/y.h a candidate, but not the one mpp would have chosen.
y.h: # Same dir has precedence, so the scanner will have this one created.
&echo '#define STR "C"' -o y.h
out:
.$/x > out
.$/y >>out
### 16 644 1227207921 1228997339 mod.pm
package mod;
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(c_cmd);
sub c_cmd {
open my $fh, '>', $_[0] or
die $!;
print $fh "$_[0]: " . join( ' ', map $Mpp::Subs::rule->{MAKEFILE}->expand_variable( $_ ), qw(LD MYVAR) );
# Pick up a standard and a target specific var.
close $fh;
}
1;
### 1 644 1228321990 1228590123 dd
a dep with no special scanner, to edit: y0
### 1 644 1228321911 1228159851 x0.h
int main() { puts("a"); return 0; }
### 1 644 1228321990 1228160207 x1.h
int main() { puts("b"); return 0; }
### 3 644 1228321990 1228778886 y.c
#include <stdio.h>
#include "y0.h"
int main() { puts(STR); return 0; }
### 1 644 1228321911 1228336626 y0.h
#define STR "A"
### D 755 1227216633 1227216621 dir/
### 5 644 1227216339 1227216284 dir/makefile
../a:
echo a>$(output)
f:
&expr &f_ROOT -o $(output)
### 1 644 1228321911 1228336626 dir/y.h
#define STR "B"
### D 755 1227216644 1227216633 answers/
### 1 644 1227216633 1227216621 answers/a
a
### 1 644 1227216633 1227216621 answers/b
b
### 1 644 1227216633 1227216621 answers/c
0
### 1 644 1227216633 1227216621 answers/cc
1
### 1 644 1227216633 1227216621 answers/cc0
0
### -1 644 1227216633 1227216621 answers/d
d: ld 5
### 2 644 1227216633 1228779604 answers/out
b
C
### 2 644 1227216633 1228779602 answers/out1
a
A
### 2 644 1227216633 1228779600 answers/out2
b
B
### 1 644 1067451873 1228322580 answers/n_files
8 0 2
### D 755 1227216644 1227216633 answers/dir/
### 1 644 1227216633 1227216621 answers/dir/e
.5
### 1 644 1227216633 1227216621 answers/dir/f
..
|