Skip to content

Commit 9915396

Browse files
committed
Build hiredis only for 'make test' rule
1 parent f953088 commit 9915396

File tree

2 files changed

+27
-19
lines changed

2 files changed

+27
-19
lines changed

Makefile

+21-14
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,26 @@ else
1717
PKGCONFIGDIR = $(LIBDIR)/pkgconfig
1818
endif
1919

20+
HIREDIS_VERSION := $(shell git submodule status deps/hiredis | grep -oP "\(v[0-9]+\.[0-9]+\.[0-9]-[0-9]*-[a-z0-9]*\)")
2021
LIBRDB_VERSION = $(shell grep -oP '(?<=LIBRDB_VERSION_STRING ")[0-9]+\.[0-9]+\.[0-9]+' ./src/lib/version.h)
2122
export LIBRDB_VERSION
2223

2324
# ------------------------- ALL --------------------------------------
2425

2526
all:
26-
$(MAKE) -C deps -f Makefile all
27-
$(MAKE) -C src/lib -f Makefile all
28-
$(MAKE) -C src/ext -f Makefile all
29-
$(MAKE) -C src/cli -f Makefile all
30-
$(MAKE) -C examples -f Makefile all
27+
$(MAKE) -C deps all
28+
$(MAKE) -C src/lib all
29+
$(MAKE) -C src/ext all
30+
$(MAKE) -C src/cli all
31+
$(MAKE) -C examples all
3132

3233
clean:
33-
$(MAKE) -C deps -f Makefile clean
34-
$(MAKE) -C src/lib -f Makefile clean
35-
$(MAKE) -C src/ext -f Makefile clean
36-
$(MAKE) -C src/cli -f Makefile clean
37-
$(MAKE) -C examples -f Makefile clean
38-
$(MAKE) -C test -f Makefile clean
34+
$(MAKE) -C deps clean
35+
$(MAKE) -C src/lib clean
36+
$(MAKE) -C src/ext clean
37+
$(MAKE) -C src/cli clean
38+
$(MAKE) -C examples clean
39+
$(MAKE) -C test clean
3940
rm -f librdb.pc
4041
rm -f librdb-ext.pc
4142

@@ -50,9 +51,15 @@ debug:
5051
OPTIMIZATION="-O0" LIBRDB_DEBUG=1 $(MAKE)
5152

5253
# ------------------------- TEST --------------------------------------
53-
54-
build_test: all
55-
$(MAKE) -C test -f Makefile all
54+
hiredis_submodule:
55+
@if [ -z "$(HIREDIS_VERSION)" ]; then \
56+
echo "Submodule 'hiredis' is not up to date. Run 'git submodule update --init' to update it."; \
57+
exit 1; \
58+
fi
59+
60+
build_test: all hiredis_submodule
61+
$(MAKE) -C deps all
62+
$(MAKE) -C test all
5663

5764
test: build_test
5865
./runtests

deps/Makefile

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
all:
2-
$(MAKE) -C redis -f Makefile all
3-
$(MAKE) -C hiredis -f Makefile all
2+
$(MAKE) -C redis all
43

54
clean:
6-
$(MAKE) -C redis -f Makefile clean
7-
$(MAKE) -C hiredis -f Makefile all
5+
$(MAKE) -C redis clean
6+
$(MAKE) -C hiredis all
87

8+
test:
9+
$(MAKE) -C hiredis all
910

10-
.PHONY: all clean
11+
.PHONY: all clean test

0 commit comments

Comments
 (0)