Skip to content

Commit

Permalink
Build hiredis only for 'make test' rule
Browse files Browse the repository at this point in the history
  • Loading branch information
moticless committed Sep 9, 2024
1 parent f953088 commit c329fd8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 19 deletions.
35 changes: 21 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,26 @@ else
PKGCONFIGDIR = $(LIBDIR)/pkgconfig
endif

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

# ------------------------- ALL --------------------------------------

all:
$(MAKE) -C deps -f Makefile all
$(MAKE) -C src/lib -f Makefile all
$(MAKE) -C src/ext -f Makefile all
$(MAKE) -C src/cli -f Makefile all
$(MAKE) -C examples -f Makefile all
$(MAKE) -C deps all
$(MAKE) -C src/lib all
$(MAKE) -C src/ext all
$(MAKE) -C src/cli all
$(MAKE) -C examples all

clean:
$(MAKE) -C deps -f Makefile clean
$(MAKE) -C src/lib -f Makefile clean
$(MAKE) -C src/ext -f Makefile clean
$(MAKE) -C src/cli -f Makefile clean
$(MAKE) -C examples -f Makefile clean
$(MAKE) -C test -f Makefile clean
$(MAKE) -C deps clean
$(MAKE) -C src/lib clean
$(MAKE) -C src/ext clean
$(MAKE) -C src/cli clean
$(MAKE) -C examples clean
$(MAKE) -C test clean
rm -f librdb.pc
rm -f librdb-ext.pc

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

# ------------------------- TEST --------------------------------------

build_test: all
$(MAKE) -C test -f Makefile all
hiredis_submodule:
@if [ -z "$(HIREDIS_VERSION)" ]; then \
echo "Submodule 'hiredis' is not up to date. Run 'git submodule update --init' to update it."; \
exit 1; \
fi

build_test: all hiredis_submodule
$(MAKE) -C deps all
$(MAKE) -C test all

test: build_test
./runtests
Expand Down
11 changes: 6 additions & 5 deletions deps/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
all:
$(MAKE) -C redis -f Makefile all
$(MAKE) -C hiredis -f Makefile all
$(MAKE) -C redis all

clean:
$(MAKE) -C redis -f Makefile clean
$(MAKE) -C hiredis -f Makefile all
$(MAKE) -C redis clean
$(MAKE) -C hiredis all

test:
$(MAKE) -C hiredis all

.PHONY: all clean
.PHONY: all clean test

0 comments on commit c329fd8

Please sign in to comment.