-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (39 loc) · 1.24 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
export TIDDLYWIKI_PLUGIN_PATH := $(TIDDLYWIKI_PATH)/plugin/:plugins
export TW_TOOL := $(TIDDLYWIKI_PATH)/tiddlywiki.js
export GITHUB_HOST ?= github.com
export GITHUB_SHA ?= $(shell git rev-parse HEAD)
REGEXP := "s|.*$$GITHUB_HOST[:/]\([^/]*/[^/]*\).*.git$$|\1|"
export GITHUB_REPOSITORY ?= $(shell git remote get-url origin | sed -e $(REGEXP))
all: build
.PHONY: help
# target: help - Prints this help
help:
@egrep "^# target:" Makefile | sed -e 's/^# target: //g' | sort
.PHONY: serve
# target: serve - start nodejs edition to simplify updates
serve: build check-env
@node $(TW_TOOL) editions/server --listen
.PHONY: build
# target: build - compile site content
build: check-env
@node $(TW_TOOL) editions/demo --verbose \
--output `pwd`/output --build splitweb
.PHONY: clean
# target: clean - cleanup build artifacts
clean:
@rm -rf output
.PHONY: caddy
# target: caddy - compile site content and start web server
caddy: build
@cd output/demo && caddy file-server
.PHONY: check-env
check-env: __CHECK_ENV=1
check-env:
ifndef __CHECK_ENV
@printf 'Checking environemnt....'
@[ "${TIDDLYWIKI_PATH}" ] \
|| ( printf "\n\t>>>>> TIDDLYWIKI_PATH var is not set\n" ; make error )
@echo OK
endif
site:
@git worktree add --track -b gh-pages $@ origin/gh-pages