tizen beta release
[adaptation/devices/bluetooth-firmware-bcm.git] / debian / rules
1 #!/usr/bin/make -f
2
3 # Uncomment this to turn on verbose mode.
4 #export DH_VERBOSE=1
5
6 CFLAGS ?= -Wall -g
7 LDFLAGS ?= 
8 PREFIX ?= /usr
9 DATADIR ?= /opt
10 PLUGIN_PREFIX ?= /usr
11
12 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
13         CFLAGS += -O0
14 else
15         CFLAGS += -O2
16 endif
17
18 LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs
19
20 configure: configure-stamp
21 configure-stamp:
22         dh_testdir
23         # Add here commands to configure the package.
24         CFLAGS="$(CFLAGS) -fpie" LDFLAGS="$(LDFLAGS) -pie" \
25                cmake . -DCMAKE_INSTALL_PREFIX=$(PREFIX) -DPLUGIN_INSTALL_PREFIX=$(PLUGIN_PREFIX)
26
27         touch configure-stamp
28
29 build: build-stamp
30
31 build-stamp: configure-stamp 
32         dh_testdir
33
34         # Add here commands to compile the package.
35         $(MAKE)
36
37         for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
38                 cat $$f > $${f%.in}; \
39                 sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
40                 sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \
41                 sed -i -e "s#@PLUGIN_PREFIX@#$(PLUGIN_PREFIX)#g" $${f%.in}; \
42         done
43
44         touch $@
45
46 clean:
47         dh_testdir
48         dh_testroot
49         rm -f build-stamp configure-stamp
50
51         # Add here commands to clean up after the build process.
52         -$(MAKE) clean
53
54
55         for f in `find $(CURDIR)/ -name "CMakeCache.txt"`; do \
56                 rm -f $${f}; \
57         done
58         for f in `find $(CURDIR)/ -name "CMakeFiles"`; do \
59                 rm -rf $${f}; \
60         done
61         for f in `find $(CURDIR)/ -name "cmake_install.cmake"`; do \
62                 rm -f $${f}; \
63         done
64         for f in `find $(CURDIR)/ -name "Makefile"`; do \
65                 rm -f $${f}; \
66         done
67         for f in `find $(CURDIR)/ -name "install_manifest.txt"`; do \
68                 rm -f $${f}; \
69         done
70
71         for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
72                 rm -f $${f%.in}; \
73         done
74
75         rm -f scripts/BCM_FIRMWARE*.hcd
76         rm -f scripts/bt-dev-end.sh
77         rm -f scripts/bt-dev-start.sh
78         rm -f scripts/bt-set-addr.sh
79
80         dh_clean 
81
82 install: build
83         dh_testdir
84         dh_testroot
85         dh_clean -k 
86         dh_installdirs
87
88         # Add here commands to install the package into debian/wavplayer.
89         $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
90
91         # Booting script
92         $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
93         mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc3.d
94         mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc5.d
95         ln -s ../init.d/bluetooth-address $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/S60bluetooth-address
96         ln -s ../init.d/bluetooth-address $(CURDIR)/debian/tmp/etc/rc.d/rc5.d/S60bluetooth-address
97
98 # Build architecture-independent files here.
99 binary-indep: build install
100 # We have nothing to do by default.
101
102 # Build architecture-dependent files here.
103 binary-arch: build install
104         dh_testdir
105         dh_testroot
106         dh_installchangelogs 
107         dh_installdocs
108         dh_installexamples
109         dh_install --sourcedir=debian/tmp
110 #       dh_installmenu
111 #       dh_installdebconf       
112 #       dh_installlogrotate
113 #       dh_installemacsen
114 #       dh_installpam
115 #       dh_installmime
116 #       dh_python
117 #       dh_installinit
118 #       dh_installcron
119 #       dh_installinfo
120         dh_installman
121         dh_link
122         dh_strip --dbg-package=bt-firmware-43xx-dbg
123         dh_compress
124         dh_fixperms
125 #       dh_perl
126         dh_makeshlibs
127         dh_installdeb
128         dh_shlibdeps
129         dh_gencontrol
130         dh_md5sums
131         dh_builddeb
132
133 binary: binary-indep binary-arch
134 .PHONY: build clean binary-indep binary-arch binary install configure