summaryrefslogtreecommitdiff
path: root/Makefile
blob: 96e0fdf5d566baac415c27f7e5ebfa927f4170a6 (plain)
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
MAKEFLAGS += -j1

# Default target
all: out/index.html out/main.css
phony += all

# Boilerplate
phony += FORCE
.DELETE_ON_ERROR:
.SECONDARY:

# Development server
serve: serve-8000
serve-%: all
	dir=$$(mktemp -d -t) && trap 'fusermount -u "$$dir"; rmdir "$$dir"' EXIT && unionfs -o ro out:src "$$dir" && (cd "$$dir" && python3 -m http.server $*)
phony += serve serve-%

# Clean
clean:
	rm -rf out
phony += clean

# Real file rules
out/%.css: src/%.scss
	@mkdir -p $(@D)
	scss --stdin < $< > $@

targets = $(phony) %.css
$(sort $(filter-out $(targets),out/index.html $(MAKECMDGOALS))): FORCE
	./bin/sitegen

# Boilerplate
.PHONY: $(phony)