File: rules

package info (click to toggle)
firmware-free 20241210-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,144 kB
  • sloc: asm: 3,983; python: 3,307; xml: 435; ansic: 230; sh: 153; makefile: 141; perl: 17
file content (123 lines) | stat: -rwxr-xr-x 4,019 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
#!/usr/bin/make -f
SHELL := sh -e
SOURCE := $(shell dpkg-parsechangelog -SSource)
VERSION := $(shell dpkg-parsechangelog -SVersion)
VERSION_UPSTREAM := $(shell echo "$(VERSION)" | sed -e 's,-[^-]*$$,,')
VERSION_BINNMU := $(shell echo "$(VERSION)" | sed -rne 's,.*\+b([0-9]+)$$,\1,p')
VERSION_SOURCE := $(patsubst %+b$(VERSION_BINNMU),%,$(VERSION))

GENCONTROL = debian/bin/gencontrol.py

binary binary-arch binary-indep build build-arch build-indep clean: debian/control
	dh $@

override_dh_auto_build:
	$(MAKE) -C av7110
	$(MAKE) -C cis
	$(MAKE) -C dsp56k
	$(MAKE) -C isci
	$(MAKE) -C keyspan_pda
	$(MAKE) -C usbdux -f Makefile_dux
	cp usbdux/usbdux*_firmware.bin .

override_dh_auto_test:
	:

CLEAN_PATTERNS := debian/build debian/lib/python/__pycache__ debian/lib/python/debian_linux/__pycache__ $$(find debian -maxdepth 1 -type d -name 'firmware-*') debian/*.substvars

override_dh_auto_clean:
	$(MAKE) -C av7110 clean
	$(MAKE) -C cis clean
	$(MAKE) -C dsp56k clean
	$(MAKE) -C isci clean
	$(MAKE) -C keyspan_pda clean
	$(MAKE) -C usbdux -f Makefile_dux clean
	rm -rf $(CLEAN_PATTERNS)

override_dh_auto_install:
	./copy-firmware.sh -v debian/build/install

override_dh_installdocs:
	dh_installdocs -XTODO

execute_after_dh_install:
# Deduplicate firmware files within each binary package
	cd debian/build && \
	for dir in ../firmware-*/usr/lib/firmware; do \
		../../dedup-firmware.sh "$$dir"; \
	done
# Check for any broken symlinks.
	! find debian/firmware-*/usr/lib/firmware -xtype l \
	| grep .

CONTROL_FILES = debian/build/version-info $(wildcard debian/templates/*.in)
CONTROL_FILES += debian/bin/gencontrol.py debian/config/defines $(wildcard debian/config/*/defines) debian/modinfo.json

# debian/bin/gencontrol.py uses debian/changelog as input, but the
# output only depends on the source name and version.  To avoid
# frequent changes to debian/control.md5sum, include only those fields
# in the checksum.
debian/build/version-info: debian/changelog
	mkdir -p $(@D)
	printf >$@ 'Source: %s\nVersion: %s\n' $(SOURCE) $(VERSION_SOURCE)

debian/control: $(GENCONTROL) $(CONTROL_FILES)
ifeq ($(wildcard debian/control.md5sum),)
	$(MAKE) -f debian/rules debian/control-real
else
	md5sum --check debian/control.md5sum --status || \
		$(MAKE) -f debian/rules debian/control-real
endif

debian/control-real: $(GENCONTROL) $(CONTROL_FILES)
# We currently need to run copy-firmware.sh to get a complete list of
# files to be installed.
	rm -rf debian/build/install
	./copy-firmware.sh debian/build/install
	$(GENCONTROL)
	md5sum $^ > debian/control.md5sum
	@echo
	@echo This target is made to fail intentionally, to make sure
	@echo that it is NEVER run during the automated build. Please
	@echo ignore the following error, the debian/control file has
	@echo been generated SUCCESSFULLY.
	@echo
	exit 1

DIR_ORIG = ../orig/$(SOURCE)-$(VERSION_UPSTREAM)
TAR_ORIG_NAME = $(SOURCE)_$(VERSION_UPSTREAM).orig.tar.xz
TAR_ORIG = $(firstword $(wildcard ../$(TAR_ORIG_NAME)) $(wildcard ../orig/$(TAR_ORIG_NAME)))

orig: $(DIR_ORIG)
	rsync --delete --exclude /debian --exclude /.git --link-dest=$(DIR_ORIG)/ -a $(DIR_ORIG)/ .
	QUILT_PATCHES='$(CURDIR)/debian/patches' QUILT_PC=.pc quilt push --quiltrc - -a -q --fuzz=0

$(DIR_ORIG):
ifeq ($(TAR_ORIG),)
	$(error Cannot find orig tarball $(TAR_ORIG_NAME))
else
	mkdir -p ../orig
	tar -C ../orig -xaf $(TAR_ORIG)
endif

clean-generated:
	rm -rf $(CLEAN_PATTERNS)
# We cannot use dh_clean here because it requires debian/control to exist
	rm -rf debian/.debhelper debian/*.debhelper* debian/debhelper-build-stamp debian/files debian/generated.*
	rm -f \
		debian/control \
		debian/control.md5sum \
		debian/*.bug-presubj \
		debian/*.install \
		debian/*.metainfo.xml \
		debian/*.postinst \
		debian/*.postrm \
		debian/*.preinst \
		debian/*.prerm \
		debian/*.templates

maintainerclean: clean-generated
	rm -rf $(filter-out debian .git, $(wildcard * .[^.]*))

.PHONY: clean build-indep build-arch build binary-indep binary-arch binary \
	clean-generated maintainerclean