From c12b8cec4b5705504e9016259b1ff69a76ef08d5 Mon Sep 17 00:00:00 2001 From: Jonathon Hall Date: Fri, 11 Aug 2023 10:02:03 -0400 Subject: [PATCH] Makefile: Don't double version number in patches for versioned modules Default the patch version to empty if the module name already includes the version. Fixes application of coreboot patches. Signed-off-by: Jonathon Hall --- Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 400b8840..3a190a8e 100644 --- a/Makefile +++ b/Makefile @@ -330,8 +330,11 @@ define define_module = touch "$(build)/$($1_base_dir)/.patched"; \ fi else - $(eval $1_patch_version ?= $($1_version)) - $(eval $1_patch_name = $1-$($1_patch_version)) + # Versioned modules (each version a separate module) don't need to include + # the version a second time. (The '-' separator is also omitted then.) + # $1_patch_version can still be defined manually. + $(eval $1_patch_version ?= $(if $(filter %-$($1_version),$1),,$($1_version))) + $(eval $1_patch_name = $1$(if $($1_patch_version),-,)$($1_patch_version)) # Fetch and verify the source tar file # wget creates it early, so we have to cleanup if it fails $(packages)/$($1_tar):