1 #!/usr/bin/make -f
2 # debian/rules for pfstools
3 #
4 # Written by Sebastian Harl <tokkee@debian.org>
6 # Uncomment this to turn on verbose mode.
7 #export DH_VERBOSE=1
9 # These are used for cross-compiling and for saving the configure script
10 # from having to guess our platform (since we know it already)
11 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
12 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
14 CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
15 CFLAGS = $(shell dpkg-buildflags --get CFLAGS)
16 CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS)
17 CXXFLAGS += -Wall
19 MDIR = $(shell octave-config --print LOCALFCNFILEDIR)
20 OCTDIR = $(shell octave-config --print LOCALOCTFILEDIR)
22 confflags = --host=$(DEB_HOST_GNU_TYPE) \
23 --build=$(DEB_BUILD_GNU_TYPE) \
24 --prefix=/usr \
25 --mandir=\$${prefix}/share/man \
26 --with-octave-m-dir=$(MDIR)/pfstools \
27 --with-octave-oct-dir=$(OCTDIR)/pfstools
29 # Matlab is not available in Debian.
30 confflags += --disable-matlab
32 # These libraries are not available / unusable in Debian.
33 confflags += --disable-jpeghdr --disable-gdal
35 config.status: configure
36 dh_testdir
38 for file in config.guess config.sub; do \
39 if [ ! -e $$file.upstream ]; then \
40 mv $$file $$file.upstream; \
41 ln -s /usr/share/misc/$$file .; \
42 fi \
43 done
45 ./configure $(confflags) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" \
46 CXXFLAGS="$(CXXFLAGS)"
48 build: build-arch build-indep
49 build-arch: build-stamp
50 build-indep: build-stamp
52 build-stamp: config.status
53 dh_testdir
55 $(MAKE)
57 touch build-stamp
59 clean:
60 dh_testdir
61 dh_testroot
62 rm -f build-stamp
64 [ ! -f Makefile ] || $(MAKE) clean
65 [ ! -f Makefile ] || $(MAKE) distclean
67 for file in config.guess config.sub; do \
68 if [ -e $$file.upstream ]; then \
69 rm -f $$file; \
70 mv $$file.upstream $$file; \
71 fi \
72 done
74 dh_clean
76 install: build
77 dh_testdir
78 dh_testroot
79 dh_clean -k
80 dh_installdirs
82 $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
84 chmod 644 debian/tmp/$(MDIR)/pfstools/*
86 # these binaries are not available
87 rm debian/tmp/usr/share/man/man1/pfs*jpeghdr.1
88 rm debian/tmp/usr/share/man/man1/pfsingdal.1
90 binary-indep: build install
91 # nothing to do here
93 binary-arch: build install
94 dh_testdir
95 dh_testroot
96 dh_installchangelogs ChangeLog
97 dh_installdocs README TODO doc/faq.txt doc/pfs_format_spec.pdf
98 dh_installdocs -A AUTHORS
99 dh_installexamples
100 dh_install --sourcedir=debian/tmp --fail-missing
101 # these files have been installed twice by dh_install
102 rm -f debian/pfstools/usr/bin/pfs*view debian/pfstools/usr/bin/pfsv \
103 debian/pfstools/usr/share/man/man1/pfsv.1 \
104 debian/pfstools/usr/share/man/man1/pfs*view.1
105 dh_installman
106 dh_link
107 dh_strip --dbg-package=pfstools-dbg
108 # mkoctfile removes any symbol table and relocation information from the
109 # .oct files making them unusable for the -dbg package
110 rm -rf debian/pfstools-dbg/usr/lib/debug/usr/lib/octave/
111 dh_compress -X.pdf
112 dh_fixperms
113 dh_makeshlibs
114 dh_installdeb
115 dh_shlibdeps -Llibpfs-1.2-0 -ldebian/libpfs-1.2-0/usr/lib/
116 dh_gencontrol
117 dh_md5sums
118 dh_builddeb
120 binary: binary-indep binary-arch
121 .PHONY: build clean binary-indep binary-arch binary install