Don't use wildcards to look for .go files in tests makefile
GNU Make's wildcard function does not recurse into subdirectories when passed the '**' glob, which results in adding a dependency only to .go files in the first level of subdirectories under the source root. We shell out to 'find' instead, which catches all .go files in the given directory.
Tor Arne Vestbø committed
Apr 7, 2015 at 16:47 UTC
f2dd060e4a34a2106e7a13cb759daca9919e935c
1 file changed
+6
-4
test/Makefile
+6
-4
@@ -18,19 +18,21 @@ clean:
18
19
bins: $(BINS)
20
21
-bin/random: $(RANDOM_SRC)/**/*.go IPFS-BUILD-OPTIONS
21
+find_go_files = $(shell find $(1) -name "*.go")
22
+
23
+bin/random: $(call find_go_files, $(RANDOM_SRC)) IPFS-BUILD-OPTIONS
24
@echo "*** installing $@ ***"
25
go build $(GOFLAGS) -o bin/random $(RANDOM_SRC)/random
26
25
-bin/multihash: $(MULTIHASH_SRC)/**/*.go IPFS-BUILD-OPTIONS
27
+bin/multihash: $(call find_go_files, $(MULTIHASH_SRC)) IPFS-BUILD-OPTIONS
28
@echo "*** installing $@ ***"
29
go build $(GOFLAGS) -o bin/multihash $(MULTIHASH_SRC)/multihash
30
29
-bin/ipfs: $(IPFS_ROOT)/**/*.go IPFS-BUILD-OPTIONS
31
+bin/ipfs: $(call find_go_files, $(IPFS_ROOT)) IPFS-BUILD-OPTIONS
32
@echo "*** installing $@ ***"
33
go build $(GOFLAGS) -o bin/ipfs $(IPFS_CMD)
34
33
-bin/pollEndpoint: $(POLLENDPOINT_SRC)/*.go IPFS-BUILD-OPTIONS
35
+bin/pollEndpoint: $(call find_go_files, $(POLLENDPOINT_SRC)) IPFS-BUILD-OPTIONS
36
@echo "*** installing $@ ***"
37
go build $(GOFLAGS) -o bin/pollEndpoint $(POLLENDPOINT_SRC)
38