File: rules

package info (click to toggle)
binutils-bpf 21
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 32 kB
  • sloc: makefile: 61
file content (83 lines) | stat: -rwxr-xr-x 2,400 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
#!/usr/bin/make -f
#export DH_VERBOSE=1

# Don't use bpf-none
target=bpf

package=binutils-bpf
d=debian/$(package)
top_dir=$(shell pwd)
binutils_dir=/usr/src/binutils
stampdir=debian/stamp

source_version := $(shell dpkg-query -W -f="\$${Version}\n" binutils-source)

deb_release := $(shell expr $(shell dpkg-parsechangelog -S Version) - 20)
deb_version := $(source_version)+$(deb_release)

deb_upstream_version := $(shell echo $(deb_version) | cut -d- -f1)
base_version := $(shell echo $(deb_version) | sed -e 's/\([1-9]\.[0-9]\).*-.*/\1/')

upstream_dir := binutils-$(shell echo $(deb_upstream_version) | sed -Ee 's/\.[0-9]{8}//')

untar_stamp=$(stampdir)/tar

buildflags=$(shell dpkg-buildflags --export=configure)
BUILT_USING := $(shell dpkg-query -f '$${source:Package} (= $${source:Version}), ' -W binutils-source)

# Need to override the -Wall that will get added otherwise
CFLAGS="-O2 -g"

configure_flags = \
	--target=$(target) \
	--prefix=/usr/lib \
	--bindir=/usr/bin \
	--libdir=/usr/lib/bpf \
	--infodir=/usr/share/doc/$(package)/info \
	--htmldir=/usr/share/doc/$(package)/html \
	--pdfdir=/usr/share/doc/$(package)/pdf \
	--mandir=/usr/share/man \
	--disable-nls \
	--disable-werror \
	--enable-plugins \
	--with-system-zlib \
	"--with-pkgversion=$(deb_version)" \
	$(buildflags)

%:
	dh $@ -D$(upstream_dir) -Bbuild

$(untar_stamp):
	tar xf $(binutils_dir)/binutils-*.tar.*
	mkdir -p $(stampdir)
	cp /usr/share/doc/binutils-source/copyright debian/copyright
	touch $@

override_dh_auto_configure: $(untar_stamp)
	dh_auto_configure -D$(upstream_dir) -Bbuild -- $(configure_flags)

override_dh_install:
	dh_install
	for i in ar as ld ld.bfd nm objcopy objdump ranlib readelf strip; do \
	  ln -sf ../../../bin/$(target)-$$i $(d)/usr/lib/$(target)/bin/$$i; \
	done
	ln -sf $(target)-ld.bfd $(d)/usr/bin/$(target)-ld
	ln -sf ld.bfd $(d)/usr/lib/$(target)/bin/ld
	mv $(d)/usr/share/man/man1/$(target)-ld.1 $(d)/usr/share/man/man1/$(target)-ld.bfd.1
	ln -sf $(target)-ld.bfd.1 $(d)/usr/share/man/man1/$(target)-ld.1

override_dh_gencontrol:
	dh_gencontrol -a -- \
		-v$(deb_version) \
		-Vlocal:Version=$(deb_upstream_version) \
		-Vbinutils:Version=$(source_version) \
		-VBuilt-Using="$(BUILT_USING)"

override_dh_auto_clean:
	rm -rf $(upstream_dir) build $(stampdir)

override_dh_installchangelogs:
	dh_installchangelogs $(upstream_dir)/ChangeLog

override_dh_auto_test:
	-dh_auto_test