From c23b74e150de82a7b076322c14cdc3b1b2e0f940 Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Tue, 20 Sep 2022 12:23:46 +0200 Subject: [PATCH] base-hw: problems with timeout lib in src recipe This commit fixes two issues with the timeout lib and the base-hw src recipe: * Add source files of timeout lib to recipe content. The files weren't copied to the depot until now. However, the archive nonetheless built successfully because of the second issue that is described below. * Get rid of the usage of the BASE_DIR variable in the timeout lib. The BASE_DIR variable always resolves to the repos/base directory even when building in a depot. That said, the use of BASE_DIR in make-files that are not part of the build system itself must be avoided. Instead, REP_DIR, REP_INC_DIR, and $(call select_from_repositories, ...) should be used. Ref #4209 --- repos/base-hw/lib/mk/timeout-hw.mk | 4 ++-- repos/base-hw/recipes/src/base-hw_content.inc | 7 +++++++ repos/base-nova/recipes/api/base-nova/content.mk | 5 ++++- repos/base/lib/mk/timeout-arm.mk | 4 ++-- repos/base/lib/mk/timeout.mk | 2 +- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/repos/base-hw/lib/mk/timeout-hw.mk b/repos/base-hw/lib/mk/timeout-hw.mk index aad9ffa127..eabca0ad00 100644 --- a/repos/base-hw/lib/mk/timeout-hw.mk +++ b/repos/base-hw/lib/mk/timeout-hw.mk @@ -4,6 +4,6 @@ SRC_CC += timer_connection_time.cc SRC_CC += hw/timer_connection_timestamp.cc SRC_CC += duration.cc -INC_DIR += $(BASE_DIR)/src/include +REP_INC_DIR += src/include -vpath % $(BASE_DIR)/src/lib/timeout +vpath % $(call select_from_repositories,src/lib/timeout) diff --git a/repos/base-hw/recipes/src/base-hw_content.inc b/repos/base-hw/recipes/src/base-hw_content.inc index f75752b537..ee1b9ae2f8 100644 --- a/repos/base-hw/recipes/src/base-hw_content.inc +++ b/repos/base-hw/recipes/src/base-hw_content.inc @@ -115,6 +115,12 @@ SRC_LIB_BASE += $(notdir $(wildcard $(BASE_HW_DIR)/src/lib/base/*.cc)) \ $(notdir $(wildcard $(BASE_DIR)/src/lib/base/*.cc)) \ ${call selected_content,SRC_LIB_BASE_SPECS} +SRC_LIB_TIMEOUT += duration.cc \ + hw/timer_connection_timestamp.cc \ + timeout.cc \ + timer_connection.cc \ + timer_connection_time.cc + SRC_LIB_STARTUP += init_main_thread.cc _main.cc \ $(addprefix spec/,${call selected_content,SRC_LIB_STARTUP_SPECS}) @@ -142,6 +148,7 @@ CONTENT += $(addprefix src/timer/,$(SRC_TIMER)) \ $(addprefix src/bootstrap/,$(SRC_BOOTSTRAP)) \ $(addprefix lib/mk/,$(LIB_MK)) \ $(addprefix src/lib/base/,$(SRC_LIB_BASE)) \ + $(addprefix src/lib/timeout/,$(SRC_LIB_TIMEOUT)) \ $(addprefix src/lib/startup/,$(SRC_LIB_STARTUP)) \ $(addprefix src/core/,$(SRC_CORE)) \ src/lib/hw src/lib/ld src/lib/cxx \ diff --git a/repos/base-nova/recipes/api/base-nova/content.mk b/repos/base-nova/recipes/api/base-nova/content.mk index c49d05cd49..dbb72ce372 100644 --- a/repos/base-nova/recipes/api/base-nova/content.mk +++ b/repos/base-nova/recipes/api/base-nova/content.mk @@ -1,5 +1,8 @@ FROM_BASE_NOVA := etc include -FROM_BASE := lib/mk/timeout.mk src/lib/timeout + +# base-nova.lib.a depends on timeout.lib.a, which includes base/internal/gloabls.h +FROM_BASE := lib/mk/timeout.mk src/lib/timeout \ + src/include/base/internal/globals.h content: $(FROM_BASE_NOVA) $(FROM_BASE) LICENSE diff --git a/repos/base/lib/mk/timeout-arm.mk b/repos/base/lib/mk/timeout-arm.mk index e4af0c127f..064e501abd 100644 --- a/repos/base/lib/mk/timeout-arm.mk +++ b/repos/base/lib/mk/timeout-arm.mk @@ -3,6 +3,6 @@ SRC_CC += timer_connection.cc SRC_CC += arm/timer_connection_time.cc SRC_CC += duration.cc -INC_DIR += $(BASE_DIR)/src/include +REP_INC_DIR += src/include -vpath % $(BASE_DIR)/src/lib/timeout +vpath % $(call select_from_repositories,src/lib/timeout) diff --git a/repos/base/lib/mk/timeout.mk b/repos/base/lib/mk/timeout.mk index 5862c2343c..871948edda 100644 --- a/repos/base/lib/mk/timeout.mk +++ b/repos/base/lib/mk/timeout.mk @@ -4,6 +4,6 @@ SRC_CC += timer_connection_time.cc SRC_CC += timer_connection_timestamp.cc SRC_CC += duration.cc -INC_DIR += $(BASE_DIR)/src/include +REP_INC_DIR += src/include vpath % $(call select_from_repositories,src/lib/timeout)