Add rule to build Make and copy to prebuilts
To work around issues with legacy Make versions on some systems, add a
rule to build Make and copy it into the prebuilts directory. This
creates a static build and will be used as the main instance of Make.
Test: make $PWD/prebuilts/linux-x86/make
Change-Id: I99a3d90fa7c75daac64f28d9c0b4a21143be7363
diff --git a/Makefile b/Makefile
index c244413..56c19ea 100644
--- a/Makefile
+++ b/Makefile
@@ -437,6 +437,7 @@
PREBUILTS_ROOTFS_EXT4 := $(ROOT_DIR)/prebuilts/linux-aarch64/images/rootfs.ext4
PREBUILTS_QEMU_ROM := $(ROOT_DIR)/prebuilts/linux-aarch64/images/efi-virtio.rom
PREBUILTS_QEMU_BIN := $(ROOT_DIR)/prebuilts/linux-x86/qemu
+PREBUILTS_MAKE_BIN := $(ROOT_DIR)/prebuilts/linux-x86/make
CUSTOM_CROSVM_EXT4 := $(OUT_DIR)/images/crosvm.ext4
@@ -451,7 +452,8 @@
$(PREBUILTS_ROOTFS_EXT4) \
update-prebuilts-crosvm \
$(PREBUILTS_QEMU_ROM) \
- $(PREBUILTS_QEMU_BIN)
+ $(PREBUILTS_QEMU_BIN) \
+ $(PREBUILTS_MAKE_BIN)
$(PREBUILTS_ROOTFS_EXT4): buildroot
mkdir -p $(shell dirname $@)
@@ -491,6 +493,15 @@
mkdir -p $@/bin
cp $(OUT_DIR)/qemu/qemu-system-aarch64 $@/bin
+.PHONY: $(PREBUILTS_MAKE_BIN)
+$(PREBUILTS_MAKE_BIN):
+ - rm -rf $(OUT_DIR)/make
+ mkdir -p $(OUT_DIR)/make $@/bin
+ wget 'https://ftp.gnu.org/gnu/make/make-4.3.tar.gz' -O - | \
+ tar -xzf - -C $(OUT_DIR)/make --strip 1
+ (cd $(OUT_DIR)/make && ./configure LDFLAGS="-static" && $(MAKE))
+ cp $(OUT_DIR)/make/make $@/bin/
+
##
## Run tests
##