chiark
/
gitweb
/
~ian
/
subdirmk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
example: Add a comment next to for-test bits
[subdirmk.git]
/
generate
diff --git
a/generate
b/generate
index b4c52ae40073c1c3cca1b3026a2c52595e1d9851..9275b25770b818e8346a6c11b0ba532c9e2e4de7 100755
(executable)
--- a/
generate
+++ b/
generate
@@
-97,14
+97,18
@@
sub write_makefile ($$) {
#print STDERR "write_makefile @_\n";
start_output_file("${dir_prefix}Makefile");
my $cd = $depth ? join('/', ('..',) x $depth) : '.';
#print STDERR "write_makefile @_\n";
start_output_file("${dir_prefix}Makefile");
my $cd = $depth ? join('/', ('..',) x $depth) : '.';
+ my $suppress_templates=
+ '$(if $(filter-out clean real-clean, $(subdirmk_targets)),,'.
+ ' MAKEFILE_TEMPLATES=)';
o <<END;
default: all
o <<END;
default: all
-%: FORCE-ALWAYS-RUN
+\$(filter-out all,\$(MAKECMDGOALS)) all: run-main.mk
\@:
\@:
-Makefile FORCE-ALWAYS-RUN:
- \$(MAKE) -C $cd -f main.mk \$(addprefix ${dir_prefix},\$(or \$(MAKECMDGOALS),all))
+subdirmk_targets:=\$(or \$(MAKECMDGOALS),all)
+Makefile run-main.mk:
+ \$(MAKE) -C $cd -f main.mk \$(addprefix ${dir_prefix},\$(subdirmk_targets))$suppress_templates
.SUFFIXES:
.SUFFIXES:
-.PHONY:
FORCE-ALWAYS-RUN
+.PHONY:
run-main.mk
END
}
END
}
@@
-133,8
+137,8
@@
sub process_input_mk ($$$$$$$$) {
my %pfxmap = (
'' => $dir_prefix,
my %pfxmap = (
'' => $dir_prefix,
- '
,
' => "\$(top_srcdir)${dir_suffix}/",
- '
;
' => "\$(top_srcdir)/",
+ '
^
' => "\$(top_srcdir)${dir_suffix}/",
+ '
~
' => "\$(top_srcdir)/",
);
while (<$input>) {
);
while (<$input>) {
@@
-153,12
+157,12
@@
sub process_input_mk ($$$$$$$$) {
$targets->{$t} //= [ ];
}
elsif (m{^(?=$caps_re)}) { o $var_prefix }
$targets->{$t} //= [ ];
}
elsif (m{^(?=$caps_re)}) { o $var_prefix }
- elsif (s{^([
,;
]?)(?=$lc_re)}{}) { o $pfxmap{$1} }
+ elsif (s{^([
~^
]?)(?=$lc_re)}{}) { o $pfxmap{$1} }
elsif (s{^_}{}) { o $var_prefix }
elsif (s{^=_}{}) { o $var_prefix }
elsif (s{^_}{}) { o $var_prefix }
elsif (s{^=_}{}) { o $var_prefix }
- elsif (s{^([
,;
]?)/}{}) { o $pfxmap{$1} }
+ elsif (s{^([
~^
]?)/}{}) { o $pfxmap{$1} }
elsif (s{^=/}{}) { o $dir_name }
elsif (s{^=/}{}) { o $dir_name }
- elsif (s{^([
,;
]?)(?=[ \t])}{}) {
+ elsif (s{^([
~^
]?)(?=[ \t])}{}) {
my $prefix = $pfxmap{$1} // die;
my $after='';
if (m{([ \t])$esc}) { ($_,$after) = ($`, $1.$'); }
my $prefix = $pfxmap{$1} // die;
my $after='';
if (m{([ \t])$esc}) { ($_,$after) = ($`, $1.$'); }
@@
-254,6
+258,11
@@
sub process_subtree ($$) {
}
print O "\n";
}
}
print O "\n";
}
+ if (@targets) {
+ print O ".PHONY:";
+ print O " ${dir_prefix}${_}" foreach @targets;
+ print O "\n";
+ }
return @targets;
}
return @targets;
}