aboutsummaryrefslogtreecommitdiff
path: root/debian/rules
blob: be9f5729386d594f833f0329d37dbdfb116789c9 (plain)
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
#!/usr/bin/make -f

# the upstream build passes LDFLAGS directly to ld instead of calling gcc for
# linking; so instead of passing -Wl,foo in LDFLAGS as in automake builds, one
# should set LDFLAGS to foo directly
comma := ,
LDFLAGS := $(patsubst -Wl$(comma)%,%,$(LDFLAGS))

DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
export CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
endif

%:
	dh $@

override_dh_auto_clean:
	# upstream only cleans these files if passing the right O=, but it
	# shouldn't create these the source tree in the first place
	# XXX this hardcodes "arm"
	rm -f arch/arm/include/asm/arch arch/arm/include/asm/proc
	rm -rf debian/build

override_dh_auto_build:
	while read plat target deb; do \
		mkdir -p debian/build/$$plat; \
		$(MAKE) O=$$PWD/debian/build/$$plat $${plat}_config; \
		find debian/build; \
		$(MAKE) O=$$PWD/debian/build/$$plat; \
	done <debian/platform-and-targets

override_dh_auto_install:
	while read plat target deb; do \
	    install -D -m644 debian/build/$$plat/$$target debian/u-boot-linaro-$$deb/usr/lib/u-boot/$$plat/$$target; \
	done <debian/platform-and-targets