Skip to content

Commit

Permalink
Added submodule check (#1801)
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrayson-mips authored Jan 15, 2025
1 parent 9799e5b commit 866cfb8
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,18 @@ REQUIRES := --require=asciidoctor-bibtex \
--require=asciidoctor-lists \
--require=asciidoctor-mathematical

.PHONY: all build clean build-container build-no-container build-docs build-pdf build-html build-epub
.PHONY: all build clean build-container build-no-container build-docs build-pdf build-html build-epub submodule-check

all: build

# Check if the docs-resources/global-config.adoc file exists. If not, the user forgot to check out submodules.
submodule-check:
if [ ! -e docs-resources/global-config.adoc ]; then \
echo "WARNING: You must clone with --recurse-submodules to automatically populate the submodule 'docs-resources'." 1>&2; \
echo "Checking out submodules for you via 'git submodule update --init --recurse'..."; \
git submodule update --init --recursive; \
fi

build-docs: $(DOCS_PDF) $(DOCS_HTML) $(DOCS_EPUB)
build-pdf: $(DOCS_PDF)
build-html: $(DOCS_HTML)
Expand All @@ -117,7 +125,7 @@ $(BUILD_DIR)/%.epub: $(SRC_DIR)/%.adoc $(ALL_SRCS)
$(DOCKER_CMD) $(DOCKER_QUOTE) $(ASCIIDOCTOR_EPUB) $(OPTIONS) $(REQUIRES) $< $(DOCKER_QUOTE)
$(WORKDIR_TEARDOWN)

build:
build: submodule-check
@echo "Checking if Docker is available..."
@if command -v docker >/dev/null 2>&1 ; then \
echo "Docker is available, building inside Docker container..."; \
Expand All @@ -127,12 +135,12 @@ build:
$(MAKE) build-no-container; \
fi

build-container:
build-container: submodule-check
@echo "Starting build inside Docker container..."
$(MAKE) build-docs
@echo "Build completed successfully inside Docker container."

build-no-container:
build-no-container: submodule-check
@echo "Starting build..."
$(MAKE) SKIP_DOCKER=true build-docs
@echo "Build completed successfully."
Expand Down

0 comments on commit 866cfb8

Please sign in to comment.