summaryrefslogtreecommitdiff
path: root/unrpyc/Makefile
blob: 431e10bb8bb9ed03d5cf39ddd8686ee2790e5779 (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
gzip := $(shell ./find-gzip.sh)

all: script.json script.json.gz imachine.json imachine.json.gz imachine_replay.json imachine_replay.json.gz ui-strings.json ui-strings.json.gz

%.json.gz: %.json
	$(gzip) -c $< > $@
	touch $< $@

script.json: $(patsubst %.rpyc,%.json,$(wildcard script-*.rpyc))
	cat script-*.json > script.json
	sed -i -e 's/^/{/;s/,$$/}/' script.json

%.json: %.json.o
	node fix.js $< $@

ui-strings.json.o: ui-strings.rpyc *.py
	python unrpyc.py --clobber $< $@
	sed -i -e 's/    \["init_language", "en", \],//;s/^\]}$$/}/' $@

%.json.o: %.rpyc *.py
	python unrpyc.py --clobber $< $@

script-%.json: script-%.json.o
	node fix.js $< $@
	sed -i -e 's/^{//;s/}$$/,/' $@

clean:
	rm -f *.json*

test: all
	jshint --show-non-errors *.json

install: all
	[ -d ../www/json ] || mkdir ../www/json
	install -t ../www/json script.json script.json.gz imachine.json imachine.json.gz imachine_replay.json imachine_replay.json.gz ui-strings.json ui-strings.json.gz

uninstall:
	rm -f ../www/json/*

.PHONY: all clean test install