Don't let install flags affect build (#382)

Don't let the Make valiable `USE_REDIS_SYMLINKS` affect the build.
If it does, it causes the second line in the example below (`make
install`) to recompile what was already compiled on the line above, and
this time it's built without BUILD_TLS=yes USE_SYSTEMD=yes.

    make BUILD_TLS=yes USE_SYSTEMD=yes
    make PREFIX=custom/usr USE_REDIS_SYMLINKS=no install

Fixes #377

Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
Signed-off-by: Ping Xie <pingxie@google.com>
This commit is contained in:
Viktor Söderqvist 2024-04-25 23:19:15 +02:00 committed by Ping Xie
parent 2342db3927
commit ee6b93c899
3 changed files with 15 additions and 11 deletions

7
.gitignore vendored
View File

@ -1,5 +1,6 @@
.*.swp
*.o
*.a
*.xo
*.so
*.d
@ -12,6 +13,7 @@ dump.rdb
*-cli
*-sentinel
*-server
*-unit-tests
doc-tools
release
misc/*
@ -40,3 +42,8 @@ Makefile.dep
.ccls-cache/*
compile_commands.json
redis.code-workspace
.cache
.cscope*
.swp
nodes.conf
tests/cluster/tmp/*

View File

@ -342,7 +342,6 @@ USE_REDIS_SYMLINKS?=yes
ifeq ($(USE_REDIS_SYMLINKS),yes)
MAYBE_INSTALL_REDIS_SYMLINK=$(INSTALL_REDIS_SYMLINK)
MAYBE_UNINSTALL_REDIS_SYMLINK=@rm -f $(1)/$(subst $(ENGINE_NAME),redis,$(2))
FINAL_CFLAGS+= -DUSE_REDIS_SYMLINKS
else
MAYBE_INSTALL_REDIS_SYMLINK=
MAYBE_UNINSTALL_REDIS_SYMLINK=
@ -549,10 +548,10 @@ install: all
$(call MAYBE_INSTALL_REDIS_SYMLINK,$(REDIS_SENTINEL_NAME),$(INSTALL_BIN))
uninstall:
rm -f $(INSTALL_BIN)/{$(REDIS_SERVER_NAME),$(REDIS_BENCHMARK_NAME),$(REDIS_CLI_NAME),$(REDIS_CHECK_RDB_NAME),$(REDIS_CHECK_AOF_NAME),$(REDIS_SENTINEL_NAME)}
$(call MAYBE_UNINSTALL_REDIS_SYMLINK,$(INSTALL_BIN),$(REDIS_SERVER_NAME))
$(call MAYBE_UNINSTALL_REDIS_SYMLINK,$(INSTALL_BIN),$(REDIS_CLI_NAME))
$(call MAYBE_UNINSTALL_REDIS_SYMLINK,$(INSTALL_BIN),$(REDIS_BENCHMARK_NAME))
$(call MAYBE_UNINSTALL_REDIS_SYMLINK,$(INSTALL_BIN),$(REDIS_CHECK_RDB_NAME))
$(call MAYBE_UNINSTALL_REDIS_SYMLINK,$(INSTALL_BIN),$(REDIS_CHECK_AOF_NAME))
$(call MAYBE_UNINSTALL_REDIS_SYMLINK,$(INSTALL_BIN),$(REDIS_SENTINEL_NAME))
@rm -f $(INSTALL_BIN)/{$(SERVER_NAME),$(ENGINE_BENCHMARK_NAME),$(ENGINE_CLI_NAME),$(ENGINE_CHECK_RDB_NAME),$(ENGINE_CHECK_AOF_NAME),$(ENGINE_SENTINEL_NAME)}
$(call MAYBE_UNINSTALL_REDIS_SYMLINK,$(INSTALL_BIN),$(SERVER_NAME))
$(call MAYBE_UNINSTALL_REDIS_SYMLINK,$(INSTALL_BIN),$(ENGINE_CLI_NAME))
$(call MAYBE_UNINSTALL_REDIS_SYMLINK,$(INSTALL_BIN),$(ENGINE_BENCHMARK_NAME))
$(call MAYBE_UNINSTALL_REDIS_SYMLINK,$(INSTALL_BIN),$(ENGINE_CHECK_RDB_NAME))
$(call MAYBE_UNINSTALL_REDIS_SYMLINK,$(INSTALL_BIN),$(ENGINE_CHECK_AOF_NAME))
$(call MAYBE_UNINSTALL_REDIS_SYMLINK,$(INSTALL_BIN),$(ENGINE_SENTINEL_NAME))

View File

@ -7146,15 +7146,13 @@ int main(int argc, char **argv) {
else if (strstr(exec_name,"valkey-check-aof") != NULL)
redis_check_aof_main(argc,argv);
/* If enable USE_REDIS_SYMLINKS, valkey may install symlinks like
/* valkey may install symlinks like
* redis-server -> valkey-server, redis-check-rdb -> valkey-check-rdb,
* redis-check-aof -> valkey-check-aof, etc. */
#ifdef USE_REDIS_SYMLINKS
if (strstr(exec_name,"redis-check-rdb") != NULL)
redis_check_rdb_main(argc, argv, NULL);
else if (strstr(exec_name,"redis-check-aof") != NULL)
redis_check_aof_main(argc,argv);
#endif
if (argc >= 2) {
j = 1; /* First option to parse in argv[] */