Implement automatic dependency generation for manpages.
authorBen Pfaff <blp@nicira.com>
Wed, 26 Oct 2011 23:06:37 +0000 (16:06 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 26 Oct 2011 23:06:37 +0000 (16:06 -0700)
This ensures that manpages actually get rebuilt if any of the lib/*.man
fragments that they depend upon are modified.

Makefile.am
build-aux/sodepends.pl [new file with mode: 0644]
manpages.mk [new file with mode: 0644]
ovsdb/automake.mk
ovsdb/ovsdbmonitor/automake.mk
utilities/automake.mk
utilities/bugtool/automake.mk
vswitchd/automake.mk

index 0e2c6d797e1946f4f79d4f29ade7ee8d96f9f3e3..d7144282dd30ce4056815f36cef6c7f10b086dab 100644 (file)
@@ -46,8 +46,10 @@ EXTRA_DIST = \
        SubmittingPatches \
        WHY-OVS \
        boot.sh \
+       build-aux/sodepends.pl \
        build-aux/soexpand.pl \
-       $(MAN_FRAGMENTS)
+       $(MAN_FRAGMENTS) \
+       $(MAN_ROOTS)
 bin_PROGRAMS =
 sbin_PROGRAMS =
 bin_SCRIPTS =
@@ -61,6 +63,7 @@ INSTALL_DATA_LOCAL =
 UNINSTALL_LOCAL =
 man_MANS =
 MAN_FRAGMENTS =
+MAN_ROOTS =
 noinst_DATA =
 noinst_HEADERS =
 noinst_LIBRARIES =
@@ -160,6 +163,17 @@ manpage-check: $(MANS) $(MAN_FRAGMENTS)
 CLEANFILES += manpage-check
 endif
 
+include $(srcdir)/manpages.mk
+$(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.pl
+       @$(PERL) $(srcdir)/build-aux/sodepends.pl -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
+       @if cmp -s $(@F).tmp $@; then \
+               touch $@; \
+               rm -f $(@F).tmp; \
+       else \
+               mv $(@F).tmp $@; \
+       fi
+CLEANFILES += manpage-dep-check
+
 dist-hook: $(DIST_HOOKS)
 all-local: $(ALL_LOCAL)
 clean-local: $(CLEAN_LOCAL)
diff --git a/build-aux/sodepends.pl b/build-aux/sodepends.pl
new file mode 100644 (file)
index 0000000..3cc4c2e
--- /dev/null
@@ -0,0 +1,70 @@
+# Copyright (c) 2008, 2011 Nicira Networks.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+use strict;
+use warnings;
+use Getopt::Long;
+
+our ($exit_code) = 0;
+
+our (@include_dirs);
+Getopt::Long::Configure ("bundling");
+GetOptions("I|include=s" => \@include_dirs) or exit(1);
+@include_dirs = ('.') if !@include_dirs;
+
+sub find_file {
+    my ($name) = @_;
+    foreach my $dir (@include_dirs, '.') {
+        my $file = "$dir/$name";
+        if (stat($file)) {
+            return $file;
+        }
+    }
+    print STDERR "$name not found in: ", join(' ', @include_dirs), "\n";
+    $exit_code = 1;
+    return;
+}
+
+print "# Generated automatically -- do not modify!    -*- buffer-read-only: t -*-\n";
+for my $toplevel (sort(@ARGV)) {
+    # Skip names that don't end in .in.
+    next if $toplevel !~ /\.in$/;
+
+    # Open file.
+    my ($fn) = find_file($toplevel);
+    next if !defined($fn);
+    if (!open(OUTER, '<', $fn)) {
+        print "$fn: open: $!\n";
+        $exit_code = 1;
+        next;
+    }
+
+    my (@dependencies);
+  OUTER:
+    while (<OUTER>) {
+        if (my ($name) = /^\.so (\S+)$/) {
+            push(@dependencies, $name) if find_file($name);
+        }
+    }
+    close(OUTER);
+
+    my ($output) = $toplevel;
+    $output =~ s/\.in//;
+
+    print "\n$output:";
+    print " \\\n\t$_" foreach $toplevel, sort(@dependencies);
+    print "\n";
+    print "$_:\n" foreach $toplevel, sort(@dependencies);
+}
+exit $exit_code;
diff --git a/manpages.mk b/manpages.mk
new file mode 100644 (file)
index 0000000..8135a2c
--- /dev/null
@@ -0,0 +1,231 @@
+# Generated automatically -- do not modify!    -*- buffer-read-only: t -*-
+
+ovsdb/ovsdb-client.1: \
+       ovsdb/ovsdb-client.1.in \
+       lib/common-syn.man \
+       lib/common.man \
+       lib/daemon-syn.man \
+       lib/daemon.man \
+       lib/ssl-bootstrap-syn.man \
+       lib/ssl-bootstrap.man \
+       lib/ssl-syn.man \
+       lib/ssl.man \
+       lib/table.man \
+       lib/vlog-syn.man \
+       lib/vlog.man \
+       ovsdb/remote-active.man \
+       ovsdb/remote-passive.man
+ovsdb/ovsdb-client.1.in:
+lib/common-syn.man:
+lib/common.man:
+lib/daemon-syn.man:
+lib/daemon.man:
+lib/ssl-bootstrap-syn.man:
+lib/ssl-bootstrap.man:
+lib/ssl-syn.man:
+lib/ssl.man:
+lib/table.man:
+lib/vlog-syn.man:
+lib/vlog.man:
+ovsdb/remote-active.man:
+ovsdb/remote-passive.man:
+
+ovsdb/ovsdb-server.1: \
+       ovsdb/ovsdb-server.1.in \
+       lib/common-syn.man \
+       lib/common.man \
+       lib/daemon-syn.man \
+       lib/daemon.man \
+       lib/ssl-bootstrap-syn.man \
+       lib/ssl-bootstrap.man \
+       lib/ssl-syn.man \
+       lib/ssl.man \
+       lib/stress-unixctl.man \
+       lib/unixctl-syn.man \
+       lib/unixctl.man \
+       lib/vlog-syn.man \
+       lib/vlog-unixctl.man \
+       lib/vlog.man \
+       ovsdb/remote-active.man \
+       ovsdb/remote-passive.man
+ovsdb/ovsdb-server.1.in:
+lib/common-syn.man:
+lib/common.man:
+lib/daemon-syn.man:
+lib/daemon.man:
+lib/ssl-bootstrap-syn.man:
+lib/ssl-bootstrap.man:
+lib/ssl-syn.man:
+lib/ssl.man:
+lib/stress-unixctl.man:
+lib/unixctl-syn.man:
+lib/unixctl.man:
+lib/vlog-syn.man:
+lib/vlog-unixctl.man:
+lib/vlog.man:
+ovsdb/remote-active.man:
+ovsdb/remote-passive.man:
+
+ovsdb/ovsdb-tool.1: \
+       ovsdb/ovsdb-tool.1.in \
+       lib/common-syn.man \
+       lib/common.man \
+       lib/vlog-syn.man \
+       lib/vlog.man
+ovsdb/ovsdb-tool.1.in:
+lib/common-syn.man:
+lib/common.man:
+lib/vlog-syn.man:
+lib/vlog.man:
+
+utilities/ovs-appctl.8: \
+       utilities/ovs-appctl.8.in \
+       lib/common.man
+utilities/ovs-appctl.8.in:
+lib/common.man:
+
+utilities/ovs-benchmark.1: \
+       utilities/ovs-benchmark.1.in
+utilities/ovs-benchmark.1.in:
+
+utilities/ovs-controller.8: \
+       utilities/ovs-controller.8.in \
+       lib/common.man \
+       lib/daemon.man \
+       lib/ssl-peer-ca-cert.man \
+       lib/ssl.man \
+       lib/unixctl.man \
+       lib/vconn-active.man \
+       lib/vconn-passive.man \
+       lib/vlog.man
+utilities/ovs-controller.8.in:
+lib/common.man:
+lib/daemon.man:
+lib/ssl-peer-ca-cert.man:
+lib/ssl.man:
+lib/unixctl.man:
+lib/vconn-active.man:
+lib/vconn-passive.man:
+lib/vlog.man:
+
+utilities/ovs-dpctl.8: \
+       utilities/ovs-dpctl.8.in \
+       lib/common.man \
+       lib/vlog.man
+utilities/ovs-dpctl.8.in:
+lib/common.man:
+lib/vlog.man:
+
+utilities/ovs-ofctl.8: \
+       utilities/ovs-ofctl.8.in \
+       lib/common.man \
+       lib/ssl.man \
+       lib/vconn-active.man \
+       lib/vlog.man
+utilities/ovs-ofctl.8.in:
+lib/common.man:
+lib/ssl.man:
+lib/vconn-active.man:
+lib/vlog.man:
+
+utilities/ovs-pcap.1: \
+       utilities/ovs-pcap.1.in \
+       lib/common-syn.man \
+       lib/common.man
+utilities/ovs-pcap.1.in:
+lib/common-syn.man:
+lib/common.man:
+
+utilities/ovs-pki.8: \
+       utilities/ovs-pki.8.in
+utilities/ovs-pki.8.in:
+
+utilities/ovs-tcpundump.1: \
+       utilities/ovs-tcpundump.1.in \
+       lib/common-syn.man \
+       lib/common.man
+utilities/ovs-tcpundump.1.in:
+lib/common-syn.man:
+lib/common.man:
+
+utilities/ovs-vlan-bug-workaround.8: \
+       utilities/ovs-vlan-bug-workaround.8.in \
+       lib/common.man \
+       utilities/ovs-vlan-bugs.man
+utilities/ovs-vlan-bug-workaround.8.in:
+lib/common.man:
+utilities/ovs-vlan-bugs.man:
+
+utilities/ovs-vlan-test.8: \
+       utilities/ovs-vlan-test.8.in \
+       lib/common-syn.man \
+       lib/common.man \
+       utilities/ovs-vlan-bugs.man
+utilities/ovs-vlan-test.8.in:
+lib/common-syn.man:
+lib/common.man:
+utilities/ovs-vlan-bugs.man:
+
+utilities/ovs-vsctl.8: \
+       utilities/ovs-vsctl.8.in \
+       lib/ssl-bootstrap.man \
+       lib/ssl-peer-ca-cert.man \
+       lib/ssl.man \
+       lib/table.man \
+       lib/vconn-active.man \
+       lib/vconn-passive.man \
+       lib/vlog.man \
+       ovsdb/remote-active.man \
+       ovsdb/remote-active.man \
+       ovsdb/remote-passive.man \
+       ovsdb/remote-passive.man
+utilities/ovs-vsctl.8.in:
+lib/ssl-bootstrap.man:
+lib/ssl-peer-ca-cert.man:
+lib/ssl.man:
+lib/table.man:
+lib/vconn-active.man:
+lib/vconn-passive.man:
+lib/vlog.man:
+ovsdb/remote-active.man:
+ovsdb/remote-active.man:
+ovsdb/remote-passive.man:
+ovsdb/remote-passive.man:
+
+vswitchd/ovs-brcompatd.8: \
+       vswitchd/ovs-brcompatd.8.in \
+       lib/common.man \
+       lib/daemon.man \
+       lib/leak-checker.man \
+       lib/vlog.man
+vswitchd/ovs-brcompatd.8.in:
+lib/common.man:
+lib/daemon.man:
+lib/leak-checker.man:
+lib/vlog.man:
+
+vswitchd/ovs-vswitchd.8: \
+       vswitchd/ovs-vswitchd.8.in \
+       lib/common.man \
+       lib/daemon.man \
+       lib/leak-checker.man \
+       lib/ssl-bootstrap.man \
+       lib/ssl.man \
+       lib/stress-unixctl.man \
+       lib/vlog-unixctl.man \
+       lib/vlog.man \
+       ofproto/ofproto-unixctl.man \
+       ovsdb/remote-active.man \
+       ovsdb/remote-passive.man
+vswitchd/ovs-vswitchd.8.in:
+lib/common.man:
+lib/daemon.man:
+lib/leak-checker.man:
+lib/ssl-bootstrap.man:
+lib/ssl.man:
+lib/stress-unixctl.man:
+lib/vlog-unixctl.man:
+lib/vlog.man:
+ofproto/ofproto-unixctl.man:
+ovsdb/remote-active.man:
+ovsdb/remote-passive.man:
index b0ee8c9d70b19e16c20170f9f3f5341b3d32d454..3840ffce894f02f3a12639e32ebeb15a56d56252 100644 (file)
@@ -40,7 +40,7 @@ ovsdb_ovsdb_tool_LDADD = ovsdb/libovsdb.a lib/libopenvswitch.a
 # ovsdb-tool.1
 man_MANS += ovsdb/ovsdb-tool.1
 DISTCLEANFILES += ovsdb/ovsdb-tool.1
-EXTRA_DIST += ovsdb/ovsdb-tool.1.in
+MAN_ROOTS += ovsdb/ovsdb-tool.1.in
 
 # ovsdb-client
 bin_PROGRAMS += ovsdb/ovsdb-client
@@ -49,7 +49,7 @@ ovsdb_ovsdb_client_LDADD = ovsdb/libovsdb.a lib/libopenvswitch.a $(SSL_LIBS)
 # ovsdb-client.1
 man_MANS += ovsdb/ovsdb-client.1
 DISTCLEANFILES += ovsdb/ovsdb-client.1
-EXTRA_DIST += ovsdb/ovsdb-client.1.in
+MAN_ROOTS += ovsdb/ovsdb-client.1.in
 
 # ovsdb-server
 sbin_PROGRAMS += ovsdb/ovsdb-server
@@ -58,14 +58,13 @@ ovsdb_ovsdb_server_LDADD = ovsdb/libovsdb.a lib/libopenvswitch.a $(SSL_LIBS)
 # ovsdb-server.1
 man_MANS += ovsdb/ovsdb-server.1
 DISTCLEANFILES += ovsdb/ovsdb-server.1
-EXTRA_DIST += ovsdb/ovsdb-server.1.in
+MAN_ROOTS += ovsdb/ovsdb-server.1.in
 
 # ovsdb-idlc
 EXTRA_DIST += ovsdb/SPECS
 noinst_SCRIPTS += ovsdb/ovsdb-idlc
-EXTRA_DIST += \
-       ovsdb/ovsdb-idlc.in \
-       ovsdb/ovsdb-idlc.1
+EXTRA_DIST += ovsdb/ovsdb-idlc.in
+MAN_ROOTS += ovsdb/ovsdb-idlc.1
 DISTCLEANFILES += ovsdb/ovsdb-idlc
 SUFFIXES += .ovsidl .ovsschema
 OVSDB_IDLC = $(run_python) $(srcdir)/ovsdb/ovsdb-idlc.in
index 7e832ef3d3f7e62d3b64fbd2418c330735256304..59d2e2c7aa6630442392b439ba0bdfc60bc4d72a 100644 (file)
@@ -25,8 +25,8 @@ EXTRA_DIST += \
        ovsdb/ovsdbmonitor/HostWindow.ui \
        ovsdb/ovsdbmonitor/LogWindow.ui \
        ovsdb/ovsdbmonitor/MainWindow.ui \
-       ovsdb/ovsdbmonitor/ovsdbmonitor.in \
-       ovsdb/ovsdbmonitor/ovsdbmonitor.1
+       ovsdb/ovsdbmonitor/ovsdbmonitor.in
+MAN_ROOTS += ovsdb/ovsdbmonitor/ovsdbmonitor.1
 
 ovsdbmonitordir = ${pkgdatadir}/ovsdbmonitor
 if BUILD_OVSDBMONITOR
index 2cfdf8e33673fbdf4c9a19da2116aa9cd406a33b..420d5fc31b151a7bb3b7b54e01a4e1a7d37fd194 100644 (file)
@@ -15,24 +15,26 @@ noinst_SCRIPTS += utilities/ovs-pki-cgi
 scripts_SCRIPTS += utilities/ovs-ctl utilities/ovs-lib.sh utilities/ovs-save
 
 EXTRA_DIST += \
+       utilities/ovs-ctl.in \
+       utilities/ovs-lib.sh.in \
+       utilities/ovs-parse-leaks.in \
+       utilities/ovs-pcap.in \
+       utilities/ovs-pki-cgi.in \
+       utilities/ovs-pki.in \
+       utilities/ovs-save \
+       utilities/ovs-tcpundump.in \
+       utilities/ovs-vlan-test.in
+MAN_ROOTS += \
        utilities/ovs-appctl.8.in \
        utilities/ovs-benchmark.1.in \
        utilities/ovs-controller.8.in \
-       utilities/ovs-ctl.in \
+       utilities/ovs-ctl.8 \
        utilities/ovs-dpctl.8.in \
-       utilities/ovs-lib.sh.in \
        utilities/ovs-ofctl.8.in \
        utilities/ovs-parse-leaks.8 \
-       utilities/ovs-parse-leaks.in \
        utilities/ovs-pcap.1.in \
-       utilities/ovs-pcap.in \
-       utilities/ovs-pki-cgi.in \
        utilities/ovs-pki.8.in \
-       utilities/ovs-pki.in \
-       utilities/ovs-save \
        utilities/ovs-tcpundump.1.in \
-       utilities/ovs-tcpundump.in \
-       utilities/ovs-vlan-test.in \
        utilities/ovs-vlan-bug-workaround.8.in \
        utilities/ovs-vlan-test.8.in \
        utilities/ovs-vsctl.8.in
index 5b4a12feb6e8d13e32ba0f984d58f761fc9b6a1d..63762f13301e5592792afb0174f00003806f1270 100644 (file)
@@ -2,6 +2,7 @@ if HAVE_PYTHON
 sbin_SCRIPTS += utilities/bugtool/ovs-bugtool
 CLEANFILES += utilities/bugtool/ovs-bugtool
 man_MANS += utilities/bugtool/ovs-bugtool.8
+MAN_ROOTS += utilities/bugtool/ovs-bugtool.8
 
 bugtool_plugins = \
        utilities/bugtool/plugins/kernel-info/openvswitch.xml \
index 1df5dff79da6ec9bc22541d38c6466ec77f23ad8..804cf58b84487b316fba07d54927b05713cd35c5 100644 (file)
@@ -21,9 +21,8 @@ vswitchd_ovs_vswitchd_LDADD = \
        lib/libsflow.a \
        lib/libopenvswitch.a \
        $(SSL_LIBS)
-EXTRA_DIST += \
-       vswitchd/ovs-vswitchd.8.in \
-       vswitchd/INTERNALS
+EXTRA_DIST += vswitchd/INTERNALS
+MAN_ROOTS += vswitchd/ovs-vswitchd.8.in
 
 if HAVE_NETLINK
 sbin_PROGRAMS += vswitchd/ovs-brcompatd
@@ -33,7 +32,7 @@ vswitchd_ovs_brcompatd_SOURCES = \
        vswitchd/vswitch-idl.h
 vswitchd_ovs_brcompatd_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
 endif
-EXTRA_DIST += vswitchd/ovs-brcompatd.8.in
+MAN_ROOTS += vswitchd/ovs-brcompatd.8.in
 
 # vswitch schema and IDL
 OVSIDL_BUILT += \