From 6ca376775ecae19df72324bb8212e70467795450 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 26 Oct 2011 16:06:37 -0700 Subject: [PATCH] Implement automatic dependency generation for manpages. This ensures that manpages actually get rebuilt if any of the lib/*.man fragments that they depend upon are modified. --- Makefile.am | 16 ++- build-aux/sodepends.pl | 70 ++++++++++ manpages.mk | 231 +++++++++++++++++++++++++++++++++ ovsdb/automake.mk | 11 +- ovsdb/ovsdbmonitor/automake.mk | 4 +- utilities/automake.mk | 20 +-- utilities/bugtool/automake.mk | 1 + vswitchd/automake.mk | 7 +- 8 files changed, 338 insertions(+), 22 deletions(-) create mode 100644 build-aux/sodepends.pl create mode 100644 manpages.mk diff --git a/Makefile.am b/Makefile.am index 0e2c6d79..d7144282 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 index 00000000..3cc4c2eb --- /dev/null +++ b/build-aux/sodepends.pl @@ -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 () { + 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 index 00000000..8135a2c8 --- /dev/null +++ b/manpages.mk @@ -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: diff --git a/ovsdb/automake.mk b/ovsdb/automake.mk index b0ee8c9d..3840ffce 100644 --- a/ovsdb/automake.mk +++ b/ovsdb/automake.mk @@ -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 diff --git a/ovsdb/ovsdbmonitor/automake.mk b/ovsdb/ovsdbmonitor/automake.mk index 7e832ef3..59d2e2c7 100644 --- a/ovsdb/ovsdbmonitor/automake.mk +++ b/ovsdb/ovsdbmonitor/automake.mk @@ -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 diff --git a/utilities/automake.mk b/utilities/automake.mk index 2cfdf8e3..420d5fc3 100644 --- a/utilities/automake.mk +++ b/utilities/automake.mk @@ -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 diff --git a/utilities/bugtool/automake.mk b/utilities/bugtool/automake.mk index 5b4a12fe..63762f13 100644 --- a/utilities/bugtool/automake.mk +++ b/utilities/bugtool/automake.mk @@ -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 \ diff --git a/vswitchd/automake.mk b/vswitchd/automake.mk index 1df5dff7..804cf58b 100644 --- a/vswitchd/automake.mk +++ b/vswitchd/automake.mk @@ -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 += \ -- 2.30.2