Skip to content

Commit

Permalink
Makefile_v1,CMakeLists.txt: use git submodule option --depth only if …
Browse files Browse the repository at this point in the history
…available
  • Loading branch information
DDvO committed Nov 14, 2024
1 parent fb5b449 commit 0fc387e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ set_target_properties(${LIBGENCMP_NAME} PROPERTIES

find_package(Git)
if(GIT_FOUND)
set(GIT_DEPTH --depth 1) # used to speed up getting submodules
# add --progress if the tool supports it
execute_process(COMMAND ${CMAKE_COMMAND} -E env LC_ALL=C ${GIT_EXECUTABLE} --help submodule
OUTPUT_VARIABLE _TMP_HELP
Expand All @@ -158,6 +157,9 @@ if(GIT_FOUND)
if("${_TMP_HELP}" MATCHES "--progress")
set(GIT_PROGRESS "--progress") # gives lengthy output in CI runs
endif()
if("${_TMP_HELP}" MATCHES "--depth")
set(GIT_DEPTH --depth 1) # used to speed up getting submodules
endif()
if(DEFINED USE_LIBCMP)
set(submodules libsecutils cmpossl)
else()
Expand Down
10 changes: 7 additions & 3 deletions Makefile_v1
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,15 @@ else
endif
endif

ifeq ($(shell git help submodule | grep progress),)
GIT_HELP=$(shell git help submodule)
ifeq ($(findstring --progress,$(GIT_HELP)),)
GIT_PROGRESS=
else
# GIT_PROGRESS=--progress # disabled as gives lengthy output in CI runs
endif
ifneq ($(findstring --depth,$(GIT_HELP)),)
GIT_DEPTH=--depth 1
endif

################################################################
# generic CMP Client library and CLI-based client
Expand Down Expand Up @@ -251,7 +255,7 @@ $(SECUTILS_OUT_LIB):

.phony: update_secutils build_secutils
update_secutils:
git submodule update $(GIT_PROGRESS) --init --depth 1 $(SECUTILS_DIR)
git submodule update $(GIT_PROGRESS) --init $(GIT_DEPTH) $(SECUTILS_DIR)
build_secutils: # not: update_secutils
$(MAKE) -C $(SECUTILS_DIR) -f Makefile_v1 -s build_all $(SET_NDEBUG) $(SET_DEBUG_FLAGS) CFLAGS="$(CFLAGS) $(OSSL_VERSION_QUIRKS)" SECUTILS_USE_ICV=$(SECUTILS_USE_ICV) SECUTILS_USE_UTA=$(SECUTILS_USE_UTA) SECUTILS_NO_TLS=$(SECUTILS_NO_TLS) OPENSSL_DIR="$(OPENSSL_DIR)" OUT_DIR="$(OUT_DIR_REVERSE_DIR)"

Expand All @@ -273,7 +277,7 @@ endif

.phony: update_cmpossl build_cmpossl
update_cmpossl:
git submodule update $(GIT_PROGRESS) --init --depth 1 $(LIBCMP_DIR)
git submodule update $(GIT_PROGRESS) --init $(GIT_DEPTH) $(LIBCMP_DIR)
build_cmpossl: # not: update_cmpossl
@ # the old way to build with CMP was: buildCMPforOpenSSL
ifdef USE_LIBCMP
Expand Down

0 comments on commit 0fc387e

Please sign in to comment.