gstdoc-scangobj: use /usr/bin/env perl instead of hard-coding /usr/bin/perl
[platform/upstream/gst-common.git] / win32.mak
index 4da4760..94afaec 100644 (file)
--- a/win32.mak
+++ b/win32.mak
@@ -1,22 +1,31 @@
 # various tests to make sure we dist the win32 stuff (for MSVC builds) right
 
+# the MANIFEST contains all win32 related files that should be disted
 win32 = $(shell cat $(top_srcdir)/win32/MANIFEST)
 
-# wildcard is apparently not portable to other makes
+# wildcard is apparently not portable to other makes, hence the use of find
+# these are library .def files with the symbols to export
 win32defs = $(shell find $(top_srcdir)/win32/common -name '*.def')
 
+# wildcard is apparently not portable to other makes, hence the use of find
+# these are files that need to be disted with CRLF line endings:
+win32crlf = $(shell find $(top_srcdir)/win32 -name '*.dsw' -o -name '*.dsp')
+
 win32-debug:
        @echo; \
        echo win32     = $(win32); \
        echo; \
        echo win32defs = $(win32defs); \
+       echo; \
+       echo win32crlf = $(win32crlf); \
        echo
 
-# FIXME: this doesn't seem to work right yet
 win32-check-crlf:
+       @echo Checking win32 files for CR LF line endings ...; \
        fail=0 ; \
-       for each in $(win32); do \
-         if ! (file $$each | grep CRLF >/dev/null) ; then \
+       for each in $(win32crlf) ; do \
+         result=`perl -e 'print grep(/\r\n/,<>)' "$$each" | wc -l`; \
+         if test "$$result" = 0 ; then \
            echo $$each must be fixed to have CRLF line endings ; \
            fail=1; \
          fi ; \
@@ -27,10 +36,10 @@ win32-check-crlf:
 # (don't care about other unixes for now, it's enough if it works on one of
 # the linux build bots; we assume .so )
 check-exports:
-       fail=0 ; \
+       @fail=0 ; \
        for l in $(win32defs); do \
          libbase=`basename "$$l" ".def"`; \
-         libso=`find "$(top_builddir)" -name "$$libbase-0.10.so"`; \
+         libso=`find "$(top_builddir)" -name "$$libbase-@GST_MAJORMINOR@.so" | grep -v /_build/ | head -n1`; \
          libdef="$(top_srcdir)/win32/common/$$libbase.def"; \
          if test "x$$libso" != "x"; then \
            echo Checking symbols in $$libso; \
@@ -38,9 +47,26 @@ check-exports:
              fail=1; \
            fi; \
          fi; \
-       done
+       done ; \
+       if test $$fail != 0; then \
+         echo '-----------------------------------------------------------'; \
+         echo 'Run this to update the .def files:'; \
+         echo 'make check-exports 2>&1 | patch -p1'; \
+         echo '-----------------------------------------------------------'; \
+       fi; \
+       exit $$fail
 
+# complain about nonportable printf format strings (%lld, %llu, %zu etc.)
+check-nonportable-print-format:
+       @fail=0 ; \
+       loc=`find "$(top_srcdir)" -name '*.c' | xargs grep -n -e '%[0-9]*ll[udx]' -e '%[0-9]*z[udx]'`; \
+       if test "x$$loc" != "x"; then \
+         echo "Please fix the following print format strings:" ; \
+         find "$(top_srcdir)" -name '*.c' | xargs grep -n -e '%[0-9]*ll[udx]' -e '%[0-9]*z[udx]'; \
+         fail=1; \
+       fi; \
+       exit $$fail
 
-dist-hook: check-exports
+dist-hook: check-exports win32-check-crlf