File: rules

package info (click to toggle)
gdbm 1.8.3-14
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 1,360 kB
  • ctags: 305
  • sloc: sh: 6,503; ansic: 4,563; makefile: 913
file content (181 lines) | stat: -rwxr-xr-x 6,192 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
#!/usr/bin/make -f
# debian/rules file - for GNU DBM (1.8.3).
# Based on sample debian/rules file - for GNU Hello (1.3).
# Copyright 1994,1995 by Ian Jackson.
# Copyright 1998-2006 by James Troup.
# Copyright 2008-2009 by Anibal Monsalve Salazar.
# I hereby give you perpetual unlimited permission to copy,
# modify and relicense this file, provided that you do not remove
# my name from the file itself.  (I assert my moral right of
# paternity under the Copyright, Designs and Patents Act 1988.)
# This file may have to be extensively modified

DEB_BUILD_GNU_TYPE	:= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_TYPE	:= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_HOST_MULTIARCH	:= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

BUILD_DATE := $(shell dpkg-parsechangelog | sed -n -e 's/^Date: //p')

CFLAGS += -O2 -g -Wall -D_REENTRANT

ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
  STRIPBIN = strip
else
  CROSSCONF = --host=$(DEB_HOST_GNU_TYPE)
  STRIPBIN = $(DEB_HOST_GNU_TYPE)-strip
endif 

STRIP=$(STRIPBIN) --remove-section=.comment --remove-section=.note

install_dir=install -d -m 755
install_file=install -m 644
install_script=install -m 755
install_binary=install -m 755 -s
compress=gzip -9vn

clean:
	$(checkdir)
	rm -f build config.log config.cache
	[ ! -f Makefile ] || $(MAKE) distclean
	rm -f config.sub config.guess
	rm -f $$(find . -name "*~")
	rm -rf debian/tmp debian/files* debian/substvars*
	dh_clean

build-arch: build
build-indep: build
build:
	$(checkdir)
	libtoolize --copy --force
	aclocal
	autoconf
	cp -f /usr/share/misc/config.sub /usr/share/misc/config.guess .
	CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ./configure --prefix=/usr \
		$(CROSSCONF) --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)
	echo "/* We use fcntl locking (POSIX) instead of flock (BSD) */" >> autoconf.h
	echo "#undef HAVE_FLOCK" >> autoconf.h
	CFLAGS="$(CFLAGS)" LIBS="$(LDFLAGS)" $(MAKE)
ifeq ($(DEB_BUILD_PROFILE),stage1)
	touch gdbm.info
else
	$(MAKE) gdbm.info
endif
	touch build

binary-indep:	checkroot build
	$(checkdir)

binary-arch: binary-libgdbm binary-libgdbm-dev

binary-libgdbm: checkroot build
	$(checkdir)
	rm -rf debian/tmp/

	$(MAKE) INSTALL_ROOT=$$(pwd)/debian/tmp install install-compat
	rm -fr debian/tmp/usr/include debian/tmp/usr/info \
	       debian/tmp/usr/man debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/*.a \
                debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/*.la \
	       debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/*.so
	$(STRIP) --strip-unneeded debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/*.so*
	chmod 644 debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/*.so*

	rm -f debian/tmp/usr/share/info/gdbm.info
	rmdir debian/tmp/usr/share/info/
	rm -f debian/tmp/usr/share/man/man3/gdbm.3
	rmdir debian/tmp/usr/share/man/man3
	rmdir debian/tmp/usr/share/man

	$(install_dir) debian/tmp/DEBIAN
	$(install_file) debian/shlibs debian/triggers debian/tmp/DEBIAN/

	dh_installchangelogs -Pdebian/tmp -plibgdbm3
	$(compress) debian/tmp/usr/share/doc/libgdbm3/*
	$(install_file) debian/copyright debian/tmp/usr/share/doc/libgdbm3/copyright

	dpkg-shlibdeps debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libgdbm.so.3.0.0
	dpkg-gencontrol -isp -plibgdbm3
	# md5sums control file
	cd debian/tmp/; find . -type f ! -regex '.*/DEBIAN/.*' -printf '%P\0' | xargs -r0 md5sum > DEBIAN/md5sums
	dpkg-gensymbols -plibgdbm3
	chown -R root.root debian/tmp/
	chmod -R go=rX debian/tmp/
	find debian/tmp -depth -newermt '$(BUILD_DATE)' -print0 | \
		xargs -0r touch --no-dereference --date='$(BUILD_DATE)'
	dpkg --build debian/tmp/ ..

