Git init
[framework/base/libsqlfs.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 CC ?= gcc
11
12 LDFLAGS += -Wl,--as-needed
13
14 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
15         CFLAGS += -O0
16 else
17         CFLAGS += -O2
18 endif
19
20 configure: configure-stamp
21 configure-stamp:
22         dh_testdir
23         # Add here commands to configure the package.
24
25         touch configure-stamp
26
27
28 build: build-stamp
29
30 build-stamp: configure-stamp 
31         dh_testdir
32
33         # Add here commands to compile the package.
34         $(CC) $(CFLAGS) \
35                 -DFUSE \
36                 -D_GNU_SOURCE \
37                 -D_FILE_OFFSET_BITS=64 \
38                 -D_REENTRANT \
39                 -DFUSE_USE_VERSION=25 \
40                 -I$(PREFIX)/include -I. \
41                 sqlfs.c fuse_main.c \
42                 -o libsqlfs_mount \
43                 $(LDFLAGS) \
44                 -L$(PREFIX)/lib \
45                 -lpthread \
46                 -lfuse -lrt\
47                 -lsqlite3 -ldl -lcap
48
49         $(CC) $(CFLAGS) \
50                 sqlfs_txn_cmd.c \
51                 -o sqlfs_txn_cmd \
52                 $(LDFLAGS)
53
54         for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
55                 cat $$f > $${f%.in}; \
56                 sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
57                 sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \
58         done
59
60         touch $@
61
62 clean:
63         dh_testdir
64         dh_testroot
65         rm -f build-stamp configure-stamp
66
67         # Add here commands to clean up after the build process.
68         rm -rf libsqlfs_mount sqlfs_txn_cmd
69
70         for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
71                 rm -f $${f%.in}; \
72         done
73
74
75         dh_clean 
76
77 install: build
78         dh_testdir
79         dh_testroot
80         dh_clean -k 
81         dh_installdirs
82
83         # Add here commands to install the package into debian/tmp.
84         mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/init.d/
85         mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/
86         mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc4.d/
87         mkdir -p $(CURDIR)/debian/tmp$(PREFIX)/bin
88         install -c libsqlfs_mount $(CURDIR)/debian/tmp$(PREFIX)/bin/
89         install -c sqlfs_txn_cmd $(CURDIR)/debian/tmp$(PREFIX)/bin/
90         install -c sqlfs-mount $(CURDIR)/debian/tmp/etc/rc.d/init.d/
91         ln -s ../init.d/sqlfs-mount $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/S10sqlfs-mount
92         ln -s ../init.d/sqlfs-mount $(CURDIR)/debian/tmp/etc/rc.d/rc4.d/S10sqlfs-mount
93
94 # Build architecture-independent files here.
95 binary-indep: build install
96 # We have nothing to do by default.
97
98 # Build architecture-dependent files here.
99 binary-arch: build install
100         dh_testdir
101         dh_testroot
102         dh_installchangelogs 
103         dh_installdocs
104         dh_installexamples
105         dh_install --sourcedir=debian/tmp
106 #       dh_installmenu
107 #       dh_installdebconf       
108 #       dh_installlogrotate
109 #       dh_installemacsen
110 #       dh_installpam
111 #       dh_installmime
112 #       dh_python
113 #       dh_installinit
114 #       dh_installcron
115 #       dh_installinfo
116         dh_installman
117         dh_link
118         dh_strip
119         dh_compress
120         dh_fixperms
121 #       dh_perl
122         dh_makeshlibs
123         dh_installdeb
124         dh_shlibdeps
125         dh_gencontrol
126         dh_md5sums
127         dh_builddeb
128
129 binary: binary-indep binary-arch
130 .PHONY: build clean binary-indep binary-arch binary install configure