diff --git a/.ci/build.sh b/.ci/build.sh index 4448cf5b7..9f6fae6ad 100755 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -6,7 +6,7 @@ source "${CI_DIR}/common.sh" # Build. cmd=(make all) -if [[ -d base/build ]]; then +if [[ -d build ]]; then cmd+=(--assume-old=base) fi "${cmd[@]}" diff --git a/.circleci/config.yml b/.circleci/config.yml index 3884a12c8..12d6cc7ae 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -54,15 +54,15 @@ jobs: # Restore / setup caches. {{{ - run: name: Generate cache key - command: make -C base TARGET= cache-key + command: make TARGET= cache-key - restore_cache: name: Restore build directory keys: - - &CACHE_KEY_BUILD_DIR '<< pipeline.parameters.cache_epoch >>-{{ .Environment.CIRCLE_JOB }}-build-{{ arch }}-{{ checksum "base/cache-key" }}' + - &CACHE_KEY_BUILD_DIR '<< pipeline.parameters.cache_epoch >>-{{ .Environment.CIRCLE_JOB }}-build-{{ arch }}-{{ checksum "cache-key" }}' - restore_cache: name: Restore build cache keys: - - &CACHE_KEY_BUILD_CACHE '<< pipeline.parameters.cache_epoch >>-{{ .Environment.CIRCLE_JOB }}-ccache-{{ arch }}-{{ checksum "base/cache-key" }}' + - &CACHE_KEY_BUILD_CACHE '<< pipeline.parameters.cache_epoch >>-{{ .Environment.CIRCLE_JOB }}-ccache-{{ arch }}-{{ checksum "cache-key" }}' - '<< pipeline.parameters.cache_epoch >>-{{ .Environment.CIRCLE_JOB }}-ccache-{{ arch }}-' - run: name: Setup build cache @@ -85,7 +85,7 @@ jobs: command: | set -x # Trim the build directory. - rm -rf base/build/{cmake,staging,thirdparty} + rm -rf build/{cmake,staging,thirdparty} ccache --cleanup >/dev/null ccache --show-stats --verbose - save_cache: @@ -97,7 +97,7 @@ jobs: name: Save build directory key: *CACHE_KEY_BUILD_DIR paths: - - base/build + - build # }}} # Tests / coverage. {{{ # Our lovely unit tests. diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ae239f476..805a186a8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -92,14 +92,14 @@ jobs: # Restore / setup caches. {{{ - name: Generate cache key - run: make -C base TARGET= cache-key + run: make TARGET= cache-key - name: Restore build directory id: build-restore uses: actions/cache/restore@v4 with: - path: base/build - key: ${{ env.CACHE_EPOCH }}-${{ runner.os }}-${{ runner.arch }}-build-${{ hashFiles('base/cache-key') }} + path: build + key: ${{ env.CACHE_EPOCH }}-${{ runner.os }}-${{ runner.arch }}-build-${{ hashFiles('cache-key') }} - name: Restore build cache id: ccache-restore @@ -107,7 +107,7 @@ jobs: uses: actions/cache/restore@v4 with: path: /Users/runner/Library/Caches/ccache - key: ${{ env.CACHE_EPOCH }}-${{ runner.os }}-${{ runner.arch }}-ccache-${{ hashFiles('base/cache-key') }} + key: ${{ env.CACHE_EPOCH }}-${{ runner.os }}-${{ runner.arch }}-ccache-${{ hashFiles('cache-key') }} restore-keys: ${{ env.CACHE_EPOCH }}-${{ runner.os }}-${{ runner.arch }}-ccache- - name: Install ccache @@ -152,7 +152,7 @@ jobs: run: | set -x # Trim the build directory. - rm -rf base/build/{cmake,staging,thirdparty} + rm -rf build/{cmake,staging,thirdparty} ccache --cleanup >/dev/null ccache --show-stats --verbose @@ -167,7 +167,7 @@ jobs: uses: actions/cache/save@v4 if: steps.build-restore.outputs.cache-hit != 'true' with: - path: base/build + path: build key: ${{ steps.build-restore.outputs.cache-primary-key }} # }}} diff --git a/Makefile b/Makefile index 3a53a4f97..d901fc157 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ -PHONY = all android-ndk android-sdk base clean coverage doc fetchthirdparty po pot static-check test testfront +PHONY = all android-ndk android-sdk base clean coverage distclean doc fetchthirdparty po pot re static-check test testfront +SOUND = $(INSTALL_DIR)/% # koreader-base directory -KOR_BASE?=base +KOR_BASE ?= base include $(KOR_BASE)/Makefile.defs @@ -51,12 +52,7 @@ WIN32_DIR=$(PLATFORM_DIR)/win32 INSTALL_FILES=reader.lua setupkoenv.lua frontend resources defaults.lua datastorage.lua \ l10n tools README.md COPYING -ifeq ($(abspath $(OUTPUT_DIR)),$(OUTPUT_DIR)) - ABSOLUTE_OUTPUT_DIR = $(OUTPUT_DIR) -else - ABSOLUTE_OUTPUT_DIR = $(KOR_BASE)/$(OUTPUT_DIR) -endif -OUTPUT_DIR_ARTIFACTS = $(ABSOLUTE_OUTPUT_DIR)/!(cache|cmake|history|staging|thirdparty) +OUTPUT_DIR_ARTIFACTS = $(abspath $(OUTPUT_DIR))/!(cache|cmake|history|staging|thirdparty) all: base install -d $(INSTALL_DIR)/koreader @@ -99,8 +95,7 @@ ifneq (,$(IS_RELEASE)) rm -rf $(INSTALL_DIR)/koreader/data/{cr3.ini,desktop,devices,dict,manual,tessdata} endif -base: - $(MAKE) -C $(KOR_BASE) +base: base-all $(INSTALL_DIR)/koreader/.busted: .busted $(SYMLINK) .busted $@ @@ -128,6 +123,9 @@ coverage: $(INSTALL_DIR)/koreader/.luacov +$$(($$(grep -nm1 -e "^Summary$$" luacov.report.out|cut -d: -f1)-1)) \ luacov.report.out +ifeq (,$(wildcard $(KOR_BASE)/Makefile)) +$(KOR_BASE)/Makefile: fetchthirdparty +endif ifeq (,$(wildcard $(KOR_BASE)/Makefile.defs)) $(KOR_BASE)/Makefile.defs: fetchthirdparty endif @@ -149,21 +147,18 @@ else endif $(MAKE) -C $(KOR_BASE) fetchthirdparty -VERBOSE ?= @ -Q = $(VERBOSE:1=) -clean: +clean: base-clean rm -rf $(INSTALL_DIR) - $(Q:@=@echo 'MAKE -C base clean'; &> /dev/null) \ - $(MAKE) -C $(KOR_BASE) clean ifeq ($(TARGET), android) $(MAKE) -C $(CURDIR)/platform/android/luajit-launcher clean endif -dist-clean: clean - rm -rf $(INSTALL_DIR) - $(MAKE) -C $(KOR_BASE) dist-clean +distclean: clean base-distclean $(MAKE) -C doc clean +re: clean + $(MAKE) all + # Include target specific rules. ifneq (,$(wildcard make/$(TARGET).mk)) include make/$(TARGET).mk @@ -208,7 +203,4 @@ doc: .NOTPARALLEL: .PHONY: $(PHONY) -LEFTOVERS = $(filter-out $(PHONY) $(INSTALL_DIR)/%,$(MAKECMDGOALS)) -.PHONY: $(LEFTOVERS) -$(LEFTOVERS): - $(MAKE) -C $(KOR_BASE) $@ +include $(KOR_BASE)/Makefile diff --git a/base b/base index 0d6abcf61..29f042578 160000 --- a/base +++ b/base @@ -1 +1 @@ -Subproject commit 0d6abcf6113f6d9c0ebd1de2db3bad085f37ed89 +Subproject commit 29f0425780767830895f9a225534d669d001379c