#!/usr/bin/make -f include /usr/share/dpkg/architecture.mk include /usr/share/dpkg/pkg-info.mk export DEBIAN_REVISION ?= $(shell echo $(DEB_VERSION) | sed -e 's,.*+dfsg,+dfsg,') ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) export CROSS_COMPILE ?= $(DEB_HOST_GNU_TYPE)- cross_build_tools ?= y endif # support parallel build using DEB_BUILD_OPTIONS=parallel=N ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) DEB_UBOOT_FLAGS += -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) endif # Enable verbose build by default, disable when terse is specified. ifneq (,$(filter terse,$(DEB_BUILD_OPTIONS))) VERBOSE=0 else VERBOSE=1 endif # 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)) %: dh $@ configs/novena-rawsd_defconfig: sed -e 's,CONFIG_SPL_FAT_SUPPORT=y,# CONFIG_SPL_FAT_SUPPORT is not set,' \ configs/novena_defconfig > configs/novena-rawsd_defconfig override_dh_auto_build: TOOLSDIR := debian/build/tools override_dh_auto_build: configs/novena-rawsd_defconfig set -e; sed -n 's/^$(DEB_HOST_ARCH)[[:space:]]\+//p' debian/targets \ | while read subarch platform targets; do \ builddir=debian/build/$$platform; \ case $$platform in \ novena-rawsd) targets="$$targets" ;\ ;; \ *) targets="$$targets uboot.elf" ;\ ;; \ esac;\ maketargets="all" ;\ case $$subarch in \ -) subpackage="u-boot" ;\ ;; \ *) subpackage="u-boot-$$subarch" ;\ ;; \ esac;\ mkdir -p $$builddir; \ $(MAKE) V=$(VERBOSE) O=$$builddir $${platform}_defconfig; \ $(MAKE) V=$(VERBOSE) $(DEB_UBOOT_FLAGS) O=$$builddir $${maketargets}; \ case "$$targets" in \ *uboot.elf*) \ install -m 644 $$builddir/u-boot $$builddir/uboot.elf; \ $(CROSS_COMPILE)strip --remove-section=.comment \ --remove-section=.note \ $$builddir/uboot.elf; \ ;; \ esac; \ for target in $$targets; do \ chmod -x $$builddir/$$target; \ echo $$builddir/$$target /usr/lib/u-boot/$$platform/ \ >> debian/build/targets.$$subarch; \ echo $$platform >> debian/build/platforms.$$subarch; \ done ; \ cp $$builddir/.config $$builddir/config.$$platform; \ echo $$builddir/config.$$platform /usr/share/doc/$$subpackage/configs/ \ >> debian/build/targets.$$subarch; \ case $${subarch} in \ rockchip) \ debian/bin/generate-rksd $$builddir $$platform $$subarch; \ ;; \ qcom) \ debian/bin/generate-qcom $$builddir $$platform $$subarch; \ ;; \ esac; \ done # Load dummy config echo CONFIG_SYS_TEXT_BASE=0 > configs/tools_defconfig $(MAKE) V=$(VERBOSE) O=$(TOOLSDIR) CROSS_COMPILE=$(CROSS_COMPILE) tools_defconfig cp $(TOOLSDIR)/.config $(TOOLSDIR)/config # board-independent tools $(MAKE) V=$(VERBOSE) O=$(TOOLSDIR) $(DEB_UBOOT_FLAGS) \ CROSS_COMPILE=$(CROSS_COMPILE) \ CROSS_BUILD_TOOLS=$(cross_build_tools) \ NO_SDL=1 \ tools-only $(MAKE) V=$(VERBOSE) O=$(TOOLSDIR) $(DEB_UBOOT_FLAGS) \ CROSS_COMPILE=$(CROSS_COMPILE) \ NO_SDL=1 \ envtools $(CROSS_COMPILE)strip --strip-unneeded --remove-section=.comment --remove-section=.note $(TOOLSDIR)/tools/env/fw_printenv $(CROSS_COMPILE)strip --strip-unneeded --remove-section=.comment --remove-section=.note $(TOOLSDIR)/tools/mkimage $(CROSS_COMPILE)strip --strip-unneeded --remove-section=.comment --remove-section=.note $(TOOLSDIR)/tools/mkenvimage $(CROSS_COMPILE)strip --strip-unneeded --remove-section=.comment --remove-section=.note $(TOOLSDIR)/tools/kwboot $(CROSS_COMPILE)strip --strip-unneeded --remove-section=.comment --remove-section=.note $(TOOLSDIR)/tools/mksunxiboot $(CROSS_COMPILE)strip --strip-unneeded --remove-section=.comment --remove-section=.note $(TOOLSDIR)/tools/dumpimage override_dh_auto_test: ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) # only run tests on native builds BASEDIR=debian/build/tools test/image/test-imagetools.sh endif override_dh_clean: rm -rf debian/build/ rm -f configs/tools_defconfig rm -f configs/novena-rawsd_defconfig dh_clean override_dh_gencontrol: debian/bin/update-substvars dh_gencontrol