From 552121d16e0e6bd8b4213f95d8dc321a341164e7 Mon Sep 17 00:00:00 2001 From: Luca Colagrande Date: Wed, 8 Nov 2023 09:40:05 +0100 Subject: [PATCH] target: Add dependency of apps on libraries --- target/snitch_cluster/sw/apps/common.mk | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/target/snitch_cluster/sw/apps/common.mk b/target/snitch_cluster/sw/apps/common.mk index 94eb35236a..3413865dbd 100644 --- a/target/snitch_cluster/sw/apps/common.mk +++ b/target/snitch_cluster/sw/apps/common.mk @@ -41,12 +41,16 @@ INCDIRS += $(ROOT)/sw/blas INCDIRS += $(ROOT)/sw/deps/riscv-opcodes INCDIRS += $(ROOT)/sw/math/include +LIBS = $(MATH_DIR)/build/libmath.a +LIBS += $(RUNTIME_DIR)/build/libsnRuntime.a + +LIBDIRS = $(dir $(LIBS)) +LIBNAMES = $(patsubst lib%,%,$(notdir $(basename $(LIBS)))) + RISCV_LDFLAGS += -L$(abspath $(RUNTIME_DIR)) RISCV_LDFLAGS += -T$(abspath $(SNRT_DIR)/base.ld) -RISCV_LDFLAGS += -L$(abspath $(RUNTIME_DIR)/build/) -RISCV_LDFLAGS += -L$(abspath $(MATH_DIR)/build/) -RISCV_LDFLAGS += -lmath -RISCV_LDFLAGS += -lsnRuntime +RISCV_LDFLAGS += $(addprefix -L,$(LIBDIRS)) +RISCV_LDFLAGS += $(addprefix -l,$(LIBNAMES)) ########### # Outputs # @@ -75,7 +79,7 @@ $(BUILDDIR): $(DEP): $(SRCS) | $(BUILDDIR) $(RISCV_CC) $(RISCV_CFLAGS) -MM -MT '$(ELF)' $< > $@ -$(ELF): $(SRCS) $(DEP) | $(BUILDDIR) +$(ELF): $(SRCS) $(DEP) $(LIBS) | $(BUILDDIR) $(RISCV_CC) $(RISCV_CFLAGS) $(RISCV_LDFLAGS) $(SRCS) -o $@ $(DUMP): $(ELF) | $(BUILDDIR)