File: rules

package info (click to toggle)
liblockdev 0.9a
  • links: PTS
  • area: main
  • in suites: hamm, slink
  • size: 128 kB
  • ctags: 58
  • sloc: ansic: 489; makefile: 166; perl: 44; sh: 29
file content (191 lines) | stat: -rwxr-xr-x 4,932 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
190
191
#!/usr/bin/make -f
# makefile to build a shared library as a debian binary package
# modifyed to handle alternate libc

libname=liblockdev
package=${libname}${version_major}g

_debian_policy_ = 1
-include debian/policy

#

build:
	${checkdir}
	-${MAKE} mostyclean
	${MAKE} shared CFLAGS="-O2 -fPIC -fomit-frame-pointer"
	${MAKE} perl-lib
	touch build

.PHONY: clean 
clean:	
	${checkdir}
	-rm -f out build build-* _SRCDIR_
	-${MAKE} distclean
	${update_standards_version} debian/control
	-rm -f `find . -name "*~"`
	-rm -rf debian/tmp `find debian/* -type d ! -name CVS`
	-rm -f debian/*substvars debian/files* core


binary-indep:	checkroot build
	${checkdir}
# There are no architecture-independent files to be uploaded
# generated by this package. If there were any they would be
# made here.

binary-run:	checkroot build
	${checkdir}
	-rm -rf ${d_build}
	#
	# need to create dirs by hand
	${install_dir}	${d_dirs} 
	#
	# ==== DEBIAN control files ====
	cd debian && ${install_DEBIAN_scripts}
	# shlibs dependency
	echo -e "${libname}\t${version_major}\t${package}" \
		> ${d_deb}/shlibs
	# ==== make install ====
	${MAKE} install_run basedir=${d_usr}
	# move libs to /lib
	mv ${d_ulib}/* ${d_lib}
	strip --strip-unneeded 	${d_lib}/${libname}.so.${version}	
	# ==== symlink for shared libs to work ====
	ln -s ${libname}.so.${version}	${d_lib}/${libname}.so.${version_major}
	#
	# ==== docs ====
	# particular documents that must be present with exactly this name
	cd debian && ${install_data}	changelog \
				${d_doc}/changelog.Debian
	cd debian && ${install_data}	copyright \
				${d_doc}/copyright
	#
	# now compress only large documents
	cd ${d_doc} && ${compress_docs}
	#
	# ==== clean dirs ====
	-${clean_dirs}
	# ==== md5sums ====
	cd ${d_build} && ${install_md5sums}
	# ==== finds dependencies ====
	dpkg-shlibdeps ${d_lib}/*
	# ==== process control file ====
	dpkg-gencontrol -p${package}
	chown -R root.root ${d_build}
	chmod -R go=rX ${d_build}
	dpkg --build ${d_build} ..

binary-dev:	checkroot
	# now add static libs, include file and manpage
	${checkdir}
	-rm -rf ${d_build}
	#
	# need to create dirs by hand
	${install_dir}	${d_dirs} 
	ln -s ${package} ${d_doc}-dev
	#
	# ==== make install ====
	-${MAKE} mostyclean
	${MAKE} static CFLAGS="-g3 -O2"
	${MAKE} install_dev basedir=${d_usr}
	strip --strip-debug 	${d_ulib}/${libname}.a
	# ==== symlink for shared libs to work ====
	ln -s ${libname}.so.${version}	${d_lib}/${libname}.so
	#
	# ==== manpages ====
	${MAKE} install_doc basedir=${d_usr}
	gzip -r9 ${d_man}
	#
	# ==== clean dirs ====
	-${clean_dirs}
	# ==== md5sums ====
	cd ${d_build} && ${install_md5sums}
	# ==== process control file ====
	dpkg-gencontrol -p${package}-dev
	chown -R root.root ${d_build}
	chmod -R go=rX ${d_build}
	dpkg --build ${d_build} ..

binary-dbg:	checkroot
	# now add static libs with debug and profiling enabled
	${checkdir}
	-rm -rf ${d_build}
	#
	# need to create dirs by hand
	${install_dir}	${d_dirs} ${d_doc}-dbg
	#
	# ==== DEBIAN control files ====
	prefix="dbg_" && cd debian && ${install_DEBIAN_scripts}
	#
	# ==== make install ====
	-${MAKE} mostyclean
	${MAKE} shared CFLAGS="-g3 -O2 -fPIC -DDEBUG" create_debug_lib=1
	${MAKE} install_debug basedir=${d_usr}
	-${MAKE} mostyclean
	${MAKE} shared CFLAGS="-g3 -pg -fPIC"
	${MAKE} install_profile basedir=${d_usr}
	#
	# ==== sources ====
	${install_sources}
	#
	# ==== docs ====
	cd debian && ${install_data}	README.debug	${d_doc}-dbg
	# now compress only large documents
	cd ${d_doc}-dbg && ${compress_docs}
	#
	# ==== clean dirs ====
	-${clean_dirs}
	# ==== md5sums ====
	cd ${d_build} && ${install_md5sums}
	# ==== process control file ====
	dpkg-gencontrol -p${package}-dbg
	chown -R root.root ${d_build}
	chmod -R go=rX ${d_build}
	dpkg --build ${d_build} ..

binary-perl:	checkroot build
	${checkdir}
	-rm -rf ${d_build}
	#
	# need to create dirs by hand
	${install_dir}	${d_dirs} ${d_doc}-perl ${d_man}/man3
	#
	# ==== docs ====
	# particular documents that must be present with exactly this name
	cd debian && ${install_data}	changelog \
			${d_doc}-perl/changelog.Debian
	cd debian && ${install_data}	copyright \
			${d_doc}-perl/copyright
	#
	# now compress only large documents
	cd ${d_doc}-perl && ${compress_docs}
	#
	# ==== make install ====
	cd LockDev && $(MAKE) pure_perl_install manifypods \
		INST_MAN3DIR=${d_man}/man3 \
		PREFIX=${d_usr} 
	-find ${d_build} -type f -name .packlist | xargs rm -f
	gzip -r9 ${d_man}
	#
	# ==== clean dirs ====
	-${clean_dirs}
	# ==== md5sums ====
	cd ${d_build} && ${install_md5sums}
	# ==== process control file ====
	dpkg-gencontrol -p${libname}${version_major}-perl
	chown -R root.root ${d_build}
	chmod -R go=rX ${d_build}
	dpkg --build ${d_build} ..


binary-arch:	binary-run binary-dev binary-dbg binary-perl


.PHONY: binary binary-indep binary-arch binary-run binary-dev 
binary:		binary-indep binary-arch

.PHONY: checkroot 
checkroot:
	test root = "`whoami`"