Skip to content

Commit c2888d1

Browse files
committed
Update gitmodules; optimize CI Matrix; refine makefile
1 parent 85c5539 commit c2888d1

File tree

5 files changed

+39
-45
lines changed

5 files changed

+39
-45
lines changed

.github/workflows/ci.yml

+24-34
Original file line numberDiff line numberDiff line change
@@ -10,47 +10,37 @@ jobs:
1010
build:
1111
strategy:
1212
matrix:
13-
os:
14-
- "ubuntu-latest"
15-
- "macos-latest"
16-
version:
17-
- "5.0"
18-
- "6.0"
19-
- "6.2"
20-
- "7.0"
21-
- "7.2"
22-
- "7.4"
23-
- "unstable"
24-
compiler:
25-
- "gcc"
26-
- "clang"
27-
28-
exclude:
29-
- os: macos-latest
30-
compiler: gcc
31-
- os: macos-latest
32-
version: "5.0"
33-
- os: macos-latest
34-
version: "6.0"
35-
- os: macos-latest
36-
version: "7.0"
13+
- os: ubuntu-latest
14+
compiler: gcc
15+
version: "5.0"
16+
- os: ubuntu-latest
17+
compiler: clang
18+
version: "6.0"
19+
- os: ubuntu-latest
20+
compiler: gcc
21+
version: "7.0"
22+
- os: ubuntu-latest
23+
compiler: clang
24+
version: "7.2"
25+
- os: ubuntu-latest
26+
compiler: gcc
27+
version: "7.4"
28+
- os: ubuntu-latest
29+
compiler: clang
30+
version: "unstable"
31+
- os: macos-latest
32+
compiler: gcc
33+
version: "7.4"
34+
- os: macos-latest
35+
compiler: clang
36+
version: "unstable"
3737

3838
runs-on: ${{ matrix.os }}
3939

4040
env:
4141
DEBIAN_FRONTEND: noninteractive
4242
CC: ${{ matrix.compiler }}
4343

44-
# TODO: would be nice to connect to a redis server instead of building from source
45-
# services:
46-
# redis:
47-
# image: redis:${{ matrix.version }}
48-
# options: >-
49-
# --health-cmd "redis-cli ping"
50-
# --health-interval 10s
51-
# --health-timeout 5s
52-
# --health-retries 5
53-
5444
steps:
5545
- name: Checkout librdb
5646
uses: actions/checkout@v4

.gitmodules

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[submodule "deps/hiredis"]
22
path = deps/hiredis
33
url = https://github.com/redis/hiredis.git
4+
branch = master

Makefile

+1-4
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ clean:
3939
rm -f librdb.pc
4040
rm -f librdb-ext.pc
4141

42-
distclean: clean
43-
4442
example: all
4543
cd examples && export LD_LIBRARY_PATH=../lib && ./example1
4644

@@ -128,11 +126,10 @@ help:
128126
@echo " valgrind - Run tests with static lib and valgrind"
129127
@echo " example - Run the example"
130128
@echo " clean - Clean without deps folders"
131-
@echo " distclean - Clean including deps folders"
132129
@echo " install - install to (DESTDIR)/(PREFIX)/bin and (DESTDIR)/(PREFIX)/lib"
133130
@echo " By default PREFIX=/usr/local"
134131
@echo " uninstall - Remove from (DESTDIR)\(PREFIX)/bin and (DESTDIR)/(PREFIX)/lib"
135132
@echo " help - Prints this message"
136133

137134

138-
.PHONY: all debug test valgrind example clean distclean install uninstall build_test help
135+
.PHONY: all debug test valgrind example clean install uninstall build_test help

deps/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ all:
44

55
clean:
66
$(MAKE) -C redis clean
7-
$(MAKE) -C hiredis all
7+
$(MAKE) -C hiredis clean
88

99

1010
.PHONY: all clean

src/cli/Makefile

+12-6
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ default: all
22

33
LIB_DIR = ../../lib
44
LIB_NAME = rdb
5-
LIB_NAME_EXT = $(LIB_NAME)-ext
5+
LIB_FILENAME = librdb.a
6+
LIB_NAME_EXT = rdb-ext
7+
LIB_FILENAME_EXT = librdb-ext.a
68

79
# Artifacts:
8-
TARGET_APP = rdb-cli
9-
TARGET_LIB_STATIC_EXT = $(LIB_DIR)/lib$(LIB_NAME_EXT).a
10+
TARGET_APP = rdb-cli
1011

1112
#########################################################################################
1213
SOURCES = $(notdir $(basename $(wildcard *.c)))
@@ -20,10 +21,15 @@ STACK = -fstack-protector-all -Wstack-protector
2021
WARNS = -Wall -Wextra -pedantic -Werror
2122
CFLAGS = -fPIC $(OPTIMIZATION) $(STD) $(STACK) $(WARNS)
2223
DEBUG = -g3 -DDEBUG=1
23-
LIBS = -L /usr/lib -L $(LIB_DIR) -l $(LIB_NAME_EXT) -l $(LIB_NAME)
24+
25+
ifeq ($(shell uname -s),Darwin)
26+
LIBS = -L $(LIB_DIR) -l $(LIB_NAME_EXT) -l $(LIB_NAME)
27+
else
28+
LIBS = -L $(LIB_DIR) -l:$(LIB_FILENAME) -l:$(LIB_FILENAME_EXT)
29+
endif
2430

2531
ifeq ($(BUILD_TLS),yes)
26-
CFLAGS += -DUSE_OPENSSL=1
32+
CFLAGS+=-DUSE_OPENSSL=1
2733
LIBS += -lssl -lcrypto
2834
endif
2935

@@ -36,7 +42,7 @@ all: $(TARGET_APP)
3642
$(TARGET_APP): %: %.c lib_dependency
3743
$(CC) $(CFLAGS) -o $@ $< $(DEBUG) $(LIBS)
3844

39-
lib_dependency: $(LIB_DIR)/lib$(LIB_NAME_EXT).a
45+
lib_dependency: $(LIB_DIR)/$(LIB_FILENAME_EXT)
4046

4147
clean:
4248
@rm -rvf $(TARGETS) ./*.o ../../bin/$(TARGET_APP)

0 commit comments

Comments
 (0)