-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
63 lines (46 loc) · 1.52 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
DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))
NODE_MODS := $(DIR)/node_modules
PUG := $(NODE_MODS)/.bin/pug
PUG_DEPS := $(DIR)/pug-deps
HTML := $(wildcard src/pug/*.pug)
IMAGES := $(shell find src/images -type f)
VIDEO := $(wildcard src/video/*)
STATIC := src/robots.txt src/sitemap.xml
STATIC += $(wildcard src/docs/*) $(wildcard src/js/*)
HTML := $(patsubst src/pug/%.pug,build/%.html,$(HTML))
IMAGES := $(patsubst src/images/%,build/images/%,$(IMAGES))
VIDEO := $(patsubst src/video/%,build/video/%,$(VIDEO))
STATIC := $(patsubst src/%,build/%,$(STATIC))
WATCH := src/pug src/stylus src/images src/video Makefile
DEST := [email protected]:/var/www/buildbotics.com/
all: node_modules $(HTML) $(IMAGES) $(VIDEO) $(STATIC) build/sitemap-top.xml
node_modules:
npm install
build/%.html: src/pug/%.pug
@mkdir -p $(shell dirname $@)
$(PUG) $< -o build || (rm -f $@; exit 1)
(echo -n "$@: "; $(PUG_DEPS) $<) > build/dep/$(shell basename $@)
build/sitemap-top.xml: $(HTML) makesitemap
./makesitemap $(patsubst build/%,%,$(HTML)) >$@
build/%: src/%
install -D $< $@
publish:
rsync -r --progress build/ $(DEST)
watch:
@clear
$(MAKE)
@while sleep 1; do \
inotifywait -qr -e modify -e create -e delete \
--exclude .*~ --exclude \#.* $(WATCH); \
clear; \
$(MAKE); \
done
tidy:
rm -f $(shell find "$(DIR)" -name \*~)
clean: tidy
rm -rf http build
dist-clean: clean
rm -rf node_modules
.PHONY: all watch tidy clean dist-clean
# Dependencies
-include $(shell mkdir -p build/dep) $(wildcard build/dep/*)