diff options
| author | Ben Pfaff <blp@nicira.com> | 2010-12-06 09:56:38 -0800 |
|---|---|---|
| committer | Ben Pfaff <blp@nicira.com> | 2010-12-06 09:56:38 -0800 |
| commit | 7c9b00732c633ddd35b9d92fb9fa4c4f8e3ce390 (patch) | |
| tree | 70adfddc161eef5993d64bf2153414d87e394d23 /vswitchd/automake.mk | |
| parent | 4230c966859179d706dfd8d68a8fe7641c59e914 (diff) | |
| download | openvswitch-7c9b00732c633ddd35b9d92fb9fa4c4f8e3ce390.tar.gz | |
docs: Only regenerate vswitch.pic when the schema really changes.
Until now, vswitch.pic has been rebuilt whenever the schema changed. This
is OK when the E-R diagram would really change, but many changes to the
schema don't change the E-R diagram, and it surprises people when
vswitch.pic changes in such a situation. This commit fixes the problem.
Requested-by: Justin Pettit <jpettit@nicira.com>
Diffstat (limited to 'vswitchd/automake.mk')
| -rw-r--r-- | vswitchd/automake.mk | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/vswitchd/automake.mk b/vswitchd/automake.mk index 6ef776349..4c3c07622 100644 --- a/vswitchd/automake.mk +++ b/vswitchd/automake.mk @@ -49,19 +49,36 @@ vswitchd/vswitch-idl.ovsidl: $(VSWITCH_IDL_FILES) mv $@.tmp $@ # vswitch E-R diagram -if BUILD_ER_DIAGRAMS -$(srcdir)/vswitchd/vswitch.pic: ovsdb/ovsdb-dot.in ovsdb/dot2pic \ - vswitchd/vswitch.ovsschema - $(OVSDB_DOT) $(srcdir)/vswitchd/vswitch.ovsschema \ - | dot -T plain \ - | $(srcdir)/ovsdb/dot2pic \ - > $@.tmp - mv $@.tmp $@ +# +# There are two complications here. First, if "python" or "dot" is not +# available, then we have to just use the existing diagram. Second, different +# "dot" versions produce slightly different output for the same input, but we +# don't want to gratuitously change vswitch.pic if someone tweaks the schema in +# some minor way that doesn't affect the table structure. To avoid that we +# store a checksum of vswitch.gv in vswitch.pic and only regenerate vswitch.pic +# if vswitch.gv actually changes. +$(srcdir)/vswitchd/vswitch.gv: ovsdb/ovsdb-dot.in vswitchd/vswitch.ovsschema +if HAVE_PYTHON + $(OVSDB_DOT) $(srcdir)/vswitchd/vswitch.ovsschema > $@ +else + touch $@ +endif +$(srcdir)/vswitchd/vswitch.pic: $(srcdir)/vswitchd/vswitch.gv ovsdb/dot2pic +if HAVE_DOT + sum=`cksum < $(srcdir)/vswitchd/vswitch.gv`; \ + if grep "$$sum" $@ >/dev/null 2>&1; then \ + echo "vswitch.gv unchanged, not regenerating vswitch.pic"; \ + touch $@; \ + else \ + echo "regenerating vswitch.pic"; \ + (echo ".\\\" Generated from vswitch.gv with cksum \"$$sum\""; \ + dot -T plain < $(srcdir)/vswitchd/vswitch.gv \ + | $(srcdir)/ovsdb/dot2pic) > $@; \ + fi else -$(srcdir)/vswitchd/vswitch.pic: ovsdb/ovsdb-dot.in vswitchd/vswitch.ovsschema touch $@ endif -EXTRA_DIST += vswitchd/vswitch.pic +EXTRA_DIST += vswitchd/vswitch.gv vswitchd/vswitch.pic # vswitch schema documentation EXTRA_DIST += vswitchd/vswitch.xml |