binary-libgdbm-dev: checkroot build
	$(checkdir)
	rm -fr debian/tmp/

	$(MAKE) prefix=$$(pwd)/debian/tmp/usr \
                infodir=$$(pwd)/debian/tmp/usr/share/info \
                man3dir=$$(pwd)/debian/tmp/usr/share/man/man3 \
                install install-compat
	for ext in "" "_compat"; do \
	  $(STRIP) --strip-debug debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libgdbm$$ext.a; \
	  rm debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libgdbm$$ext.so.3.0.0; \
	  rm debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libgdbm$$ext.so.3; \
	done
	#chmod 644 debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/*.la
	rm -f debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/*.la
	find debian/tmp -type f -name '*.a' -print0 | \
		xargs -0 strip-nondeterminism --type ar

	# libc6 owns ndbm.h, but some apps want gdbm's
	mv debian/tmp/usr/include/ndbm.h debian/tmp/usr/include/gdbm-ndbm.h

	$(compress) debian/tmp/usr/share/info/*
	$(compress) debian/tmp/usr/share/man/man3/*

	cd debian/tmp/usr/share/man/man3 ; \
	    for i in dbm gdbm_error gdbm_errno gdbm_open \
		    gdbm_close gdbm_store gdbm_fetch gdbm_delete \
		    gdbm_firstkey gdbm_nextkey gdbm_reorganize \
		    gdbm_sync gdbm_exists gdbm_strerror \
		    gdbm_setopt dbminit store fetch delete \
		    firstkey nextkey dbmclose dbm_open \
		    dbm_close dbm_fetch dbm_store dbm_delete \
		    dbm_firstkey dbm_nextkey dbm_error \
		    dbm_clearerr dbm_pagfno dbm_dirfno \
		    dbm_rdonly; do \
		ln -s gdbm.3.gz $$i.3.gz ; \
	    done

	$(install_dir) debian/tmp/DEBIAN/

	$(install_dir) debian/tmp/usr/share/doc/libgdbm-dev/
	dh_installchangelogs -Pdebian/tmp -plibgdbm-dev
	$(install_file) NEWS README debian/tmp/usr/share/doc/libgdbm-dev/
	$(compress) debian/tmp/usr/share/doc/libgdbm-dev/*
	$(install_file) debian/copyright \
			debian/tmp/usr/share/doc/libgdbm-dev/copyright

	dpkg-gencontrol -isp -plibgdbm-dev
	# md5sums control file
	cd debian/tmp/; find . -type f ! -regex '.*/DEBIAN/.*' -printf '%P\0' | xargs -r0 md5sum > DEBIAN/md5sums
	chown -R root.root debian/tmp/
	chmod -R go=rX debian/tmp/
	find debian/tmp -depth -newermt '$(BUILD_DATE)' -print0 | \
		xargs -0r touch --no-dereference --date='$(BUILD_DATE)'
	dpkg --build debian/tmp/ ..

define checkdir
	test -f gdbmclose.c -a -f debian/rules
endef

# Below here is fairly generic really

binary:		binary-indep binary-arch

source diff:
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

checkroot:
	$(checkdir)
	test root = "`whoami`"

.PHONY: binary binary-arch binary-indep clean checkroot