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

TARGETS := script.json script.json.gz imachine.json imachine.json.gz ui-strings.json ui-strings.json.gz ui-strings_FR.json ui-strings_FR.json.gz

all: $(TARGETS)

%.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
	uglifyjs $< --expr > $@

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

ui_settings.json.o: ui_settings.rpyc *.py
	python unrpyc.py --clobber $< --ignore-python $@
	sed -i -e 's/,,/,/g;/: *,$$/d' $@

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

script-%.json: script-%.json.o
	uglifyjs $< --expr > $@
	sed -i -e 's/^{//;s/}$$/,/' $@

clean:
	$(RM) *.json*

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

install: all
	[ -d ../www/json ] || mkdir ../www/json
	cp -f $(TARGETS) ../www/json

uninstall:
	$(RM) ../www/json/*

.PHONY: all clean test install