Skip to contentSkip to conversation

tools/Module.mk: Add missing dependencies

PATCH In review Jean Delvare 2 participants 6 messages Dec 12, 2017 – Dec 14, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/Module.mk: Add missing dependencies

Better build the library before building the tools which link against it, otherwise parallel builds could run into a race and break.

---
 lib/Module.mk   |    7 +++++++
 tools/Module.mk |   10 +++++-----
 2 files changed, 12 insertions(+), 5 deletions(-)
lib/Module.mk +7 -0
@@ -35,6 +35,13 @@ LIB_TARGETS	+= $(LIB_STLIBNAME)
 LIB_OBJECTS	+= smbus.ao
 endif
 
+# Library file to link against (static or dynamic)
+ifeq ($(USE_STATIC_LIB),1)
+LIB_DEPS	:= $(LIB_DIR)/$(LIB_STLIBNAME)
+else
+LIB_DEPS	:= $(LIB_DIR)/$(LIB_SHBASENAME)
+endif
+
 #
 # Libraries
 #
tools/Module.mk +5 -5
@@ -24,19 +24,19 @@ TOOLS_TARGETS	:= i2cdetect i2cdump i2cse
 # Programs
 #
 
-$(TOOLS_DIR)/i2cdetect: $(TOOLS_DIR)/i2cdetect.o $(TOOLS_DIR)/i2cbusses.o
+$(TOOLS_DIR)/i2cdetect: $(TOOLS_DIR)/i2cdetect.o $(TOOLS_DIR)/i2cbusses.o $(LIB_DEPS)
 	$(CC) $(LDFLAGS) -o $@ $^ $(TOOLS_LDFLAGS)
 
-$(TOOLS_DIR)/i2cdump: $(TOOLS_DIR)/i2cdump.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o
+$(TOOLS_DIR)/i2cdump: $(TOOLS_DIR)/i2cdump.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o $(LIB_DEPS)
 	$(CC) $(LDFLAGS) -o $@ $^ $(TOOLS_LDFLAGS)
 
-$(TOOLS_DIR)/i2cset: $(TOOLS_DIR)/i2cset.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o
+$(TOOLS_DIR)/i2cset: $(TOOLS_DIR)/i2cset.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o $(LIB_DEPS)
 	$(CC) $(LDFLAGS) -o $@ $^ $(TOOLS_LDFLAGS)
 
-$(TOOLS_DIR)/i2cget: $(TOOLS_DIR)/i2cget.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o
+$(TOOLS_DIR)/i2cget: $(TOOLS_DIR)/i2cget.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o $(LIB_DEPS)
 	$(CC) $(LDFLAGS) -o $@ $^ $(TOOLS_LDFLAGS)
 
-$(TOOLS_DIR)/i2ctransfer: $(TOOLS_DIR)/i2ctransfer.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o
+$(TOOLS_DIR)/i2ctransfer: $(TOOLS_DIR)/i2ctransfer.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o $(LIB_DEPS)
 	$(CC) $(LDFLAGS) -o $@ $^ $(TOOLS_LDFLAGS)
 
 #
Signature · 2 lines
Jean Delvare
SUSE L3 Support
Tested-by Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · Jean Delvare

Better build the library before building the tools which link against it, otherwise parallel builds could run into a race and break.

Quoted 53 lines
---
 lib/Module.mk   |    7 +++++++
 tools/Module.mk |   10 +++++-----
 2 files changed, 12 insertions(+), 5 deletions(-)
lib/Module.mk +7 -0
@@ -35,6 +35,13 @@ LIB_TARGETS  += $(LIB_STLIBNAME)
 LIB_OBJECTS    += smbus.ao
 endif
 
+# Library file to link against (static or dynamic)
+ifeq ($(USE_STATIC_LIB),1)
+LIB_DEPS       := $(LIB_DIR)/$(LIB_STLIBNAME)
+else
+LIB_DEPS       := $(LIB_DIR)/$(LIB_SHBASENAME)
+endif
+
 #
 # Libraries
 #
tools/Module.mk +5 -6
@@ -24,19 +24,19 @@ TOOLS_TARGETS       := i2cdetect i2cdump i2cse
 # Programs
 #
 
-$(TOOLS_DIR)/i2cdetect: $(TOOLS_DIR)/i2cdetect.o $(TOOLS_DIR)/i2cbusses.o
+$(TOOLS_DIR)/i2cdetect: $(TOOLS_DIR)/i2cdetect.o $(TOOLS_DIR)/i2cbusses.o $(LIB_DEPS)
        $(CC) $(LDFLAGS) -o $@ $^ $(TOOLS_LDFLAGS)
 
-$(TOOLS_DIR)/i2cdump: $(TOOLS_DIR)/i2cdump.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o
+$(TOOLS_DIR)/i2cdump: $(TOOLS_DIR)/i2cdump.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o $(LIB_DEPS)
        $(CC) $(LDFLAGS) -o $@ $^ $(TOOLS_LDFLAGS)
 
-$(TOOLS_DIR)/i2cset: $(TOOLS_DIR)/i2cset.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o
+$(TOOLS_DIR)/i2cset: $(TOOLS_DIR)/i2cset.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o $(LIB_DEPS)
        $(CC) $(LDFLAGS) -o $@ $^ $(TOOLS_LDFLAGS)
 
-$(TOOLS_DIR)/i2cget: $(TOOLS_DIR)/i2cget.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o
+$(TOOLS_DIR)/i2cget: $(TOOLS_DIR)/i2cget.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o $(LIB_DEPS)
        $(CC) $(LDFLAGS) -o $@ $^ $(TOOLS_LDFLAGS)
 
-$(TOOLS_DIR)/i2ctransfer: $(TOOLS_DIR)/i2ctransfer.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o
+$(TOOLS_DIR)/i2ctransfer: $(TOOLS_DIR)/i2ctransfer.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o $(LIB_DEPS)
        $(CC) $(LDFLAGS) -o $@ $^ $(TOOLS_LDFLAGS)
 
 #
 
 
--

Jean Delvare
SUSE L3 Support

#3 lore raw
Quoted 9 lines · Jean Delvare
Quoted 6 lines · Angelo Compagnucci
Quoted 2 lines · Jean Delvare

Better build the library before building the tools which link against it, otherwise parallel builds could run into a race and break.

Thank you Angelo, your review and testing is highly appreciated :-)

You're welcome! Could you please review this one:
https://patchwork.ozlabs.org/patch/847141/

Thanks!

Quoted 6 lines

Fix committed.

--
Jean Delvare
SUSE L3 Support

#4 lore raw
Quoted 5 lines · Angelo Compagnucci
Quoted 1 line · Jean Delvare

Thank you Angelo, your review and testing is highly appreciated :-)

You're welcome! Could you please review this one:
https://patchwork.ozlabs.org/patch/847141/

Certainly. I don't think I received that one, you forgot to Cc me maybe?

Signature · 2 lines
Jean Delvare
SUSE L3 Support
#5 lore raw
Quoted 8 lines · Jean Delvare
Quoted 5 lines · Angelo Compagnucci
Quoted 1 line · Jean Delvare

Thank you Angelo, your review and testing is highly appreciated :-)

You're welcome! Could you please review this one:
https://patchwork.ozlabs.org/patch/847141/

Certainly. I don't think I received that one, you forgot to Cc me maybe?

Yes, unfortunately ...

Thanks!

Quoted 4 lines

--
Jean Delvare
SUSE L3 Support