after fixing the repo corruption, turn on maximum hardening flags as a bonus level...
[alioth/cvs.git] / debian / rules
index b3b7ff4..b08d5a4 100755 (executable)
@@ -1,37 +1,37 @@
 #!/usr/bin/make -f
-# $MirOS: contrib/hosted/tg/deb/cvs/debian/rules,v 1.16 2011/12/04 15:18:36 tg Exp $
-#-
-# -*- makefile -*-
-# Sample debian/rules that uses debhelper.
-# This file was originally written by Joey Hess and Craig Small.
-# As a special exception, when this file is copied by dh-make into a
-# dh-make output file, you may use that output file without restriction.
-# This special exception was added by Craig Small in version 0.37 of dh-make.
-
-SHELL?=                sh
-CC?=           gcc
-CFLAGS=                -Wall -g
-
-ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
-CFLAGS+=       -O0
+# $MirOS: contrib/hosted/tg/deb/cvs/debian/rules,v 1.17 2012/02/07 22:38:36 tg Exp $
+
+CC?=                   gcc
+CONFIGURE_ENV:=                CC='${CC}'
+EXTRA_CFLAGS=          -Wall -fno-strict-aliasing -Wformat
+# for now. uses are mostly checked.
+EXTRA_CFLAGS+=         -Wno-unused-result
+EXTRA_CPPFLAGS=                -D_GNU_SOURCE -DUSE_LIBBSD
+
+ifneq (,$(wildcard /usr/share/dpkg/buildflags.mk))
+# dpkg-dev (>= 1.16.1~)
+DEB_CFLAGS_MAINT_APPEND=${EXTRA_CFLAGS}
+DEB_CPPFLAGS_MAINT_APPEND=${EXTRA_CPPFLAGS}
+DEB_BUILD_MAINT_OPTIONS=hardening=+all
+DPKG_EXPORT_BUILDFLAGS=        Yes
+include /usr/share/dpkg/buildflags.mk
 else
-CFLAGS+=       -O2
+# old-fashioned way to determine build flags
+CFLAGS=                        -O$(if $(findstring noopt,${DEB_BUILD_OPTIONS}),0,2) -g
+CFLAGS+=               ${EXTRA_CFLAGS}
+CPPFLAGS+=             ${EXTRA_CPPFLAGS}
+CONFIGURE_ENV+=                CFLAGS='${CFLAGS}'
+CONFIGURE_ENV+=                CPPFLAGS='${CPPFLAGS}'
+CONFIGURE_ENV+=                LDFLAGS='${LDFLAGS}'
 endif
 
 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
-NUMJOBS=       $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
-MAKEFLAGS+=    -j${NUMJOBS}
+NUMJOBS=               $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+MAKEFLAGS+=            -j${NUMJOBS}
 endif
 
-CPPFLAGS+=     -D_GNU_SOURCE
-CFLAGS+=       -fno-strict-aliasing -Wformat
+LIBS+=                 -lbsd
 
-CPPFLAGS+=     -DUSE_LIBBSD
-LIBS+=         -lbsd
-
-CONFIGURE_ENV:=                CC='${CC}'
-CONFIGURE_ENV+=                CFLAGS='${CFLAGS}'
-CONFIGURE_ENV+=                CPPFLAGS='${CPPFLAGS}'
 CONFIGURE_ENV+=                LIBS='${LIBS}'
 CONFIGURE_ENV+=                CSH=/bin/csh
 
@@ -98,7 +98,9 @@ clean:
        -rm -rf ${CLEANFILES}
        dh_clean
 
-debian/.install_stamp: debian/.build_stamp
+binary-indep:
+
+binary-arch: debian/.build_stamp
        dh_testdir
        dh_testroot
        if test -x "$$(which dh_prep)"; then dh_prep; else dh_clean -k; fi
@@ -130,13 +132,6 @@ debian/.install_stamp: debian/.build_stamp
        rm -f debian/stagedir/usr/share/cvs/contrib/rcslock
        # we ship cvs-switchroot(1) instead
        rm -f debian/stagedir/usr/share/cvs/contrib/newcvsroot
-       @:>$@
-
-binary-indep:
-
-binary-arch: build debian/.install_stamp
-       dh_testdir
-       dh_testroot
        dh_installchangelogs debian/stagedir/clogs/ChangeLog
        dh_installdocs
        dh_install