3 # $(srcdir)/build-aux/subdirmk-setup SUBDIR...
11 our $root = [ '.', [ ] ];
12 # each node is [ 'relative subdir name', \@children ]
15 foreach my $subdir (@ARGV) {
16 my @path = $subdir eq '.' ? () : split m{/+}, $subdir;
18 foreach my $d (@path) {
19 my ($c,) = grep { $_->[0] eq $d } @{ $node->[1] };
22 push @{ $node->[1] }, $c;
31 sub write_makefile ($$) {
32 my ($subdir,$depth) = @_;
33 start_output_file("Makefile");
34 my $cd = $depth ? join('/', ('..',) x $depth) : '.';
37 $(MAKE) -C $cd $subdir/$@
41 sub process_subdir ($$) {
43 my $depth = $subdir eq '.' ? 0 : scalar split m{/+}, $subdir;
44 write_makefile($subdir,$depth);