File: rules

package info (click to toggle)
ubertooth 2018.12.R1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 5,164 kB
  • sloc: ansic: 18,627; cpp: 2,549; python: 604; makefile: 474; asm: 113; perl: 86; sh: 63; ruby: 43; xml: 20
file content (74 lines) | stat: -rwxr-xr-x 2,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
#!/usr/bin/make -f

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

include /usr/share/dpkg/pkg-info.mk

export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

SOURCE_DATE_UTC ?= $(shell LC_ALL=C date -u -d @$(SOURCE_DATE_EPOCH))
CHANGELOG_DATE ?= $(shell LC_ALL=C date -u -d @$(SOURCE_DATE_EPOCH) +"%d %B %Y")
DOPACKAGES = $(shell dh_listpackages)

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

UPSTREAM_PACKAGE_VERSION ?= $(shell echo $(DEB_VERSION) | sed 's/-[^-]*$$//')

UPSTREAM_PACKAGE_VERSION_ORIGINAL = $(shell echo $(UPSTREAM_PACKAGE_VERSION) | sed 's/\./-/g')

%:
	dh $@

override_dh_auto_clean:
	dh_auto_clean --sourcedirectory=host
	dh_auto_clean --sourcedirectory=firmware
	$(RM) debian/man/*.1
	$(RM) -r ubertooth-firmware-source
	$(RM) ubertooth-firmware-source.tar.gz
	$(RM) debian/ubertooth.pc

override_dh_auto_configure:
	# Creating ubertooth-firmare-source.tar.gz:
	cp -rf firmware ubertooth-firmware-source
	cd ubertooth-firmware-source ; patch -R -Np2 < ../debian/patches/02_fix_missing_dfu.patch ; \
	  patch -Np2 < ../debian/patches_extra/patch_include_source.patch
	cd ubertooth-firmware-source ; sed -i 's/REPLACE_ME_WITH_VERSION/$(UPSTREAM_PACKAGE_VERSION_ORIGINAL)/' common.mk
	GZIP=-9n tar --mtime='$(SOURCE_DATE_UTC)' --sort=name --owner=root --group=root \
	  --mode=go=rX,u+rw,a-s -czvf ubertooth-firmware-source.tar.gz \
	  ubertooth-firmware-source/
	#
	
	dh_auto_configure --sourcedirectory=host -- -DLIB_SUFFIX=/$(DEB_HOST_MULTIARCH) \
	  -DUBERTOOTH_GROUP=plugdev -DUDEV_RULES_PATH=/lib/udev/rules.d
ifneq ($(filter ubertooth-firmware,$(DOPACKAGES)),)
	dh_auto_configure --sourcedirectory=firmware
endif

override_dh_auto_build:
	dh_auto_build --sourcedirectory=host
ifneq ($(filter ubertooth-firmware,$(DOPACKAGES)),)
	dh_auto_build --sourcedirectory=firmware --no-parallel -- \
	  TIMESTAMP="-DTIMESTAMP=''" COMPILE_BY="-D'COMPILE_BY=\"user\"'" \
	  COMPILE_HOST="-D'COMPILE_HOST=\"localhost\"'" \
	  GIT_REVISION="-D'GIT_REVISION=\"$(UPSTREAM_PACKAGE_VERSION_ORIGINAL)\"'"
endif
	cat debian/ubertooth.pc.in | sed 's/DEB_HOST_MULTIARCH/$(DEB_HOST_MULTIARCH)/' | \
	  sed 's/UPSTREAM_PACKAGE_VERSION/$(UPSTREAM_PACKAGE_VERSION)/' > debian/ubertooth.pc

override_dh_auto_install:
	dh_auto_install --sourcedirectory=host
ifneq ($(filter ubertooth-firmware,$(DOPACKAGES)),)
	chmod a-x firmware/*/*.bin
	dh_auto_install --sourcedirectory=firmware
endif
	mkdir -p debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig
	cp debian/ubertooth.pc debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/
	rm debian/tmp/usr/bin/ubertooth-tx # The tool does nothing - not fully implemented. Skip installing
	                                   # TODO: remove line when tool has been implemented

override_dh_installman:
	cd debian/man ; CHANGELOG_DATE="$(CHANGELOG_DATE)" ./genmanpages.sh
	dh_installman