Work in progress with Debian packaging.
[debian/gnuradio] / debian / rules
1 #!/usr/bin/make -f
2 # -*- makefile -*-
3 # Sample debian/rules that uses debhelper.
4 #
5 # This file was originally written by Joey Hess and Craig Small.
6 # As a special exception, when this file is copied by dh-make into a
7 # dh-make output file, you may use that output file without restriction.
8 # This special exception was added by Craig Small in version 0.37 of dh-make.
9 #
10 # Modified to make a template file for a multi-binary package with separated
11 # build-arch and build-indep targets  by Bill Allombert 2001
12
13 # Uncomment this to turn on verbose mode.
14 export DH_VERBOSE=1
15
16 # This has to be exported to make some magic below work.
17 export DH_OPTIONS
18
19 CFLAGS = -Wall -g
20
21 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
22         CFLAGS += -O0
23 else
24         CFLAGS += -O2
25 endif
26
27 clean:
28         dh_testdir
29         dh_testroot
30         rm -f build-stamp configure-stamp extract-stamp install-stamp
31
32         if [ -f Makefile ]; \
33         then\
34                 if [ -d .svn ]; \
35                 then \
36                         $(MAKE) maintainer-clean; \
37                 else \
38                         $(MAKE) distclean; \
39                 fi; \
40         fi
41
42         dh_clean
43
44 update:
45         dh_testdir
46         -test -r /usr/share/misc/config.sub && \
47                 cp -f /usr/share/misc/config.sub config.sub
48         -test -r /usr/share/misc/config.guess && \
49                 cp -f /usr/share/misc/config.guess config.guess
50
51 configure: configure-stamp
52 configure-stamp:
53         dh_testdir
54         [ -f ./configure ] || ./bootstrap
55         CFLAGS="$(CFLAGS)" ./configure \
56                 --prefix=/usr --mandir=\$${prefix}/share/man \
57                 --infodir=\$${prefix}/share/info --enable-shared \
58                 --enable-doxygen --enable-html-docs \
59                 --sysconfdir=/etc --enable-all-components \
60                 --disable-gr-audio-osx --disable-gr-audio-windows \
61                 --disable-gr-qtgui
62         touch configure-stamp
63
64 extract: extract-stamp
65 extract-stamp: configure-stamp debian/gen-install-files.sh
66         dh_testdir
67         debian/gen-install-files.sh 
68         touch $@
69
70 build: build-stamp
71 build-stamp: extract-stamp
72
73         $(MAKE) 
74         $(MAKE) check
75         touch $@
76
77 install: install-stamp
78 install-stamp: build-stamp
79         dh_testdir
80         dh_testroot
81         dh_clean -k
82         dh_installdirs
83
84         $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
85         : # make python scripts starting with '#!' executable
86         for i in `find debian -mindepth 2 -type f ! -perm 755`; do \
87           if head -1 $$i | grep -q '^#!'; then \
88             chmod 755 $$i; \
89             echo "made executable: $$i"; \
90           fi; \
91         done
92
93         dh_install --sourcedir=debian/tmp
94
95 # FIXME: Ubuntu vs. Debian (below)
96 #       install -m 0755 debian/usrp.hotplug \
97 #               $(CURDIR)/debian/usrp/etc/hotplug.d/usb/
98
99         touch $@
100
101
102 # Must not depend on anything. This is to be called by
103 # binary-arch/binary-indep
104 # in another 'make' thread.
105 binary-common:
106         dh_testdir
107         dh_testroot
108         dh_installchangelogs ChangeLog
109         dh_installdocs
110         dh_pycentral
111         dh_link
112         dh_strip
113         dh_compress 
114         dh_fixperms
115         dh_makeshlibs
116         dh_installdeb
117         dh_shlibdeps
118         dh_gencontrol
119         dh_md5sums
120         dh_builddeb
121
122 # Build architecture independant packages using the common target.
123 binary-indep: build install
124         $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
125
126 # Build architecture dependant packages using the common target.
127 binary-arch: build install
128         $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
129
130 binary: binary-arch binary-indep
131 .PHONY: build clean binary-indep binary-arch binary install configure