aboutsummaryrefslogtreecommitdiff
path: root/debian/rules
blob: 9d4e37fb3e05acd295acf837bb3d6ec15fb313ac (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
39
40
41
#!/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))

# remove -Bsymbolic-functions from LDFLAGS because is messes up ld and some
# initializations end up being zero
LDFLAGS := $(patsubst -Bsymbolic-functions,,$(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; \
		$(MAKE) O=$$PWD/debian/build/$$plat $$PWD/debian/build/$$plat/$$target; \
	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