This ensures that the tarball is regenerated after make clean or after switching
to a different target
Signed-off-by: Felix Fietkau <nbd@nbd.name>
curdir:=target
$(curdir)/subtargets:=install
-$(curdir)/builddirs:=linux sdk imagebuilder toolchain
+$(curdir)/builddirs:=linux sdk imagebuilder toolchain llvm-bpf
$(curdir)/builddirs-default:=linux
-$(curdir)/builddirs-install:=linux $(if $(CONFIG_SDK),sdk) $(if $(CONFIG_IB),imagebuilder) $(if $(CONFIG_MAKE_TOOLCHAIN),toolchain)
+$(curdir)/builddirs-install:=\
+ linux \
+ $(if $(CONFIG_SDK),sdk) \
+ $(if $(CONFIG_IB),imagebuilder) \
+ $(if $(CONFIG_MAKE_TOOLCHAIN),toolchain) \
+ $(if $(CONFIG_SDK_LLVM_BPF),llvm-bpf)
$(curdir)/sdk/install:=$(curdir)/linux/install
$(curdir)/imagebuilder/install:=$(curdir)/linux/install
--- /dev/null
+#
+# Copyright (C) 2021 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+override MAKEFLAGS=
+
+LLVM_VERSION := $(shell cat $(STAGING_DIR_HOST)/llvm-bpf/.llvm-version)
+
+LLVM_BPF_PREFIX := llvm-bpf-$(LLVM_VERSION).$(HOST_OS)-$(HOST_ARCH)
+LLVM_TAR := $(BIN_DIR)/$(LLVM_BPF_PREFIX).tar.xz
+
+$(LLVM_TAR): $(HOST_STAMP_INSTALLED)
+ tar -C $(STAGING_DIR_HOST) \
+ -I '$(STAGING_DIR_HOST)/bin/xz -7e -T$(if $(filter 1,$(NPROC)),2,0)' \
+ -cf $@.tmp llvm-bpf $(LLVM_BPF_PREFIX)
+ mv $@.tmp $@
+
+download:
+prepare:
+compile: $(LLVM_TAR)
+install: compile
+
+clean:
+ rm -f $(LLVM_TAR)
$(curdir)/install: $(curdir)/compile
-tools_config = CONFIG_SDK_LLVM_BPF
-tools_enabled = $(foreach tool,$(sort $(tools-y) $(tools-)),$(if $(filter $(tool),$(tools-y)),y,n))$(foreach c,$(tools_config),$(if $($(c)),y,n))
+tools_enabled = $(foreach tool,$(sort $(tools-y) $(tools-)),$(if $(filter $(tool),$(tools-y)),y,n))
$(eval $(call stampfile,$(curdir),tools,compile,,_$(subst $(space),,$(tools_enabled)),$(STAGING_DIR_HOST)))
$(eval $(call stampfile,$(curdir),tools,check,$(TMP_DIR)/.build,,$(STAGING_DIR_HOST)))
$(eval $(call subdir,$(curdir)))
-DLLVM_TOOLCHAIN_TOOLS="llvm-objcopy;llvm-objdump;llvm-readelf;llvm-strip;llvm-ar;llvm-as;llvm-dis;llvm-link;llvm-nm;llvm-ranlib;llc;opt" \
-DCMAKE_SKIP_RPATH=OFF
-$(BIN_DIR)/$(LLVM_BPF_PREFIX).tar.xz: $(HOST_STAMP_INSTALLED)
- echo "$(PKG_VERSION)" > $(CMAKE_HOST_INSTALL_PREFIX)/.llvm-version
- STRIP_KMOD= PATCHELF= STRIP=strip $(SCRIPT_DIR)/rstrip.sh $(STAGING_DIR_HOST)/llvm-bpf
- tar -C $(STAGING_DIR_HOST) \
- -I '$(STAGING_DIR_HOST)/bin/xz -7e -T$(if $(filter 1,$(NPROC)),2,0)' \
- -cf $@.tmp llvm-bpf $(LLVM_BPF_PREFIX)
- mv $@.tmp $@
-
-ifneq ($(CONFIG_SDK_LLVM_BPF),)
-compile: $(BIN_DIR)/$(LLVM_BPF_PREFIX).tar.xz
-endif
-
define Host/Install
rm -rf $(STAGING_DIR_HOST)/llvm-bpf*
$(Host/Install/Default)
ln -s $(LLVM_BPF_PREFIX) $(STAGING_DIR_HOST)/llvm-bpf
+ STRIP_KMOD= PATCHELF= STRIP=strip $(SCRIPT_DIR)/rstrip.sh $(STAGING_DIR_HOST)/llvm-bpf
+ echo "$(PKG_VERSION)" > $(CMAKE_HOST_INSTALL_PREFIX)/.llvm-version
endef
define Host/Uninstall