Re-merge the codes
[framework/connectivity/bluetooth-frwk.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
11 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
12         CFLAGS += -O0
13 else
14         CFLAGS += -O2
15 endif
16
17 LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs
18
19 configure: configure-stamp
20 configure-stamp:
21         dh_testdir
22         # Add here commands to configure the package.
23         CFLAGS="$(CFLAGS) -fpie" LDFLAGS="$(LDFLAGS) -pie" \
24                cmake . -DCMAKE_INSTALL_PREFIX=$(PREFIX)
25
26         touch configure-stamp
27
28 build: build-stamp
29
30 build-stamp: configure-stamp 
31         dh_testdir
32
33         # Add here commands to compile the package.
34         $(MAKE)
35
36         for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
37                 cat $$f > $${f%.in}; \
38                 sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
39                 sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \
40         done
41
42         touch $@
43
44 clean:
45         dh_testdir
46         dh_testroot
47         rm -f build-stamp configure-stamp
48
49         # Add here commands to clean up after the build process.
50         -$(MAKE) clean
51
52         for f in `find $(CURDIR)/ -name "CMakeCache.txt"`; do \
53                 rm -f $${f}; \
54         done
55         for f in `find $(CURDIR)/ -name "CMakeFiles"`; do \
56                 rm -rf $${f}; \
57         done
58         for f in `find $(CURDIR)/ -name "cmake_install.cmake"`; do \
59                 rm -f $${f}; \
60         done
61 #       for f in `find $(CURDIR)/ -name "Makefile"`; do \
62                 rm -f $${f}; \
63         done
64         for f in `find $(CURDIR)/ -name "install_manifest.txt"`; do \
65                 rm -f $${f}; \
66         done
67         for f in `find $(CURDIR)/ -name "*.edj"`; do \
68                 rm -f $${f}; \
69         done
70         for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
71                 rm -f $${f%.in}; \
72         done
73
74         rm -f Makefile
75         rm -f lib/Makefile
76         rm -f bluetooth-frwk-agent/Makefile
77         rm -f bluetooth-pb-agent/Makefile
78         rm -f bluetooth-map-agent/Makefile
79         rm -f bluetooth-frwk-agent/po/Makefile
80         rm -f lib/test/Makefile
81
82         rm -f lib/*.pc
83         rm -f lib/marshal.c
84         rm -f lib/marshal.h
85         rm -f lib/obex-agent-glue.h
86
87         rm -f bluetooth-frwk-agent/marshal.c
88         rm -f bluetooth-frwk-agent/marshal.h
89         rm -f bluetooth-telephony/marshal.c
90         rm -f bluetooth-telephony/marshal.h
91
92         rm -f bluetooth-frwk-agent/sc_core_agent_glue.h
93         rm -f bluetooth-frwk-agent/bluetooth_obex_agent_glue.h
94         rm -f bluetooth-pb-agent/bluetooth_pb_agent_glue.h
95         rm -f bluetooth-map-agent/bluetooth_map_agent_glue.h
96         rm -f bluetooth-telephony/bluetooth-telephony-glue.h
97
98         rm -f bluetooth-media-control/Makefile
99         rm -f bluetooth-media-control/bluetooth-media-control.pc
100         rm -f bluetooth-media-control/test/Makefile
101
102         dh_clean
103
104 install: build
105         dh_testdir
106         dh_testroot
107         dh_clean -k
108         dh_installdirs
109
110         # Add here commands to install the package into debian/wavplayer.
111         $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
112
113         # Booting script
114         mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/
115         mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc5.d/
116         ln -s ../init.d/bluetooth-frwk-agent $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/S80bluetooth-frwk-agent
117         ln -s ../init.d/bluetooth-frwk-agent $(CURDIR)/debian/tmp/etc/rc.d/rc5.d/S80bluetooth-frwk-agent
118
119 # Build architecture-independent files here.
120 binary-indep: build install
121 # We have nothing to do by default.
122
123 # Build architecture-dependent files here.
124 binary-arch: build install
125         dh_testdir
126         dh_testroot
127         dh_installchangelogs
128         dh_installdocs
129         dh_installexamples
130         dh_install --sourcedir=debian/tmp
131 #       dh_installmenu
132 #       dh_installdebconf
133 #       dh_installlogrotate
134 #       dh_installemacsen
135 #       dh_installpam
136 #       dh_installmime
137 #       dh_python
138 #       dh_installinit
139 #       dh_installcron
140 #       dh_installinfo
141         dh_installman
142         dh_link
143         dh_strip --dbg-package=bluetooth-frwk-dbg
144         dh_compress
145         dh_fixperms
146 #       dh_perl
147         dh_makeshlibs
148         dh_installdeb
149         dh_shlibdeps
150         dh_gencontrol
151         dh_md5sums
152         dh_builddeb
153
154 binary: binary-indep binary-arch
155 .PHONY: build clean binary-indep binary-arch binary install configure