summaryrefslogtreecommitdiff
path: root/tools/progdoc
diff options
context:
space:
mode:
authorJan Moskyto Matejka <mq@ucw.cz>2016-04-12 11:14:54 +0200
committerJan Moskyto Matejka <mq@ucw.cz>2016-05-10 14:07:34 +0200
commit7152e5efbb0fade868d5f2d2c7bc10ed52b3d19d (patch)
treeebb3ff35e34cdf37c0757e0aa6a6e8de30a71278 /tools/progdoc
parent4bdf1881dc6230b742d7efcaad8eeac4ed25f445 (diff)
Build system reworked to one global Makefile with includes and no nesting
Also removed the lib-dir merging with sysdep. Updated #include's accordingly. Fixed make doc on recent Debian together with moving generated doc into objdir. Moved Makefile.in into root dir Retired all.o and birdlib.a Linking the final binaries directly from all the .o files.
Diffstat (limited to 'tools/progdoc')
-rwxr-xr-xtools/progdoc33
1 files changed, 26 insertions, 7 deletions
diff --git a/tools/progdoc b/tools/progdoc
index ef44d3aa..fc4024bf 100755
--- a/tools/progdoc
+++ b/tools/progdoc
@@ -1,17 +1,18 @@
#!/usr/bin/perl
$srcdir = $ARGV[0];
+$out = $ARGV[1];
-open(OUT, ">prog.sgml") || die "Cannot create output file";
-include("doc/prog-head.sgml");
-process("");
-include("doc/prog-foot.sgml");
+open(OUT, ">", $out) || die "Cannot create output file";
+process($srcdir);
close OUT;
+gen_deps();
exit 0;
sub include {
my $f = shift @_;
- open(IN, "$srcdir/$f") || die "Unable to find $f";
+ open(IN, "$f") || die "Unable to find $f";
+ push(@deps, "$f");
while (<IN>) {
print OUT;
}
@@ -21,7 +22,8 @@ sub include {
sub process {
my $dir = shift @_;
print "$dir/Doc\n";
- open(IN, "$srcdir/$dir/Doc") || die "Unable to read $dir/Doc";
+ open(IN, "$dir/Doc") || die "Unable to read $dir/Doc";
+ push(@deps, "$dir/Doc");
my @docfile = <IN>;
close IN;
foreach $_ (@docfile) {
@@ -36,7 +38,10 @@ sub process {
print OUT "<chapt>$arg\n";
} elsif ($cmd eq "S") {
print " $arg\n";
- open(DOC, "cd $srcdir/$dir ; $srcdir/doc/kernel-doc -bird $arg |") || die "Unable to start kernel-doc";
+ my @files = map("$dir/$_", split(' ', $arg));
+ my $fargs = join(' ', @files);
+ open(DOC, "$srcdir/doc/kernel-doc -bird $fargs |") || die "Unable to start kernel-doc";
+ push(@deps, @files);
while (<DOC>) { print OUT; }
close DOC;
} elsif ($cmd eq "D") {
@@ -45,3 +50,17 @@ sub process {
} else { die "Unknown command: $cmd"; }
}
}
+
+sub gen_deps {
+ open(DEP, ">", "$out.d");
+ print DEP "$out:";
+ foreach $f (@deps) {
+ print DEP " \\\n $f";
+ }
+ print DEP "\n\n";
+
+ foreach $f (@deps) {
+ print DEP "$f:\n\n";
+ }
+ close DEP;
+}