Skip to content

Commit 63e787f

Browse files
authored
Merge pull request #21782 from sftim/20200614_warn_if_submodules_not_initialized
Warn from make if submodules are not initialized
2 parents 6d0a8dc + 781b13b commit 63e787f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Makefile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@ CCEND=\033[0m
1717
help: ## Show this help.
1818
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
1919

20+
module-check:
21+
@git submodule status --recursive | awk '/^[+-]/ {printf "\033[31mWARNING\033[0m Submodule not initialized: \033[34m%s\033[0m\n",$$2}' 1>&2
22+
2023
all: build ## Build site with production settings and put deliverables in ./public
2124

22-
build: ## Build site with production settings and put deliverables in ./public
25+
build: module-check ## Build site with production settings and put deliverables in ./public
2326
hugo --minify
2427

25-
build-preview: ## Build site with drafts and future posts enabled
28+
build-preview: module-check ## Build site with drafts and future posts enabled
2629
hugo --buildDrafts --buildFuture
2730

2831
deploy-preview: ## Deploy preview site via netlify
@@ -39,7 +42,7 @@ production-build: build check-headers-file ## Build the production site and ensu
3942
non-production-build: ## Build the non-production site, which adds noindex headers to prevent indexing
4043
hugo --enableGitInfo
4144

42-
serve: ## Boot the development server.
45+
serve: module-check ## Boot the development server.
4346
hugo server --buildFuture
4447

4548
docker-image:
@@ -60,10 +63,10 @@ container-image:
6063
--tag $(CONTAINER_IMAGE) \
6164
--build-arg HUGO_VERSION=$(HUGO_VERSION)
6265

63-
container-build:
66+
container-build: module-check
6467
$(CONTAINER_RUN) $(CONTAINER_IMAGE) hugo
6568

66-
container-serve:
69+
container-serve: module-check
6770
$(CONTAINER_RUN) --mount type=tmpfs,destination=/src/resources,tmpfs-mode=0755 -p 1313:1313 $(CONTAINER_IMAGE) hugo server --buildFuture --bind 0.0.0.0
6871

6972
test-examples:
@@ -81,4 +84,3 @@ docker-internal-linkcheck:
8184
container-internal-linkcheck: link-checker-image-pull
8285
$(CONTAINER_RUN) $(CONTAINER_IMAGE) hugo --config config.toml,linkcheck-config.toml --buildFuture
8386
$(CONTAINER_ENGINE) run --mount type=bind,source=$(CURDIR),target=/test --rm wjdp/htmltest htmltest
84-

0 commit comments

Comments
 (0)