Skip to content

Commit

Permalink
target: Add dependency of apps on libraries (pulp-platform#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
colluca committed Nov 8, 2023
1 parent 11366d5 commit 5555bfc
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions target/snitch_cluster/sw/apps/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,16 @@ INCDIRS += $(SNRT_DIR)/src/omp
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 #
Expand Down Expand Up @@ -74,7 +78,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)
Expand Down

0 comments on commit 5555bfc

Please sign in to comment.