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 CXXFLAGS = -Wall -g
16 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
17 CXXFLAGS += -O0
18 else
19 CXXFLAGS += -O2
20 endif
22 MDIR = $(shell octave-config --print LOCALFCNFILEDIR)
23 OCTDIR = $(shell octave-config --print LOCALOCTFILEDIR)
25 confflags = --host=$(DEB_HOST_GNU_TYPE) \
26 --build=$(DEB_BUILD_GNU_TYPE) \
27 --prefix=/usr \
28 --mandir=\$${prefix}/share/man \
29 --with-octave-m-dir=$(MDIR)/pfstools \
30 --with-octave-oct-dir=$(OCTDIR)/pfstools
32 # Matlab is not available in Debian.
33 confflags += --disable-matlab
35 # These libraries are not available / unusable in Debian.
36 confflags += --disable-jpeghdr --disable-gdal
38 config.status: configure
39 dh_testdir
41 for file in config.guess config.sub; do \
42 if [ ! -e $$file.upstream ]; then \
43 mv $$file $$file.upstream; \
44 ln -s /usr/share/misc/$$file .; \
45 fi \
46 done
48 ./configure $(confflags) CXXFLAGS="$(CXXFLAGS)"
50 build: build-arch build-indep
51 build-arch: build-stamp
52 build-indep: build-stamp
54 build-stamp: config.status
55 dh_testdir
57 $(MAKE)
59 touch build-stamp
61 clean:
62 dh_testdir
63 dh_testroot
64 rm -f build-stamp
66 [ ! -f Makefile ] || $(MAKE) clean
67 [ ! -f Makefile ] || $(MAKE) distclean
69 for file in config.guess config.sub; do \
70 if [ -e $$file.upstream ]; then \
71 rm -f $$file; \
72 mv $$file.upstream $$file; \
73 fi \
74 done
76 dh_clean
78 install: build
79 dh_testdir
80 dh_testroot
81 dh_clean -k
82 dh_installdirs
84 $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
86 chmod 644 debian/tmp/$(MDIR)/pfstools/*
88 # these binaries are not available
89 rm debian/tmp/usr/share/man/man1/pfs*jpeghdr.1
90 rm debian/tmp/usr/share/man/man1/pfsingdal.1
92 binary-indep: build install
93 # nothing to do here
95 binary-arch: build install
96 dh_testdir
97 dh_testroot
98 dh_installchangelogs ChangeLog
99 dh_installdocs README TODO doc/faq.txt doc/pfs_format_spec.pdf
100 dh_installdocs -A AUTHORS
101 dh_installexamples
102 dh_install --sourcedir=debian/tmp --fail-missing
103 # these files have been installed twice by dh_install
104 rm -f debian/pfstools/usr/bin/pfs*view debian/pfstools/usr/bin/pfsv \
105 debian/pfstools/usr/share/man/man1/pfsv.1 \
106 debian/pfstools/usr/share/man/man1/pfs*view.1
107 dh_installman
108 dh_link
109 dh_strip --dbg-package=pfstools-dbg
110 # mkoctfile removes any symbol table and relocation information from the
111 # .oct files making them unusable for the -dbg package
112 rm -rf debian/pfstools-dbg/usr/lib/debug/usr/lib/octave/
113 dh_compress -X.pdf
114 dh_fixperms
115 dh_makeshlibs
116 dh_installdeb
117 dh_shlibdeps -Llibpfs-1.2-0 -ldebian/libpfs-1.2-0/usr/lib/
118 dh_gencontrol
119 dh_md5sums
120 dh_builddeb
122 binary: binary-indep binary-arch
123 .PHONY: build clean binary-indep binary-arch binary install