File: rules

package info (click to toggle)
popt 1.16-10
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 3,520 kB
  • ctags: 762
  • sloc: sh: 10,852; ansic: 4,360; makefile: 516; sed: 16
file content (172 lines) | stat: -rwxr-xr-x 4,248 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
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

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

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

ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
else
CROSS= --build $(DEB_BUILD_GNU_TYPE)
endif

# shared library versions, option 1
source = $(shell grep "^Source: " debian/control|head -1|sed 's/Source: \(.*\)/\1/g')

version = $(shell grep "^$(source) " debian/changelog|head -1 |sed 's/.*(\(.*\)\-[^\-]*).*/\1/g')

major=0

# Work around past library brokenness
ifeq ($(version),1.7)
ifeq ($(DEB_HOST_ARCH),m68k)
version = 1.7-4
endif
endif

cflags = `dpkg-buildflags --get CFLAGS` `dpkg-buildflags --get CPPFLAGS`
cflags += -Wall -W -D_GNU_SOURCE -D_REENTRANT
cflags_udeb = -Os -Wall -W -g -D_GNU_SOURCE -D_REENTRANT
ldflags = `dpkg-buildflags --get LDFLAGS`

ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
install = install
else
install = install-strip
endif

objdir = $(CURDIR)/obj-$(DEB_HOST_GNU_TYPE)
objdir_udeb = $(objdir)-udeb

configure: configure-deb-stamp configure-udeb-stamp

autoreconf-stamp:
	dh_autoreconf
	touch $@

configure-deb-stamp: autoreconf-stamp
	dh_testdir
	# make build dir
	mkdir $(objdir)
	# Add here commands to configure the package.
	cd $(objdir) && \
	../configure --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) --prefix=/usr --mandir=/usr/share/man --enable-shared $(CROSS)
	touch $@

configure-udeb-stamp: autoreconf-stamp
	dh_testdir
	# make build dir
	mkdir $(objdir_udeb)
	# Add here commands to configure the package.
	cd $(objdir_udeb) && \
	../configure --prefix=/usr --mandir=/usr/share/man --enable-shared $(CROSS)
	touch $@

build: build-arch build-indep
build-arch: build-stamp
build-indep: build-stamp

build-stamp: build-arch-deb-stamp build-arch-udeb-stamp

build-arch-deb-stamp: configure-deb-stamp
	dh_testdir
	cd $(objdir) && $(MAKE) CFLAGS="$(cflags)" LDFLAGS="$(ldflags)"
	touch $@

build-arch-udeb-stamp: configure-udeb-stamp
	dh_testdir
	cd $(objdir_udeb) && $(MAKE) CFLAGS="$(cflags_udeb)"
	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp config.log
	rm -f config.log
	rm -f build-arch-deb-stamp build-arch-udeb-stamp
	rm -f autoreconf-stamp configure-deb-stamp configure-udeb-stamp
	rm -f po/*.gmo po/stamp-po
	
	# Remove build trees
	rm -rf $(objdir) $(objdir_udeb)

	# Remove install dirs
	rm -rf $(CURDIR)/debian/tmp $(CURDIR)/debian/tmp-udeb

	# Remove auto-generated files
	rm -f $(CURDIR)/debian/libpopt0.install
	rm -f $(CURDIR)/debian/libpopt0.links
	rm -f $(CURDIR)/debian/libpopt-dev.links

	# Add here commands to clean up after the build process.
	[ ! -f Makefile ] || $(MAKE) distclean

	dh_autoreconf_clean
	dh_clean
	rm -rf $(CURDIR)/tmp


install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

        # Main install
	cd $(objdir) && \
		$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp

	# udeb install
	cd $(objdir_udeb) && \
		$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp-udeb

	# Move the udeb library to /lib or /lib64
	mkdir $(CURDIR)/debian/tmp-udeb/lib/
	mv $(CURDIR)/debian/tmp-udeb/usr/lib*/libpopt.so.* \
		$(CURDIR)/debian/tmp-udeb/lib/

# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot

	sh debian/preprocess
	dh_install --list-missing
#	dh_installdebconf	
	dh_installdocs
	dh_installexamples
#	dh_installmenu
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_installinit
#	dh_installcron
	dh_installman
#	dh_installinfo
#	dh_undocumented
	dh_installchangelogs CHANGES
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_makeshlibs -V "libpopt0 (>= $(version))" -plibpopt0 --add-udeb="libpopt0-udeb"
	dh_installdeb
#	dh_perl
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb


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