1 From 08b0d67ba7eceb862cb17f52eb1911e9579726ea Mon Sep 17 00:00:00 2001
2 From: Jean Delvare <jdelvare@suse.de>
3 Date: Thu, 14 Dec 2017 08:52:26 +0100
4 Subject: [PATCH] tools/Module.mk: Add missing dependencies
6 Better build the library before building the tools which link against
7 it, otherwise parallel builds could run into a race and break.
9 Signed-off-by: Jean Delvare <jdelvare@suse.de>
10 Tested-by: Angelo Compagnucci <angelo@amarulasolutions.com>
11 Acked-by: Angelo Compagnucci <angelo@amarulasolutions.com>
12 Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
14 lib/Module.mk | 7 +++++++
15 tools/Module.mk | 10 +++++-----
16 2 files changed, 12 insertions(+), 5 deletions(-)
18 diff --git a/lib/Module.mk b/lib/Module.mk
19 index 8a58f5b..67afe91 100644
22 @@ -37,6 +37,13 @@ ifeq ($(BUILD_STATIC_LIB),1)
23 LIB_TARGETS += $(LIB_STLIBNAME)
26 +# Library file to link against (static or dynamic)
27 +ifeq ($(USE_STATIC_LIB),1)
28 +LIB_DEPS := $(LIB_DIR)/$(LIB_STLIBNAME)
30 +LIB_DEPS := $(LIB_DIR)/$(LIB_SHBASENAME)
36 diff --git a/tools/Module.mk b/tools/Module.mk
37 index 6421a23..609de7a 100644
40 @@ -24,19 +24,19 @@ TOOLS_TARGETS := i2cdetect i2cdump i2cset i2cget i2ctransfer
44 -$(TOOLS_DIR)/i2cdetect: $(TOOLS_DIR)/i2cdetect.o $(TOOLS_DIR)/i2cbusses.o
45 +$(TOOLS_DIR)/i2cdetect: $(TOOLS_DIR)/i2cdetect.o $(TOOLS_DIR)/i2cbusses.o $(LIB_DEPS)
46 $(CC) $(LDFLAGS) -o $@ $^ $(TOOLS_LDFLAGS)
48 -$(TOOLS_DIR)/i2cdump: $(TOOLS_DIR)/i2cdump.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o
49 +$(TOOLS_DIR)/i2cdump: $(TOOLS_DIR)/i2cdump.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o $(LIB_DEPS)
50 $(CC) $(LDFLAGS) -o $@ $^ $(TOOLS_LDFLAGS)
52 -$(TOOLS_DIR)/i2cset: $(TOOLS_DIR)/i2cset.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o
53 +$(TOOLS_DIR)/i2cset: $(TOOLS_DIR)/i2cset.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o $(LIB_DEPS)
54 $(CC) $(LDFLAGS) -o $@ $^ $(TOOLS_LDFLAGS)
56 -$(TOOLS_DIR)/i2cget: $(TOOLS_DIR)/i2cget.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o
57 +$(TOOLS_DIR)/i2cget: $(TOOLS_DIR)/i2cget.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o $(LIB_DEPS)
58 $(CC) $(LDFLAGS) -o $@ $^ $(TOOLS_LDFLAGS)
60 -$(TOOLS_DIR)/i2ctransfer: $(TOOLS_DIR)/i2ctransfer.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o
61 +$(TOOLS_DIR)/i2ctransfer: $(TOOLS_DIR)/i2ctransfer.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o $(LIB_DEPS)
62 $(CC) $(LDFLAGS) -o $@ $^ $(TOOLS_LDFLAGS)