From fa3ee8074bab87c02f86126844bb19369e2a5654 Mon Sep 17 00:00:00 2001 From: Viktor <35473052+viktorxda@users.noreply.github.com> Date: Sat, 3 Jun 2023 04:37:54 +0200 Subject: [PATCH] Makefile: add variable for output directory --- .github/workflows/build.yml | 11 ++++++++--- .github/workflows/toolchain.yml | 2 +- Makefile | 10 +++++----- general/external.mk | 2 +- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bb48df4f..bd71b5ad 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -200,19 +200,24 @@ jobs: with: fetch-depth: 0 + - name: Determine toolchain + run: | + GCC=$(make BOARD=${{matrix.platform}}_lite toolname) + echo GCC=${GCC} >> ${GITHUB_ENV} + - name: Setup ccache if: github.event_name != 'pull_request' uses: actions/cache@v3 with: path: /tmp/ccache - key: ${{matrix.platform}}_${{matrix.release}} + key: ${{env.GCC}} - name: Restore ccache if: github.event_name == 'pull_request' uses: actions/cache/restore@v3 with: path: /tmp/ccache - key: ${{matrix.platform}}_${{matrix.release}} + key: ${{env.GCC}} - name: Restore download uses: actions/cache/restore@v3 @@ -225,7 +230,7 @@ jobs: FAMILY=${{matrix.platform}} RELEASE=${{matrix.release}} IMAGES=${GITHUB_WORKSPACE}/output/images - CONFIG=$(find br-ext-chip-*/configs -name ${FAMILY}_${RELEASE}_defconfig) + CONFIG=$(find br-ext-chip-* -name ${FAMILY}_${RELEASE}_defconfig) export GIT_HASH=$(git rev-parse --short ${GITHUB_SHA}) export GIT_BRANCH=${GITHUB_REF_NAME} diff --git a/.github/workflows/toolchain.yml b/.github/workflows/toolchain.yml index 2b5446d0..db071df4 100644 --- a/.github/workflows/toolchain.yml +++ b/.github/workflows/toolchain.yml @@ -66,7 +66,7 @@ jobs: - name: Build toolchain if: env.BUILD run: | - CONFIG=$(find br-ext-chip-*/configs -name ${{matrix.platform}}_lite_defconfig) + CONFIG=$(find br-ext-chip-* -name ${{matrix.platform}}_lite_defconfig) sed -i "s|EXTERNAL=y|EXTERNAL=n|g" ${CONFIG} export BR2_DL_DIR=/tmp/download make BOARD=${CONFIG} br-sdk diff --git a/Makefile b/Makefile index c13a0cbb..64a90268 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ BR_VER = 2021.02.12 +BR_MAKE = $(MAKE) -C buildroot-$(BR_VER) BR2_EXTERNAL=$(PWD)/general O=$(TARGET) BR_LINK = https://github.com/buildroot/buildroot/archive/refs/tags -BR_FILE = /tmp/download/buildroot-$(BR_VER).tar.gz -BR_MAKE = $(MAKE) -C buildroot-$(BR_VER) BR2_EXTERNAL=$(PWD)/general O=$(PWD)/output +BR_FILE = /tmp/buildroot-$(BR_VER).tar.gz +TARGET ?= $(PWD)/output ifdef BOARD CONFIG = $(shell find br-ext-chip-*/configs -type f | grep -m1 $(BOARD)) @@ -35,7 +36,6 @@ defconfig: prepare @$(BR_MAKE) BR2_DEFCONFIG=$(PWD)/$(CONFIG) defconfig prepare: - @mkdir -p /tmp/download @test -e $(BR_FILE) || wget -c -q $(BR_LINK)/$(BR_VER).tar.gz -O $(BR_FILE) @test -e buildroot-$(BR_VER) || tar -xf $(BR_FILE) -C $(PWD) @@ -46,10 +46,10 @@ buildroot-version: @echo $(BR_VER) clean: - @rm -rf output/target output/.config + @rm -rf $(TARGET)/target $(TARGET)/.config distclean: - @rm -rf output buildroot-$(BR_VER) $(BR_FILE) + @rm -rf buildroot-$(BR_VER) $(BR_FILE) $(TARGET) info: @echo $(CONFIG): diff --git a/general/external.mk b/general/external.mk index e59aec30..e520f4b5 100644 --- a/general/external.mk +++ b/general/external.mk @@ -3,7 +3,7 @@ export OPENIPC_MODEL = $(call qstrip,$(BR2_OPENIPC_MODEL)) export OPENIPC_FAMILY = $(call qstrip,$(BR2_OPENIPC_FAMILY)) export OPENIPC_RELEASE = $(call qstrip,$(BR2_OPENIPC_RELEASE)) -export BR2_EXTERNAL_VENDOR = $(BR2_EXTERNAL)/../br-ext-chip-$(BR2_OPENIPC_VENDOR) +export BR2_EXTERNAL_VENDOR = $(BR2_EXTERNAL)/../br-ext-chip-$(OPENIPC_VENDOR) OPENIPC_TOOLCHAIN = latest/$(shell $(BR2_EXTERNAL)/scripts/show_toolchains.sh $(BR2_DEFCONFIG)) include $(sort $(wildcard $(BR2_EXTERNAL)/package/*/*.mk))