aboutsummaryrefslogtreecommitdiff
path: root/static-src/Makefile
blob: 585229344502d6ac74cc41ff1ab7a09a46dafeb6 (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
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
.PHONY: all clean install install-full install-bare

SCSS = scss
OUT_DIR = out
TARGET = style.css

SCSS_INCLUDE = . $(OUT_DIR)
SCSS_FLAGS = --sourcemap=auto \
			 $(addprefix -I,$(SCSS_INCLUDE))

DESTDIR =
PREFIX = /usr/local/share/muppet/
# Path relative install root where the static files should end up
LOCAL_PATH = static


# Highlighting files
highlights = $(wildcard highlight/*.yaml)
# Colorscheme files
colorschemes = $(wildcard colorscheme/*.yaml)
# Generated highlighting and colorscheme files
outputs = $(patsubst colorscheme/%.yaml,$(OUT_DIR)/_colorscheme_%.scss,$(colorschemes)) \
		  $(patsubst highlight/%.yaml,$(OUT_DIR)/_highlight_%.scss,$(highlights))

# Included scss files
SCSS_FILES = $(wildcard _*.scss)

all: style.css

clean:
	-rm $(outputs)
	-rmdir $(OUT_DIR)
	-rm $(TARGET)
	-rm $(TARGET).map

$(TARGET): style.scss $(SCSS_FILES) $(outputs)
	$(SCSS) $(SCSS_FLAGS) $< $@

$(OUT_DIR)/_highlight_%.scss: highlight/%.yaml $(OUT_DIR)
	./build_css.py highlight $< > $@

$(OUT_DIR)/_colorscheme_%.scss: colorscheme/%.yaml $(OUT_DIR)
	./build_css.py colorscheme $< > $@

$(OUT_DIR):
	mkdir -p $@


dest=$(abspath $(DESTDIR)/$(PREFIX)/$(LOCAL_PATH))

# Install generated files, along with most source files and the map
# file, to aid in debugging
install-full: $(TARGET)
	install -d "$(dest)"
	install -d "$(dest)/$(OUT_DIR)"
	install -m644 $(outputs) "$(dest)/$(OUT_DIR)"
	install -m644 "$(TARGET)" "$(TARGET).map" style.scss $(SCSS_FILES) "$(dest)"

# Only install the generated files
install-bare: $(TARGET)
	install -D -m644 -t "$(dest)" $(TARGET)

install: install-full