summaryrefslogtreecommitdiffstats
path: root/patches/i2c-tools-4.0/0002-tools-Module.mk-Add-missing-dependencies.patch
blob: c4d5b9bda1d0c4ddb8dd50e359a64f967669aa20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
From: Jean Delvare <jdelvare@suse.de>
Date: Thu, 14 Dec 2017 08:52:26 +0100
Subject: [PATCH] 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.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Tested-by: Angelo Compagnucci <angelo@amarulasolutions.com>
Acked-by: Angelo Compagnucci <angelo@amarulasolutions.com>
---
 lib/Module.mk   |  7 +++++++
 tools/Module.mk | 10 +++++-----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/lib/Module.mk b/lib/Module.mk
index fd2c8c4e59f5..92aba30131f0 100644
--- a/lib/Module.mk
+++ b/lib/Module.mk
@@ -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
 #
diff --git a/tools/Module.mk b/tools/Module.mk
index 6421a23883bf..609de7a24784 100644
--- a/tools/Module.mk
+++ b/tools/Module.mk
@@ -24,19 +24,19 @@ TOOLS_TARGETS	:= i2cdetect i2cdump i2cset i2cget i2ctransfer
 # 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)
 
 #