From 6bd36b959bc8e8e5af53229a1d51bec38b9c781a Mon Sep 17 00:00:00 2001
From: Rahix <rahix@rahix.de>
Date: Mon, 10 Jun 2019 17:36:09 +0200
Subject: [PATCH] fix(build): Make meson <0.46.0 work

Signed-off-by: Rahix <rahix@rahix.de>
---
 hw-tests/bmatest/meson.build                             | 1 +
 hw-tests/bmetest/meson.build                             | 1 +
 hw-tests/dual-core/meson.build                           | 2 ++
 hw-tests/ecgtest/meson.build                             | 1 +
 hw-tests/hello-freertos/meson.build                      | 1 +
 hw-tests/hello-world/meson.build                         | 1 +
 hw-tests/imutest/meson.build                             | 1 +
 hw-tests/ips/meson.build                                 | 1 +
 .../Libraries/CMSIS/Device/Maxim/MAX32665/meson.build    | 9 +++------
 9 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/hw-tests/bmatest/meson.build b/hw-tests/bmatest/meson.build
index ad46a417..6cf3d401 100644
--- a/hw-tests/bmatest/meson.build
+++ b/hw-tests/bmatest/meson.build
@@ -4,6 +4,7 @@ executable(
   name + '.elf',
   'main.c',
   dependencies: [libcard10, max32665_startup],
+  link_whole: max32665_startup_lib,
   link_args: [
     '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
   ],
diff --git a/hw-tests/bmetest/meson.build b/hw-tests/bmetest/meson.build
index 31ad3585..212ad746 100644
--- a/hw-tests/bmetest/meson.build
+++ b/hw-tests/bmetest/meson.build
@@ -4,6 +4,7 @@ executable(
   name + '.elf',
   'main.c',
   dependencies: [libcard10, max32665_startup],
+  link_whole: max32665_startup_lib,
   link_args: [
     '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
   ],
diff --git a/hw-tests/dual-core/meson.build b/hw-tests/dual-core/meson.build
index 2689d8f4..2fbc9644 100644
--- a/hw-tests/dual-core/meson.build
+++ b/hw-tests/dual-core/meson.build
@@ -3,6 +3,7 @@ executable(
   name + '.elf',
   'main.c',
   dependencies: [libcard10, max32665_startup_core0],
+  link_whole: max32665_startup_core0_lib,
   link_args: [
     '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
   ],
@@ -13,6 +14,7 @@ executable(
   name + '.elf',
   'core1.c',
   dependencies: [periphdriver, board_card10, max32665_startup_core1],
+  link_whole: max32665_startup_core1_lib,
   link_args: [
     '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
   ],
diff --git a/hw-tests/ecgtest/meson.build b/hw-tests/ecgtest/meson.build
index e7cff9b5..b370a696 100644
--- a/hw-tests/ecgtest/meson.build
+++ b/hw-tests/ecgtest/meson.build
@@ -4,6 +4,7 @@ executable(
   name + '.elf',
   'main.c',
   dependencies: [libcard10, max32665_startup],
+  link_whole: max32665_startup_lib,
   link_args: [
     '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
   ],
diff --git a/hw-tests/hello-freertos/meson.build b/hw-tests/hello-freertos/meson.build
index 4f6446c9..c0d54cea 100644
--- a/hw-tests/hello-freertos/meson.build
+++ b/hw-tests/hello-freertos/meson.build
@@ -22,6 +22,7 @@ executable(
   include_directories: freertos_sdk_includes,
   dependencies: [libcard10, max32665_startup],
   link_with: freertos,
+  link_whole: max32665_startup_lib,
   link_args: [
     '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
   ],
diff --git a/hw-tests/hello-world/meson.build b/hw-tests/hello-world/meson.build
index f559d149..258d1cfb 100644
--- a/hw-tests/hello-world/meson.build
+++ b/hw-tests/hello-world/meson.build
@@ -4,6 +4,7 @@ executable(
   name + '.elf',
   'main.c',
   dependencies: [libcard10, max32665_startup],
+  link_whole: max32665_startup_lib,
   link_args: [
     '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
   ],
diff --git a/hw-tests/imutest/meson.build b/hw-tests/imutest/meson.build
index a25bc729..28d89697 100644
--- a/hw-tests/imutest/meson.build
+++ b/hw-tests/imutest/meson.build
@@ -4,6 +4,7 @@ executable(
   name + '.elf',
   'main.c',
   dependencies: [libcard10, max32665_startup],
+  link_whole: max32665_startup_lib,
   link_args: [
     '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
   ],
diff --git a/hw-tests/ips/meson.build b/hw-tests/ips/meson.build
index 5a777d59..f38fedd3 100644
--- a/hw-tests/ips/meson.build
+++ b/hw-tests/ips/meson.build
@@ -6,6 +6,7 @@ executable(
   'image/image.c',
   'image/image2.c',
   dependencies: [libcard10, max32665_startup],
+  link_whole: max32665_startup_lib,
   link_args: [
     '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
   ],
diff --git a/lib/sdk/Libraries/CMSIS/Device/Maxim/MAX32665/meson.build b/lib/sdk/Libraries/CMSIS/Device/Maxim/MAX32665/meson.build
index fb1b4eac..9f9b1f64 100644
--- a/lib/sdk/Libraries/CMSIS/Device/Maxim/MAX32665/meson.build
+++ b/lib/sdk/Libraries/CMSIS/Device/Maxim/MAX32665/meson.build
@@ -8,14 +8,13 @@ sources = files(
   './Source/heap.c',
 )
 
-lib = static_library(
+max32665_startup_lib = static_library(
   'max32665-startup',
   sources,
   dependencies: periphdriver,
 )
 
 max32665_startup = declare_dependency(
-  link_whole: lib,
   link_args: [
     '-T', meson.current_source_dir() + 'Source/GCC/max32665.ld',
     '--entry', 'Reset_Handler',
@@ -32,14 +31,13 @@ sources = files(
   './Source/heap.c',
 )
 
-lib = static_library(
+max32665_startup_core0_lib = static_library(
   'max32665-startup-core0',
   sources,
   dependencies: periphdriver,
 )
 
 max32665_startup_core0 = declare_dependency(
-  link_whole: lib,
   link_args: [
     '-T', meson.current_source_dir() + 'Source/GCC/max32665_core0.ld',
     '--entry', 'Reset_Handler',
@@ -56,14 +54,13 @@ sources = files(
   './Source/heap.c',
 )
 
-lib = static_library(
+max32665_startup_core1_lib = static_library(
   'max32665-startup-core1',
   sources,
   dependencies: periphdriver,
 )
 
 max32665_startup_core1 = declare_dependency(
-  link_whole: lib,
   link_args: [
     '-T', meson.current_source_dir() + 'Source/GCC/max32665_core1.ld',
     '--entry', 'Reset_Handler',
-- 
GitLab