From 340c2ed2ef6578483f974e274bf6d638f953a246 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 22 Nov 2021 01:43:43 -0800 Subject: [PATCH] tools/llvm-bpf: move tarball packing to target/llvm-bpf This ensures that the tarball is regenerated after make clean or after switching to a different target Signed-off-by: Felix Fietkau --- target/Makefile | 9 +++++++-- target/llvm-bpf/Makefile | 29 +++++++++++++++++++++++++++++ tools/Makefile | 3 +-- tools/llvm-bpf/Makefile | 14 ++------------ 4 files changed, 39 insertions(+), 16 deletions(-) create mode 100644 target/llvm-bpf/Makefile diff --git a/target/Makefile b/target/Makefile index 7ad26c7177..83f9c4b093 100644 --- a/target/Makefile +++ b/target/Makefile @@ -7,9 +7,14 @@ 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 diff --git a/target/llvm-bpf/Makefile b/target/llvm-bpf/Makefile new file mode 100644 index 0000000000..c9ada017e6 --- /dev/null +++ b/target/llvm-bpf/Makefile @@ -0,0 +1,29 @@ +# +# 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) diff --git a/tools/Makefile b/tools/Makefile index 82a67a00dd..686d5294d3 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -156,8 +156,7 @@ $(curdir)/ := .config prereq $(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))) diff --git a/tools/llvm-bpf/Makefile b/tools/llvm-bpf/Makefile index 586c8dba2d..527b357824 100644 --- a/tools/llvm-bpf/Makefile +++ b/tools/llvm-bpf/Makefile @@ -41,22 +41,12 @@ CMAKE_HOST_OPTIONS += \ -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 -- 2.30.2