-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
65 lines (49 loc) · 1.1 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
#
# Executables.
#
BIN := node_modules/.bin
DUO := $(BIN)/duo
METALSMITH := $(BIN)/metalsmith
MYTH = $(BIN)/myth
#
# Source wildcards.
#
SRC = $(wildcard src/*)
TEMPLATES = $(wildcard templates/*.html)
JS = index.js $(wildcard lib/*/*.js)
CSS = index.css $(wildcard lib/*/*.css)
JSON = $(wildcard lib/*/*.json)
HTML = $(wildcard lib/*/*.html)
#
# Default.
#
all: index.html build/index.js build/index.css
#
# Targets.
#
# Build the Metalsmith source.
index.html: node_modules $(SRC) $(TEMPLATES)
@$(METALSMITH)
# Create the build directory.
build:
@mkdir -p $@
# Build the JavaScript source with Duo.
build/index.js: $(JS) $(HTML) $(JSON) node_modules build
@$(DUO) --type js < $< > $@
# Build the CSS source with Duo and Myth.
build/index.css: $(CSS) node_modules build
@$(DUO) --type css < $< | $(MYTH) > $@
# Install npm dependencies and ensure mtime is updated.
node_modules: package.json
@npm install
@touch $@
#
# Phony targets/tasks.
#
# Cleanup previous build.
clean:
rm -rf index.html build components
# Run the server.
server: bin/server node_modules
@node --harmony $<
.PHONY: all clean server