This repository was archived by the owner on Jul 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (31 loc) · 1.27 KB
/
Makefile
File metadata and controls
39 lines (31 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
BASE_DIR := $(shell pwd)
EMACS_BUILD_SRC := $(shell pwd)/tools
EMACS_BUILD_DIR := /tmp/knowledge-base-home-build
BASE_URL := https://bphenriques.github.io/knowledge-base
all: clean build-content serve
.PHONY: clean
clean:
rm -rf content public
rm -rf static/ox-hugo
.PHONY: serve
serve:
hugo server --minify --disableFastRender --baseURL localhost:1313
.PHONY: build-content
build-content:
mkdir -p $(EMACS_BUILD_DIR)
cp -r $(EMACS_BUILD_SRC)/* $(EMACS_BUILD_DIR)
# Build temporary minimal EMACS installation separate from the one in the machine.
env HOME=$(EMACS_BUILD_DIR) KNOWLEDGE_BASE_DIR=$(BASE_DIR) emacs -Q --batch --load $(EMACS_BUILD_DIR)/init.el --execute "(build/export-all)" --kill
# Fixes bad URLs when the baseURL is not the root URL (this case).
# There is the option to change the template but IMO it is intrusive: https://github.com/kaushalmodi/ox-hugo/issues/460
find $(BASE_DIR)/content -type f -exec sed -i '' -e 's|figure src="/ox-hugo/|figure src="ox-hugo/|g' {} \;
.PHONY: build-site
build-site:
hugo --minify --cleanDestinationDir --baseURL $(BASE_URL)
.PHONY: build
build: build-content build-site
.PHONY: deploy
deploy: build-content build-site
update-sub-modules:
git submodule update --init --recursive
git submodule foreach git pull origin main