Tizen 2.1 base
[platform/core/connectivity/bluetooth-tools.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
13 CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp
14
15 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
16         CFLAGS += -O0
17 else
18         CFLAGS += -O2
19 endif
20
21 LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs
22
23 configure: configure-stamp
24 configure-stamp:
25         dh_testdir
26         # Add here commands to configure the package.
27         mkdir -p $(CMAKE_BUILD_DIR) && \
28         cd $(CMAKE_BUILD_DIR) && \
29         CFLAGS="$(CFLAGS) -fpie" LDFLAGS="$(LDFLAGS) -pie" \
30         cmake .. -DCMAKE_INSTALL_PREFIX=$(PREFIX) -DPLUGIN_INSTALL_PREFIX=$(PLUGIN_PREFIX)
31
32         touch configure-stamp
33
34 build: build-stamp
35
36 build-stamp: configure-stamp
37         dh_testdir
38
39         # Add here commands to compile the package.
40         cd $(CMAKE_BUILD_DIR) && $(MAKE)
41
42         for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
43                 cat $$f > $${f%.in}; \
44                 sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
45                 sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \
46                 sed -i -e "s#@PLUGIN_PREFIX@#$(PLUGIN_PREFIX)#g" $${f%.in}; \
47         done
48
49         touch $@
50
51 clean:
52         dh_testdir
53         dh_testroot
54         rm -f build-stamp configure-stamp
55
56         # Add here commands to clean up after the build process.
57         -rm -rf $(CMAKE_BUILD_DIR)
58
59         for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
60                 rm -f $${f%.in}; \
61         done
62         dh_clean
63
64 install: build
65         dh_testdir
66         dh_testroot
67         dh_clean -k
68         dh_installdirs
69
70         # Add here commands to install the package into debian/wavplayer.
71         cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
72
73         # Booting script
74         mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc3.d
75         mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc5.d
76         ln -s ../init.d/bluetooth-address $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/S60bluetooth-address
77         ln -s ../init.d/bluetooth-address $(CURDIR)/debian/tmp/etc/rc.d/rc5.d/S60bluetooth-address
78
79 # Build architecture-independent files here.
80 binary-indep: build install
81 # We have nothing to do by default.
82
83 # Build architecture-dependent files here.
84 binary-arch: build install
85         dh_testdir
86         dh_testroot
87         dh_installchangelogs
88         dh_installdocs
89         dh_installexamples
90         dh_install --sourcedir=debian/tmp
91 #       dh_installmenu
92 #       dh_installdebconf
93 #       dh_installlogrotate
94 #       dh_installemacsen
95 #       dh_installpam
96 #       dh_installmime
97 #       dh_python
98 #       dh_installinit
99 #       dh_installcron
100 #       dh_installinfo
101         dh_installman
102         dh_link
103 #       dh_strip --dbg-package=bluetooth-tools-dbg
104         dh_compress
105         dh_fixperms
106 #       dh_perl
107         dh_makeshlibs
108         dh_installdeb
109         dh_shlibdeps
110         dh_gencontrol
111         dh_md5sums
112         dh_builddeb
113
114 binary: binary-indep binary-arch
115 .PHONY: build clean binary-indep binary-arch binary install configure