Skip to content

Commit

Permalink
Minor makefile update
Browse files Browse the repository at this point in the history
* We also want to optimize when linking
* Remove some dead assignments
  • Loading branch information
michael-grunder committed Jun 26, 2024
1 parent 8cd807d commit 429a7c2
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ TEST_DIR = tests
INCLUDE_DIR = include/valkey

TEST_SRCS = $(TEST_DIR)/client_test.c
TEST_OBJS = $(patsubst $(TEST_DIR)/%.c,$(OBJ_DIR)/%.o,$(TEST_SRCS))
TEST_BINS = $(patsubst $(TEST_DIR)/%.c,$(TEST_DIR)/%,$(TEST_SRCS))

SOURCES = $(filter-out $(wildcard $(SRC_DIR)/*ssl*.c), $(wildcard $(SRC_DIR)/*.c))
Expand Down Expand Up @@ -71,7 +70,7 @@ DYLIB_MAJOR_NAME=$(LIBNAME).$(DYLIBSUFFIX).$(LIBVALKEY_MAJOR)
DYLIB_ROOT_NAME=$(LIBNAME).$(DYLIBSUFFIX)
DYLIBNAME=$(LIB_DIR)/$(DYLIB_ROOT_NAME)

DYLIB_MAKE_CMD=$(CC) $(PLATFORM_FLAGS) -shared -Wl,-soname,$(DYLIB_MINOR_NAME)
DYLIB_MAKE_CMD=$(CC) $(OPTIMIZATION) $(PLATFORM_FLAGS) -shared -Wl,-soname,$(DYLIB_MINOR_NAME)
STLIB_ROOT_NAME=$(LIBNAME).$(STLIBSUFFIX)
STLIBNAME=$(LIB_DIR)/$(STLIB_ROOT_NAME)
STLIB_MAKE_CMD=$(AR) rcs
Expand All @@ -85,7 +84,7 @@ SSL_DYLIB_MAJOR_NAME=$(SSL_LIBNAME).$(DYLIBSUFFIX).$(LIBVALKEY_MAJOR)
SSL_ROOT_DYLIB_NAME=$(SSL_LIBNAME).$(DYLIBSUFFIX)
SSL_DYLIBNAME=$(LIB_DIR)/$(SSL_LIBNAME).$(DYLIBSUFFIX)
SSL_STLIBNAME=$(LIB_DIR)/$(SSL_LIBNAME).$(STLIBSUFFIX)
SSL_DYLIB_MAKE_CMD=$(CC) $(PLATFORM_FLAGS) -shared -Wl,-soname,$(SSL_DYLIB_MINOR_NAME)
SSL_DYLIB_MAKE_CMD=$(CC) $(OPTIMIZATION) $(PLATFORM_FLAGS) -shared -Wl,-soname,$(SSL_DYLIB_MINOR_NAME)

USE_SSL?=0

Expand Down Expand Up @@ -155,7 +154,7 @@ ifeq ($(uname_S),SunOS)
SUN_SHARED_FLAG=-shared
endif
REAL_LDFLAGS+= -ldl -lnsl -lsocket
DYLIB_MAKE_CMD=$(CC) $(SUN_SHARED_FLAG) -o $(DYLIBNAME) -h $(DYLIB_MINOR_NAME) $(LDFLAGS)
DYLIB_MAKE_CMD=$(CC) $(OPTIMIZATION) $(SUN_SHARED_FLAG) -o $(DYLIBNAME) -h $(DYLIB_MINOR_NAME) $(LDFLAGS)
SSL_DYLIB_MAKE_CMD=$(CC) $(SUN_SHARED_FLAG) -o $(SSL_DYLIBNAME) -h $(SSL_DYLIB_MINOR_NAME) $(LDFLAGS) $(SSL_LDFLAGS)
endif
ifeq ($(uname_S),Darwin)
Expand Down Expand Up @@ -187,7 +186,7 @@ $(OBJ_DIR)/%.o: $(TEST_DIR)/%.c | $(OBJ_DIR)
$(CC) -std=c99 $(REAL_CFLAGS) -I$(INCLUDE_DIR) -MMD -MP -c $< -o $@

$(TEST_DIR)/%: $(OBJ_DIR)/%.o $(STLIBNAME)
$(CC) -o $@ $< $(STLIBNAME) $(SSL_STLIB) $(LDFLAGS) $(SSL_LDLAGS) $(TEST_LDFLAGS)
$(CC) -o $@ $< $(STLIBNAME) $(SSL_STLIB) $(LDFLAGS) $(TEST_LDFLAGS)

$(OBJ_DIR):
mkdir -p $(OBJ_DIR)
Expand All @@ -203,7 +202,6 @@ pkgconfig: $(PKGCONFNAME) $(SSL_PKGCONF)

-include $(OBJS:.o=.d)

TEST_LIBS = $(STLIBNAME) $(SSL_STLIB)
TEST_LDFLAGS = $(SSL_LDFLAGS)
ifeq ($(USE_SSL),1)
TEST_LDFLAGS += -pthread
Expand Down

0 comments on commit 429a7c2

Please sign in to comment.