-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
69 lines (61 loc) · 1.93 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Environment Variable Defaults
NAME ?= jane-smith-resume
SOURCE ?= resume.adoc
OUTDIR ?= public
PAGE_SIZE ?= A4
USE_DOCKER ?= true
# Utility
pdfout := $(OUTDIR)/$(NAME).pdf
htmlout := $(OUTDIR)/index.html
pkgout := $(OUTDIR)/$(NAME).html.tar.gz
# Docker (if USE_DOCKER is "true")
asciidoctor_img = asciidoctor/docker-asciidoctor
ensure_ascidoctor_img = $(if $(shell docker images -q $(asciidoctor_img)),, \
docker pull $(asciidoctor_img);)
ifeq ($(USE_DOCKER),true)
docker = $(ensure_ascidoctor_img) \
docker run --rm \
--name 'asciidoctor-resume' \
-u $(shell id -u):$(shell id -g) \
-v $(shell pwd):/documents/ \
$(asciidoctor_img)
endif
.PHONY: help clean html pdf serve package
help:
@echo 'Resume/CV - Turn text into professional PDF or HTML resume/CV'
@echo ''
@echo 'Usage: make <action>'
@echo ''
@echo 'Actions:'
@echo ' clean to remove the output directory'
@echo ' html to make a standalone HTML version of the resume'
@echo ' pdf to produce a PDF version of the resume'
@echo ''
@echo 'Environment variables'
@echo ' NAME the filename (without extension) of the output'
@echo ' (currently: $(NAME))'
@echo ' SOURCE the source file to use as input'
@echo ' (currently: $(SOURCE))'
@echo ' OUTDIR the directory where the generated files will be placed'
@echo ' (currently: $(OUTDIR))'
@echo ' PAGE_SIZE the page size for the PDF (example: Letter)'
@echo ' (currently: $(PAGE_SIZE))'
@echo ' USE_DOCKER if set to "true", will use docker to run generator'
@echo ' (currently: $(USE_DOCKER))'
@echo ''
@echo 'Example:'
@echo ' $$ export USE_DOCKER=true'
@echo ' $$ make pdf'
clean:
rm -rf $(OUTDIR)
html:
$(docker) asciidoctor \
-a data-uri \
-a nofooter \
-o $(htmlout) \
$(SOURCE)
pdf:
$(docker) asciidoctor-pdf -s \
-a pdf-page-size=$(PAGE_SIZE) \
-o $(pdfout) \
$(SOURCE)