From 7ae6604e10bb3acd490feadb3b1b88b31504eff1 Mon Sep 17 00:00:00 2001 From: Bruno Raoult Date: Thu, 8 Aug 2024 08:40:42 +0200 Subject: [PATCH] Makefile: add dependency on brlib file --- Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 1f0a673..f6da639 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,9 @@ OBJ := $(addprefix $(OBJDIR)/,$(SRC_FN:.c=.o)) TSTSRC := $(wildcard $(TSTDIR)/*.c) LIB := br_$(shell uname -m) # library name -LIBS := $(strip -l$(LIB)) +LIB := $(strip $(LIB)) +LIBFILE := ${BRLIBDIR}/lib$(strip ${LIB}).a +LIBS := $(addprefix -l,$(strip $(LIB))) DEP_FN := $(SRC_FN) DEP := $(addprefix $(DEPDIR)/,$(DEP_FN:.c=.d)) @@ -344,6 +346,7 @@ brlib: $(info calling with build=$(build)) $(MAKE) -e -C $(BRLIB) lib-static unexport build + ##################################### brchess binaries .PHONY: targets cleanbin cleanbindir @@ -355,9 +358,9 @@ cleanbin: cleanbindir: $(call rmdir,$(BINDIR),binaries) -$(TARGET): libs $(OBJ) | $(BINDIR) +$(TARGET): $(LIBFILE) $(OBJ) | $(BINDIR) libs @echo linking $@. - $(CC) $(LDFLAGS) $(OBJ) $(LIBS) -o $@ + $(CC) $(ALL_LDFLAGS) $(OBJ) -o $@ ##################################### pre-processed (.i) and assembler (.s) output .PHONY: cleanasmcpp @@ -490,6 +493,7 @@ wtf: @#echo LIBSRC=$(LIBSRC) zob: + echo $(LIBFILE) @#$(CC) $(LDFLAGS) $(CPPFLAGS) $(CFLAGS) $< $(LIBS) src/util.c -o util ##################################### End of multi-targets