summaryrefslogtreecommitdiff
path: root/debian/rules
blob: bed3422f9a287ee6e397b179589352e542f11906 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode. 
#export DH_VERBOSE=1

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

TMP:=$(CURDIR)/debian/tmp

include /usr/share/quilt/quilt.make

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -g
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	INSTALL_PROGRAM += -s
endif

configure: configure-stamp
configure-stamp: $(QUILT_STAMPFN)
	dh_testdir
	ln -sf /usr/share/misc/config.sub
	ln -sf /usr/share/misc/config.guess
	echo "0.11rc2+`cat .svnrevision`\nboxbackup" > VERSION.txt
	sh -x ./bootstrap
	./configure $(DEB_EXTRA_CONFIG_FLAGS) LDFLAGS="-Wl,--as-needed"
	touch configure-stamp

build-stamp: configure-stamp
	dh_testdir
	$(MAKE)
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	-./runtest.pl ALL
endif
	touch build-stamp

documentation/ExceptionCodes.xml: ExceptionCodes.txt
	cd documentation && perl generate_except_xml.pl

documentation/instguide.pdf:
	cd documentation && docbook2pdf instguide.xml

documentation/adminguide.pdf: documentation/ExceptionCodes.xml
	cd documentation && docbook2pdf adminguide.xml

# generated files for removal
GENERATED_FILES =  ExceptionCodes.txt infrastructure/BoxPlatform.pm
GENERATED_FILES += lib/common/BoxConfig.h runtest.pl
GENERATED_FILES += infrastructure/makebuildenv.pl
GENERATED_FILES += infrastructure/makedistribution.pl
GENERATED_FILES += infrastructure/makeparcels.pl
GENERATED_FILES += lib/common/makeexception.pl
GENERATED_FILES += lib/common/BoxPortsAndFiles.h
GENERATED_FILES += lib/raidfile/raidfile-config
GENERATED_FILES += lib/server/makeprotocol.pl
GENERATED_FILES += test/backupstorefix/testfiles/testbackupstorefix.pl
GENERATED_FILES += test/bbackupd/testfiles/extcheck1.pl
GENERATED_FILES += test/bbackupd/testfiles/extcheck2.pl
GENERATED_FILES += test/bbackupd/testfiles/notifyscript.pl
GENERATED_FILES += test/bbackupd/testfiles/syncallowscript.pl
GENERATED_FILES += bin/bbackupd/bbackupd-config
GENERATED_FILES += bin/bbackupquery/makedocumentation.pl
GENERATED_FILES += bin/bbstored/bbstored-certs
GENERATED_FILES += bin/bbstored/bbstored-config
GENERATED_FILES += contrib/solaris/bbackupd-manifest.xml
GENERATED_FILES += contrib/solaris/bbackupd-smf-method
GENERATED_FILES += contrib/solaris/bbstored-manifest.xml
GENERATED_FILES += contrib/solaris/bbstored-smf-method
GENERATED_FILES += documentation/ExceptionCodes.xml
GENERATED_FILES += documentation/manpage.links
GENERATED_FILES += documentation/manpage.refs


build: build-stamp documentation/instguide.pdf documentation/adminguide.pdf

clean: clean-real unpatch
clean-real:
	dh_testdir
	dh_testroot
	dh_clean build-stamp configure-stamp
	echo "USE_SVN_VERSION\nboxbackup" > VERSION.txt
	[ ! -f Makefile ] || make clean

	rm -fr aclocal.m4 configure
	rm -fr contrib/*/bbackupd contrib/*/bbstored
	rm -fr lib/common/BoxConfig.h.in test/bbackupd/testfiles/bbackupd.conf

	find . -name '*.o' | xargs --no-run-if-empty rm
	find . -name '*.a' | xargs --no-run-if-empty rm
	find . -name 'autogen_*' | xargs --no-run-if-empty rm
	find . -name '_*' | xargs --no-run-if-empty rm
	find . -name 'test-*.log' | xargs --no-run-if-empty rm
	find . -name 'Makefile' | xargs --no-run-if-empty rm

	# the test scripts do strange things here
	# (directories without write permissions)
	[ ! -d debug ] || chmod -R +rw debug/
	rm -fr release/ debug/ local/ parcels/

	dh_clean config.log config.status 
	dh_clean config.sub config.guess
	dh_clean documentation/instguide.pdf documentation/adminguide.pdf

	dh_clean $(GENERATED_FILES)

install: DH_OPTIONS=
install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	mkdir -p $(TMP)/etc/logcheck/ignore.d.workstation
	mkdir -p $(TMP)/etc/logcheck/ignore.d.server
	install -m 644 debian/boxbackup-server.logcheck.ignore $(TMP)/etc/logcheck/ignore.d.workstation/boxbackup-server
	install -m 644 debian/boxbackup-server.logcheck.ignore $(TMP)/etc/logcheck/ignore.d.server/boxbackup-server

	dh_install

binary-indep:
#  no architecture independant packages are being built

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir -a
	dh_testroot -a
	dh_installdebconf -a
	dh_installdocs -a -A ExceptionCodes.txt documentation/instguide.pdf documentation/adminguide.pdf
	dh_installinit -a
	dh_installcron -a
	dh_installman
	dh_installchangelogs  -a
	dh_strip -a
	dh_compress -a
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

binary: binary-arch
.PHONY: build clean binary-indep binary-arch binary install