fix debian compile of new libcitadel version
[citadel.git] / libcitadel / debian / rules
index 8cb082d473070ad3a3e64affb57c27424b9d7576..11d290b9cba6fa94cce44cfaefd5f5bd329b1619 100755 (executable)
@@ -9,20 +9,39 @@ export DH_COMPAT = 5
 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 
-CFLAGS = -Wall -g
-
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-  CFLAGS += -O0
+CFLAGS = -Wall -g  -Wformat -Werror=format-security
+#-finline-functions
+LDFALGS =
+# -finline-functions
+ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -O0 -ggdb -rdynamic -MD -MP -D DEBUG -D VALGRIND
+       EXTRA_ARGS =  --with-backtrace
 else
-  CFLAGS += -O2 -fno-strict-aliasing
+#      CFLAGS += -O2 -fPIC
+       CFLAGS += -O0 -ggdb -rdynamic -MD -MP -D DEBUG -D VALGRIND
+endif
+
+ifneq (,$(findstring profiling,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -pg
+       LDFLAGS += -pg
+endif
+
+ifneq (,$(findstring sprofiling,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -D SIZE_DEBUG
+endif
+
+ifneq (,$(findstring gcov,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -fprofile-arcs -ftest-coverage
+       LDFLAGS += -fprofile-arcs -ftest-coverage
 endif
 
+
 build: build-stamp
 build-stamp:
        dh_testdir
 
-# ./configure
-       CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
+       export CFLAGS="$(CFLAGS)"; export LDFLAGS="$(LDFLAGS)";  ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
+               $(EXTRA_ARGS) \
                --prefix=/usr
 
 # Build libcitadel
@@ -35,7 +54,7 @@ clean:
        dh_testroot
        rm -f build-stamp install*-stamp
 
-       -$(MAKE) distclean
+       [ ! -f Makefile ] || $(MAKE) distclean
 
        dh_clean
 
@@ -52,33 +71,33 @@ install-stamp: build-stamp
 
 # Build architecture-independent files here.
 binary-indep: build install
-       dh_testdir -i
+#      dh_testdir -i
        dh_testroot -i
-       dh_installdocs -i -A README
-       dh_installchangelogs -i debian/no-upstream-changelog
-       dh_install -i --sourcedir=debian/tmp
-       dh_link -i
-       dh_strip -i
-       dh_compress -i
-       dh_fixperms -i
-       dh_installdeb -i
-       dh_shlibdeps -i
-       dh_gencontrol -i
-       dh_md5sums -i
-       dh_builddeb -i
+#      dh_installdocs -i -A README
+#      dh_installchangelogs -i debian/no-upstream-changelog
+#      dh_install -i --sourcedir=debian/tmp
+#      dh_link -i
+#      dh_strip -i
+#      dh_compress -i
+#      dh_fixperms -i
+#      dh_installdeb -i
+#      dh_shlibdeps -i
+#      dh_gencontrol -i
+#      dh_md5sums -i
+#      dh_builddeb -i
 
 # Build architecture-dependent files here.
 binary-arch: build install
        dh_testdir -a
        dh_testroot -a
-#      dh_installdocs -plibcitadel1
-       dh_installchangelogs -plibcitadel
+       dh_installchangelogs -a -plibcitadel4
+       dh_installdocs -a
        dh_install -a --sourcedir=debian/tmp
        dh_link -a
-       dh_strip -a --dbg-package=libcitadel1-dbg
+       dh_strip -a --dbg-package=libcitadel4-dbg
        dh_compress -a
        dh_fixperms -a
-       dh_makeshlibs -a -V 'libcitadel1'
+       dh_makeshlibs -a -V
        dh_installdeb -a
        dh_shlibdeps -a
        dh_gencontrol -a