2,16 → 2,16 |
+++ b/templates/src/Makefile |
@@ -11,7 +11,7 @@ LDFLAGS = $(BASELDFLAGS) |
|
LIB= ../../lib/lib_nossl.a $(BASE_LIBS) |
LIB= ../../lib/lib_nossl.a |
|
-all: template_expand template_compile |
+all: template_expand template_compile template-set.make |
|
template_expand: template_expand_main.o log.o empty.o $(LIB) |
$(CC) $(LDFLAGS) -o template_expand log.o empty.o template_expand_main.o $(LIB) |
$(CC) $(LDFLAGS) -o template_expand log.o empty.o template_expand_main.o $(LIB) $(BASE_LIBS) |
@@ -19,10 +19,28 @@ template_expand: template_expand_main.o |
template_compile: template_compile_main.o log.o empty.o $(LIB) |
$(CC) $(LDFLAGS) -o template_compile log.o empty.o template_compile_main.o $(LIB) |
$(CC) $(LDFLAGS) -o template_compile log.o empty.o template_compile_main.o $(LIB) $(BASE_LIBS) |
|
+template-set.make: template-set.make.in |
+ find_templates () { sed -rn 's/.*template_expand\("([^"]*)".*/\1/p' "$$@" | sort -u; };\ |
38,19 → 38,25 |
|
clean: |
rm -f template_expand template_compile *.o *~ \#*\# |
--- /dev/null |
--- a/templates/src/makedeps.pl |
+++ b/templates/src/makedeps.pl |
@@ -0,0 +1,45 @@ |
+#!/usr/bin/perl |
+# |
+# Generate proper list of dependancies between templates |
+ |
@@ -4,51 +4,44 @@ |
# |
# Generate proper list of dependancies between templates |
|
-%uses = (); |
+my %index = (); |
+my %uses = (); |
+ |
|
-while ($file=shift(@ARGV)) { |
- $file = $1 if ($file =~ /([\w-_]+)\.t/); |
+sub scan { |
+ my ($file) = @_; |
+ |
|
- open(FILE, "<${file}.t") or die "failed to open ${file}: $!\n"; |
- |
- while (<FILE>) { |
- next unless /^%\s+CALL ([\w-_]+)/; |
+ if (!exists $uses{$file}) { |
+ grep { |
+ $_ ne '' and open(FILE, '<', "$_/${file}.t") |
60,29 → 66,60 |
+ $uses{$file}{$1} = 1 if /^%\s+CALL ([\w-_]+)/; |
+ } |
+ close(FILE); |
+ |
|
- $uses{$file} = [] if (not $uses{$file}); |
- push(@{$uses{$file}}, $1); |
+ foreach (keys %{$uses{$file}}) { |
+ $uses{$file}{$_} = 1 foreach keys %{scan($_)}; |
+ } |
+ $uses{$file}{$file} = 1; |
+ $index{$file} = 1; |
+ } |
} |
- |
- close(FILE); |
+ return $uses{$file} |
+} |
+ |
} |
|
-foreach $i (sort keys %uses) { |
- # Sort and uniq |
- @{$uses{$i}} = keys %{{ map { $_ => 1 } sort(@{$uses{$i}}) }}; |
+my $suffix = ''; |
+if ($ARGV[0] eq '--frontend') { |
+ shift; |
+ $suffix = '_frontend'; |
+} |
} |
+my $name = shift; |
+ |
|
-foreach $i (sort keys %uses) { |
- printf("%s.html: %s.t", $i, $i); |
- foreach $j (@{$uses{$i}}) { |
- @list = (); |
- recurse($j, {}, \@list); |
- foreach $k (@list) { |
- printf(" %s.t", $k); |
- } |
- } |
- printf("\n"); |
+$, = ' '; $\ = "\n"; |
+foreach my $i (@ARGV) { |
+ $i =~ s/([\w-_]+)\.t/$1/; |
+ print "$i.html:", map {"$_.t"} sort keys %{scan($i)}; |
+} |
+ |
} |
|
-exit(0); |
- |
-sub recurse { |
- my ($i, $usedref, $listref) = @_; |
- |
- # Remove repeated references to any given template/ |
- return if defined($$usedref{$i}); |
- $$usedref{$i} = 1; |
- |
- push (@{$listref}, $i); |
- foreach $j (@{$uses{$i}}) { |
- recurse($j, $usedref, $listref); |
- } |
-} |
+my @all = sort keys %index; |
+print "_template_index$suffix.c:", map {"$_.t"} @all; |
+print "$name$suffix.so:", "_template_index$suffix.o", map {"$_.o"} @all; |