debian: Avoid -Wformat-zero-length warnings.
[cascardo/ovs.git] / debian / rules
index d34bdb3..081f24a 100755 (executable)
@@ -29,6 +29,19 @@ else
 CFLAGS += -O2
 endif
 
+# Old versions of dpkg-buildflags do not understand --export=configure.
+# When dpkg-buildflags does not understand an option, it prints its full
+# --help output on stdout, so we have to avoid that here.
+buildflags := $(shell if dpkg-buildflags --export=configure >/dev/null 2>&1; \
+                     then dpkg-buildflags --export=configure; fi)
+
+# dpkg-buildflags tends to turn on -Wformat, which is admirable, but
+# the -Wformat-zero-length subset of that option triggers a couple of
+# false positives in Open vSwitch so turn it right back off again.
+# (We do this in configure.ac also, but the Debian buildflags override
+# those.)
+buildflags := $(patsubst -Wformat,-Wformat -Wno-format-zero-length,$(buildflags))
+
 configure: configure-stamp
 configure-stamp:
        dh_testdir
@@ -40,7 +53,7 @@ configure-stamp:
                test -e Makefile || \
                ../configure --prefix=/usr --localstatedir=/var --enable-ssl \
                        --sysconfdir=/etc CFLAGS="$(CFLAGS)" \
-                       $(DATAPATH_CONFIGURE_OPTS))
+                       $(buildflags) $(DATAPATH_CONFIGURE_OPTS))
        touch configure-stamp
 
 #Architecture 
@@ -50,7 +63,8 @@ build-arch: build-arch-stamp
 build-arch-stamp: configure-stamp 
        $(MAKE) -C _debian
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
-       if $(MAKE) -C _debian check TESTSUITEFLAGS='$(PARALLEL)'; then :; \
+       if $(MAKE) -C _debian check TESTSUITEFLAGS='$(PARALLEL)' || \
+               $(MAKE) -C _debian check TESTSUITEFLAGS='--recheck'; then :; \
        else \
                cat _debian/tests/testsuite.log; \
                exit 1; \
@@ -101,7 +115,6 @@ install-indep: build-indep
        # And we should also clean useless license files, which are already
        # descriped in our debian/copyright anyway.
        rm -f debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/COPYING \
-               debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/ovsdb/ovsdbmonitor/COPYING \
                debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/xenserver/LICENSE
 
 install-arch: build-arch