X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?p=subdirmk.git;a=blobdiff_plain;f=build-aux%2Fsubdirmk-setup;h=976e3ce0055a74ff4eeb0ae654efca55587c55ba;hp=0c451c84acf23cfd978f5492f87e4ae7f458ceef;hb=14beeeeb51aae9812d6d6cad134ef2921fcb5062;hpb=e396ca12f4d9e2620f3ba8d1f4252f0cce08ff55 diff --git a/build-aux/subdirmk-setup b/build-aux/subdirmk-setup index 0c451c8..976e3ce 100755 --- a/build-aux/subdirmk-setup +++ b/build-aux/subdirmk-setup @@ -72,13 +72,13 @@ sub install_output_files () { sub write_makefile ($$) { my ($dir_prefix,$depth) = @_; - print STDERR "write_makefile @_\n"; + #print STDERR "write_makefile @_\n"; start_output_file("${dir_prefix}Makefile"); my $cd = $depth ? join('/', ('..',) x $depth) : '.'; o <{$t}=1; } - elsif (m{^(?=$caps_re)}) { o "${var_prefix}_" } + elsif (m{^(?=$caps_re)}) { o $var_prefix } elsif (m{^(?=$lc_re)}) { o $dir_prefix } - elsif (s{^_}{}) { o "${var_prefix}_" } + elsif (s{^_}{}) { o $var_prefix } elsif (s{^/}{}) { o $dir_prefix } elsif (s{^=_}{}) { o $var_prefix } elsif (s{^=/}{}) { o $dir_name } elsif (s{^\^}{}) { o "\$(top_srcdir)${dir_suffix}" } elsif (s{^\}}{}) { o "\$(abs_top_srcdir)${dir_suffix}" } - elsif (s{^(?:[ \t]+([~^]))?(?=[ \t]){}}{}) { + elsif (s{^(?:[ \t]+([~^]))?(?=[ \t])}{}) { my $prefix = !$1 ? $dir_prefix : $1 eq '~' ? '$(abs_top_srcdir)'.$dir_suffix : @@ -147,13 +147,13 @@ sub process_subtree ($$) { # recursive, children first my ($node, $path) = @_; - use Data::Dumper; - print STDERR Dumper(\@_); + #use Data::Dumper; + #print STDERR Dumper(\@_); my $dir_prefix = join '', map { "$_/" } @$path; my $dir_suffix = join '', map { "/$_" } @$path; my $dir_name = join '/', @$path ? @$path : '.'; - my $var_prefix = map { "${_}_" } @$path ? @$path : qw(TOP); + my $var_prefix = join '', map { "${_}_" } @$path ? @$path : qw(TOP); write_makefile($dir_prefix, scalar @$path); @@ -170,19 +170,16 @@ sub process_subtree ($$) { filter_subdir_mk($dir_prefix, $dir_suffix, $dir_name, $var_prefix, \%targets); + o "\n"; + my @targets = sort keys %targets; foreach my $target (@targets) { my $target_varname = target_varname($var_prefix, $target); - print O <