-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (38 loc) · 1.32 KB
/
Makefile
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
40
41
42
43
44
45
46
47
48
49
50
.PHONY: build_hugo build_static run docker_cv_build
.DEFAULT_GOAL := build
STATIC_DIR := static
RESUME_DIR := resume
RESUME_DIR_ABS := $(abspath $(RESUME_DIR))
RESUME_OUT_PATH := $(RESUME_DIR)/out/cv.pdf
RESUME_OUT_STATIC_PATH := $(STATIC_DIR)/cv.pdf
PORTRAIT_OUT_PATH := $(RESUME_DIR)/me.jpeg
PORTRAIT_OUT_STATIC_PATH := $(STATIC_DIR)/me.jpeg
docker_cv_build:
@echo "Building resume with docker"
@docker run \
--rm \
--workdir="/app" \
--network=none \
-v "$(RESUME_DIR_ABS):/app" \
leplusorg/latex \
pdflatex -halt-on-error -output-directory=out -output-format=pdf -recorder cv.tex > /dev/null
$(RESUME_OUT_PATH): $(RESUME_DIR)/cv.tex $(PORTRAIT_OUT_PATH)
@echo "Building resume"
@rm -rf $(RESUME_DIR)/out
@mkdir -p $(RESUME_DIR)/out
@$(MAKE) docker_cv_build
@$(MAKE) docker_cv_build
$(RESUME_OUT_STATIC_PATH): $(RESUME_OUT_PATH)
@echo "Copying resume to static"
@cp $(RESUME_OUT_PATH) $(RESUME_OUT_STATIC_PATH)
$(PORTRAIT_OUT_STATIC_PATH): $(PORTRAIT_OUT_PATH)
@echo "Copying portrait to static"
@cp $(PORTRAIT_OUT_PATH) $(PORTRAIT_OUT_STATIC_PATH)
build_static: $(RESUME_OUT_STATIC_PATH) $(PORTRAIT_OUT_STATIC_PATH)
build_hugo: build_static
@echo "Building hugo"
hugo --gc --minify $(if $(BASE_URL),--baseURL $(BASE_URL),)
build: build_static build_hugo
run: build_static
@echo "Running hugo"
@hugo server -D