-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (46 loc) Β· 1.27 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
.DEFAULT_GOAL := server
SHELL := /bin/bash
# Hugo binary download
HUGO_VERSION ?= 0.54.0
HUGO_PLATFORM ?= macOS-64bit
HUGO_FLAVOR ?= extended_
HUGO_FULL_VERSION = $(HUGO_FLAVOR)$(HUGO_VERSION)_$(HUGO_PLATFORM)
HUGO_URL = "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_FULL_VERSION}.tar.gz"
HUGO = bin/hugo
LN = ln -sf
NODEBIN = node_modules/.bin
HUGO_DEFAULT_ARGS = --destination ../dist --source site --verbose
HUGO_PREVIEW_ARGS = --buildDrafts --buildFuture
$(HUGO): $(HUGO)_$(HUGO_FULL_VERSION)
@echo "π Linking Hugo"
$(LN) "$(shell pwd)/$<" $@
$(HUGO)_$(HUGO_FULL_VERSION):
@echo "πΉ Downloading Hugo $(HUGO_VERSION)..."
mkdir -p bin
curl -s --output [email protected] -L $(HUGO_URL)
tar -C bin -xzf [email protected]
mv $(HUGO) $@
chmod +x $@
$@ version > /dev/null
rm -rf bin/LICENSE bin/README.md
touch $@
.PHONY = build
build: redirects dist node_modules
dist: $(HUGO)
$(HUGO) $(HUGO_DEFAULT_ARGS)
.PHONY = redirects
redirects: dist/_redirects
dist/_redirects: dist _redirects
cp _redirects $@
.PHONY = s serve server
s: serve
serve: server
server: build $(HUGO)
$(HUGO) server $(HUGO_DEFAULT_ARGS) $(HUGO_PREVIEW_ARGS)
.PHONY = deps
deps: node_modules
node_modules: package.json package-lock.json
npm ci
clean:
rm -rf dist
rm -rf node_modules