-EXTRA_DIST += vswitchd/vswitch.ovsidl
-BUILT_SOURCES += vswitchd/vswitch-idl.h
-DISTCLEANFILES += \
- vswitchd/vswitch.ovsidl \
- vswitchd/vswitch-idl.h
-vswitchd/vswitch-idl.h: vswitchd/vswitch.ovsidl ovsdb/ovsdb-idlc
- ovsdb/ovsdb-idlc c-idl-header $(srcdir)/vswitchd/vswitch.ovsidl > $@
+# vswitch schema documentation
+EXTRA_DIST += vswitchd/vswitch.xml
+dist_man_MANS += vswitchd/ovs-vswitchd.conf.db.5
+$(srcdir)/vswitchd/ovs-vswitchd.conf.db.5: \
+ ovsdb/ovsdb-doc.in vswitchd/vswitch.xml vswitchd/vswitch.ovsschema \
+ $(srcdir)/vswitchd/vswitch.pic
+ $(OVSDB_DOC) \
+ --title="ovs-vswitchd.conf.db" \
+ --er-diagram=$(srcdir)/vswitchd/vswitch.pic \
+ $(srcdir)/vswitchd/vswitch.ovsschema \
+ $(srcdir)/vswitchd/vswitch.xml > $@.tmp
+ mv $@.tmp $@
+
+# Version checking for vswitch.ovsschema.
+ALL_LOCAL += vswitchd/vswitch.ovsschema.stamp
+vswitchd/vswitch.ovsschema.stamp: vswitchd/vswitch.ovsschema
+ @sum=`sed '/cksum/d' $? | cksum`; \
+ expected=`sed -n 's/.*"cksum": "\(.*\)".*/\1/p' $?`; \
+ if test "X$$sum" = "X$$expected"; then \
+ touch $@; \
+ else \
+ ln=`sed -n '/"cksum":/=' $?`; \
+ echo >&2 "$?:$$ln: checksum \"$$sum\" does not match (you should probably update the version number and fix the checksum)"; \
+ exit 1; \
+ fi
+CLEANFILES += vswitchd/vswitch.ovsschema.stamp
+
+# Clean up generated files from older OVS versions. (This is important so that
+# #include "vswitch-idl.h" doesn't get the wrong copy.)
+CLEANFILES += vswitchd/vswitch-idl.c vswitchd/vswitch-idl.h