Skip to content

Commit

Permalink
Makefile makes git submodule update if hiredis is missing (#56)
Browse files Browse the repository at this point in the history
This PR introduces a Makefile rule that ensures the hiredis dependency
is present before the build process. Specifically, it checks for the existence
of ./deps/hiredis/hiredis.h and, if missing, automatically initializes and
updates the hiredis submodule by running the command:
git submodule update --init deps/hiredis
  • Loading branch information
moticless authored Sep 10, 2024
1 parent 9a20f49 commit 2fdfc0c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
27 changes: 15 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ 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
all: ./deps/hiredis/hiredis.h
$(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 @@ -44,6 +44,9 @@ distclean: clean
example: all
cd examples && export LD_LIBRARY_PATH=../lib && ./example1

./deps/hiredis/hiredis.h:
git submodule update --init deps/hiredis

# ------------------------- DEBUG -------------------------------------

debug:
Expand Down
8 changes: 4 additions & 4 deletions deps/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
all:
$(MAKE) -C redis -f Makefile all
$(MAKE) -C hiredis -f Makefile all
$(MAKE) -C redis all
$(MAKE) -C hiredis all

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


.PHONY: all clean

0 comments on commit 2fdfc0c

Please sign in to comment.