File: rules

package info (click to toggle)
mldonkey 2.9.5-2%2Blenny1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 17,064 kB
  • ctags: 27,215
  • sloc: ml: 146,054; cpp: 11,806; ansic: 7,663; sh: 4,187; asm: 3,858; xml: 3,472; makefile: 203; perl: 54
file content (189 lines) | stat: -rwxr-xr-x 4,907 bytes parent folder | download
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#!/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)

ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
  confflags += --build $(DEB_HOST_GNU_TYPE)
else
  confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
endif

CFLAGS = -Wall -g

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
        CFLAGS += -O0
else
        CFLAGS += -O2
endif

# Include patch-speficic rules
PACKAGE=mldonkey
include /usr/share/dpatch/dpatch.make

MANCHECK=mlnet mlgui mlguistarter
OCAMLABI=$(shell ocamlc -version)


doc-check: doc-check-stamp
doc-check-stamp: build
	for i in $(MANCHECK); do \
		./$$i --help > debian/xml-man/$$i.new 2>&1;\
		diff -q debian/xml-man/$$i.new debian/xml-man/$$i.help; \
		diff -Nurd debian/xml-man/$$i.help debian/xml-man/$$i.new > debian/xml-man/$$i.diff ; \
	done

	touch doc-check-stamp

doc-replace: doc-check $(foreach fl, $(MANCHECK), debian/xml-man/$(fl).new)
	for i in $(MANCHECK); do \
		mv -f debian/xml-man/$$i.new debian/xml-man/$$i.help; \
	done

clean-doc-check:
	-cd debian/xml-man && $(RM) *.new *.diff
	-$(RM) doc-check-stamp

configure: configure-stamp
configure-stamp:
	dh_testdir
	cd config; autoconf
	CFLAGS="$(CFLAGS)" CXXFLAGS="$(CFLAGS)" ./configure $(confflags) \
	  --enable-gui \
	  --enable-directconnect \
          --disable-magic \
	  --disable-fasttrack
	touch configure-stamp

build-arch: build-arch-stamp
build-arch-stamp: configure-stamp
	dh_testdir

	if ([ -x /usr/bin/ocamlopt ] || [ -x /usr/bin/ocamlopt.opt ]) && $(MAKE) utils opt; then \
		touch build-arch-opt; \
	else \
		$(MAKE) utils.byte byte; \
		cp mlnet.byte mlnet; \
		cp mlgui.byte mlgui; \
		cp mlguistarter.byte mlguistarter; \
		touch build-arch-byte; \
	fi
	# Check that the compilation has succeeded
	test -x mlnet
	test -x mlgui

	# Build utilities
	if [ -e build-arch-opt ]; then \
		cd debian/utils && $(MAKE) opt; \
	else \
		cd debian/utils && $(MAKE) byte; \
	fi
	touch build-arch-stamp

build-indep: build-indep-stamp
build-indep-stamp:
	dh_testdir
	cd debian/xml-man && $(MAKE) all
	touch build-indep-stamp

build: patch-stamp build-arch build-indep

maintainer-clean:
	# Prevent the rebuild of configure
	$(MAKE) distclean
	-$(RM) config/confdefs.h

unpatch: maintainer-clean

clean: maintainer-clean unpatch clean-doc-check
	dh_testdir
	dh_testroot
	# Update the PO, as suggested in "man 7 po-debconf"
	debconf-updatepo
	# Add here commands to clean up after the build process.
	$(MAKE) clean
	cd debian/xml-man && $(MAKE) clean
	cd debian/utils && $(MAKE) clean
	-$(RM) config/trying
	-$(RM) packages/rpm/Makefile
	-$(RM) *.ini *.ini.old
	-$(RM) configure-stamp build-arch-stamp build-indep-stamp build-arch-opt build-arch-byte
	dh_clean

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

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

# Build architecture-independent files here.
# Pass -i to all debhelper commands in this target to reduce clutter.
binary-indep: build install-indep
	dh_testdir -i
	dh_testroot -i
	dh_installdebconf -i
	dh_installdocs -i
	dh_installexamples -i
	dh_installmenu -i
	dh_desktop -i
	dh_installinit -i
	dh_installman -i
	dh_installchangelogs distrib/ChangeLog -i
	dh_link -i
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir -a
	dh_testroot -a
	dh_installdebconf -a
	dh_installdocs -a
	$(RM) $(CURDIR)/debian/mldonkey-server/usr/share/doc/mldonkey-server/distrib/Copying.txt
	$(RM) $(CURDIR)/debian/mldonkey-server/usr/share/doc/mldonkey-server/distrib/GeoIP_LICENSE.txt
	dh_installexamples -a
	dh_installmenu -a
	dh_desktop -a
	dh_installinit -a -pmldonkey-server --error-handler=init_error -- start 98 2 3 4 5 . stop 20 0 1 6 .
	dh_installcron -a
	dh_installman -a
	dh_installchangelogs distrib/ChangeLog -a
	dh_link -a
	dh_compress -a
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a
	if [ -e build-arch-opt ]; then \
		echo "interpreter:Depends=" >> debian/mldonkey-server.substvars; \
		echo "interpreter:Depends=" >> debian/mldonkey-gui.substvars; \
		dh_strip -a; \
	else \
		echo "interpreter:Depends=ocaml-base-nox-$(OCAMLABI)" >> debian/mldonkey-server.substvars; \
		echo "interpreter:Depends=ocaml-base-nox-$(OCAMLABI)" >> debian/mldonkey-gui.substvars; \
	fi
	dh_gencontrol -a -- -VF:OCamlABI="$(OCAMLABI)"
	dh_md5sums -a
	dh_builddeb -a

# For now we have no binary-indep
binary: binary-arch
.PHONY: build clean binary-indep binary-arch binary install