Merged -r6156:6213 from features/deb into trunk. Initial framework for creating Debia...
[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 configure: configure-stamp
28 configure-stamp:
29         dh_testdir
30         [ -f ./configure ] || ./bootstrap
31         CFLAGS="$(CFLAGS)" ./configure \
32                 --prefix=/usr --mandir=\$${prefix}/share/man \
33                 --infodir=\$${prefix}/share/info --enable-shared \
34                 --enable-doxygen --enable-html-docs \
35                 --sysconfdir=/etc --enable-all-components \
36                 --disable-gr-audio-osx --disable-gr-audio-windows \
37                 --disable-gr-qtgui
38         touch configure-stamp
39
40 build: build-stamp
41 build-stamp: configure-stamp 
42
43         $(MAKE) 
44         $(MAKE) check
45         touch $@
46
47 update:
48         -test -r /usr/share/misc/config.sub && \
49                 cp -f /usr/share/misc/config.sub config.sub
50         -test -r /usr/share/misc/config.guess && \
51                 cp -f /usr/share/misc/config.guess config.guess
52
53 clean:
54         dh_testdir
55         dh_testroot
56         rm -f build-stamp configure-stamp
57
58         if [ -f Makefile ]; \
59         then\
60                 if [ -d .svn ]; \
61                 then \
62                         $(MAKE) maintainer-clean; \
63                 else \
64                         $(MAKE) distclean; \
65                 fi; \
66         fi
67
68
69         dh_clean
70
71 install:
72         dh_testdir
73         dh_testroot
74         dh_clean -k
75         dh_installdirs
76
77         $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
78         install -m 0755 debian/usrp.hotplug \
79                 $(CURDIR)/debian/usrp/etc/hotplug.d/usb/
80
81         : # make python scripts starting with '#!' executable
82         for i in `find debian -mindepth 2 -type f ! -perm 755`; do \
83           if head -1 $$i | grep -q '^#!'; then \
84             chmod 755 $$i; \
85             echo "made executable: $$i"; \
86           fi; \
87         done
88
89         dh_install --sourcedir=debian/tmp --list-missing
90
91         cp -r gnuradio-examples/python/* \
92                 debian/gnuradio-examples/usr/share/gnuradio/
93         find debian/gnuradio-examples -type f -name Makefile\* -exec rm {} \;
94         find debian/gnuradio-examples -type d -name CVS -exec rm {} \;
95         find debian/gnuradio-examples -name \*.py -exec chmod +x {} \;
96
97 #       mv debian/gnuradio/usr/bin/microtune.py \
98 #               debian/gnuradio/usr/bin/microtune
99
100         mv debian/usrp/usr/bin/usrp_ra_receiver.py \
101                 debian/usrp/usr/bin/usrp_ra_receiver
102         mv debian/usrp/usr/bin/usrp_psr_receiver.py \
103                 debian/usrp/usr/bin/usrp_psr_receiver
104
105 # Must not depend on anything. This is to be called by
106 # binary-arch/binary-indep
107 # in another 'make' thread.
108 binary-common:
109         dh_testdir
110         dh_testroot
111         dh_installchangelogs ChangeLog
112         dh_installdocs
113         dh_installexamples
114 #       dh_installmenu
115 #       dh_installdebconf       
116 #       dh_installlogrotate     
117 #       dh_installemacsen
118 #       dh_installpam
119 #       dh_installmime
120         dh_pycentral
121         dh_python
122 #       dh_installinit
123 #       dh_installcron
124 #       dh_installinfo
125         dh_installman
126         dh_link
127 ifneq (,$(findstring -s,$(DH_OPTIONS)))
128         dh_strip --no-package=libgnuradio-core0c2a --no-package=libusrp0c2a
129         DH_OPTIONS= dh_strip --package=libgnuradio-core0c2a \
130                 --dbg-package=libgnuradio-core0c2a-dbg
131         DH_OPTIONS= dh_strip --package=libusrp0c2a \
132                 --dbg-package=libusrp0c2a-dbg
133 else
134         dh_strip
135 endif
136         dh_compress 
137 #       dh_movefiles --sourcedir=debian/gnuradio
138         dh_fixperms
139 #       dh_perl
140         dh_makeshlibs
141         dh_installdeb
142         dh_shlibdeps
143         dh_gencontrol
144         dh_md5sums
145         dh_builddeb
146
147 # Build architecture independant packages using the common target.
148 binary-indep: build install
149         $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
150
151 # Build architecture dependant packages using the common target.
152 binary-arch: build install
153         $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
154
155 binary: binary-arch binary-indep
156 .PHONY: build clean binary-indep binary-arch binary install configure