From ddcd081674eeb11f82c76e3a0f440cdf537bcbbf Mon Sep 17 00:00:00 2001 From: dzaima Date: Thu, 17 Nov 2022 19:59:32 +0200 Subject: [PATCH] introduce replxx submodule system --- .gitignore | 1 + .gitmodules | 3 +++ build/replxxSubmodule | 1 + makefile | 22 ++++++++++++++-------- 4 files changed, 19 insertions(+), 8 deletions(-) create mode 160000 build/replxxSubmodule diff --git a/.gitignore b/.gitignore index 4507d6f3..05235221 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ perf.* /src/singeli/gen /Singeli build/singeliLocal +build/replxxLocal /local/ CBQNHeapDump /test/ffi/ffiTest.o diff --git a/.gitmodules b/.gitmodules index cdb35553..a1daf99c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "build/singeliSubmodule"] path = build/singeliSubmodule url = https://github.com/mlochbaum/Singeli +[submodule "build/replxxSubmodule"] + path = build/replxxSubmodule + url = https://github.com/dzaima/replxx diff --git a/build/replxxSubmodule b/build/replxxSubmodule new file mode 160000 index 00000000..d254e695 --- /dev/null +++ b/build/replxxSubmodule @@ -0,0 +1 @@ +Subproject commit d254e695e4a751fefa09eef52b1452b1835d0598 diff --git a/makefile b/makefile index 3f929ef7..3db96498 100644 --- a/makefile +++ b/makefile @@ -115,6 +115,7 @@ ifeq ($(origin LDFLAGS),command line) endif ifeq ($(REPLXX),1) custom = 1 + REPLXX_DIR = $(shell if [ -d build/replxxLocal ]; then echo build/replxxLocal; else echo build/replxxSubmodule; fi) endif i_LD = $(i_CC) @@ -146,7 +147,7 @@ ifeq ($(custom),) else @[ -x "$$(command -v sha256sum)" ] && hashInput="sha256sum"; \ [ -x "$$(command -v shasum)" ] && hashInput="shasum -a 256"; \ - printf "%s\0%s\0%s\0%s\0%s\0%s" "${i_CC}" "${ALL_CC_FLAGS}" "${ALL_LD_FLAGS}" "${REPLXX}" "${REPLXX_FLAGS}" "${i_CXX}" | $$hashInput | grep -oE '[0-9a-z]{64}' | head -c32 + printf "%s\0%s\0%s\0%s\0%s\0%s\0%s" "${i_CC}" "${ALL_CC_FLAGS}" "${ALL_LD_FLAGS}" "${REPLXX}" "${REPLXX_FLAGS}" "${i_CXX}" "${REPLXX_DIR}" | $$hashInput | grep -oE '[0-9a-z]{64}' | head -c32 endif else @printf "%s" "$(force_build_dir)" @@ -172,12 +173,17 @@ else ifeq ($(origin builddir),command line) @export bd=$$(${MAKE} builddir); \ echo "$$bd" else + ifeq ($(i_singeli), 1) @mkdir -p src/singeli/gen @mkdir -p obj/singeli @${MAKE} postmsg="post-singeli build:" build_singeli endif - + +ifeq ($(REPLXX_DIR),build/replxxSubmodule) + @git submodule update --init build/replxxSubmodule +endif + @export bd=$$(${MAKE} builddir); \ mkdir -p "$$bd"; \ ${MAKE} run_incremental_1 bd="$$bd" @@ -236,7 +242,6 @@ ${bd}/load.o: src/gen/customRuntime .INTERMEDIATE: preSingeliBin preSingeliBin: @if [ ! -d build/singeliLocal ]; then \ - echo "Using Singeli submodule; alternatively, link local version to build/singeliLocal"; \ git submodule update --init build/singeliSubmodule; \ fi @echo "pre-singeli build:" @@ -275,16 +280,15 @@ endif i_LD = $(i_CXX) REPLXX_FLAGS = -Os -ALL_CC_FLAGS += -DUSE_REPLXX -Ireplxx/include +ALL_CC_FLAGS += -DUSE_REPLXX -I$(REPLXX_DIR)/include -CXX_INC = $(i_CXX) $(CCFLAGS) $(REPLXX_FLAGS) -DREPLXX_STATIC=1 -Ireplxx/include -MMD -MP -MF +CXX_INC = $(i_CXX) $(CCFLAGS) $(REPLXX_FLAGS) -DREPLXX_STATIC=1 -I$(REPLXX_DIR)/include -MMD -MP -MF replxx_obj: ${addprefix ${bd}/, ConvertUTF.cpp.o wcwidth.cpp.o conversion.cxx.o escape.cxx.o history.cxx.o prompt.cxx.o replxx.cxx.o replxx_impl.cxx.o terminal.cxx.o util.cxx.o windows.cxx.o} -${bd}/%.o: replxx/src/% +${bd}/%.o: $(REPLXX_DIR)/src/% @echo $< @$(CXX_INC) $@.d -o $@ -c $< - ${bd}/BQN: replxx_obj -endif +endif # replxx @@ -316,6 +320,8 @@ clean-specific: rm -f $(bd)/*.d rm -f $(bd)/BQN rmdir $(bd); true +clean-submodules: + git submodule deinit build/singeliSubmodule/ build/replxxSubmodule/ clean: clean-build clean-runtime clean-singeli