Code

rules: Use dpkg-buildflags to get build flags.
[pkg-pfstools.git] / debian / rules
index 06c0f3e1587f8f122dfb4b834c8245ae4087283a..3b8f4f0210e8e4b74a4daf7449357bec3ce179f9 100755 (executable)
 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 
-CXXFLAGS = -Wall -g
+CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
+CFLAGS = $(shell dpkg-buildflags --get CFLAGS)
+CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS)
+CXXFLAGS += -Wall
 
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-       CXXFLAGS += -O0
-else
-       CXXFLAGS += -O2
-endif
-
-include /usr/share/octave/debian/defs.make
-include /usr/share/dpatch/dpatch.make
+MDIR = $(shell octave-config  --print LOCALFCNFILEDIR)
+OCTDIR = $(shell octave-config  --print LOCALOCTFILEDIR)
 
 confflags = --host=$(DEB_HOST_GNU_TYPE) \
                        --build=$(DEB_BUILD_GNU_TYPE) \
                        --prefix=/usr \
                        --mandir=\$${prefix}/share/man \
-                       --with-moc=moc-qt3 \
                        --with-octave-m-dir=$(MDIR)/pfstools \
                        --with-octave-oct-dir=$(OCTDIR)/pfstools
 
@@ -36,7 +32,7 @@ confflags += --disable-matlab
 # These libraries are not available / unusable in Debian.
 confflags += --disable-jpeghdr --disable-gdal
 
-config.status: configure $(DPATCH_STAMPFN)
+config.status: configure
        dh_testdir
        
        for file in config.guess config.sub; do \
@@ -46,9 +42,12 @@ config.status: configure $(DPATCH_STAMPFN)
                fi \
        done
        
-       CXXFLAGS="$(CXXFLAGS)" ./configure $(confflags)
+       ./configure $(confflags) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" \
+               CXXFLAGS="$(CXXFLAGS)"
 
-build: build-stamp
+build: build-arch build-indep
+build-arch: build-stamp
+build-indep: build-stamp
 
 build-stamp: config.status
        dh_testdir
@@ -57,10 +56,10 @@ build-stamp: config.status
        
        touch build-stamp
 
-clean: unpatch
+clean:
        dh_testdir
        dh_testroot
-       rm -f build-stamp 
+       rm -f build-stamp
        
        [ ! -f Makefile ] || $(MAKE) clean
        [ ! -f Makefile ] || $(MAKE) distclean
@@ -72,12 +71,12 @@ clean: unpatch
                fi \
        done
        
-       dh_clean 
+       dh_clean
 
 install: build
        dh_testdir
        dh_testroot
-       dh_clean -k 
+       dh_clean -k
        dh_installdirs
        
        $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
@@ -114,11 +113,10 @@ binary-arch: build install
        dh_makeshlibs
        dh_installdeb
        dh_shlibdeps -Llibpfs-1.2-0 -ldebian/libpfs-1.2-0/usr/lib/
-       octave3.0-depends -poctave-pfstools
        dh_gencontrol
        dh_md5sums
        dh_builddeb
 
 binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install 
+.PHONY: build clean binary-indep binary-arch binary install