Fix CSS font URLs.
[yuu.git] / Makefile
1 #!/usr/bin/make -f
2
3 include rules/git.mk
4
5 APPLICATION := yuu
6 DISTDIR := build/dist
7 VERSION := $(call git-describe)
8 DISTROOT := $(DISTDIR)/$(APPLICATION)_$(VERSION)
9 node-webkit-version := 0.10.4
10
11 FIND_FILES := -type f ! -name '.*'
12 FIND_JS := -type f -name '*.js'
13
14 SOURCES := $(shell cd src && find . $(FIND_FILES))
15 MY_SOURCES := $(shell cd src && find . $(FIND_JS) -not -path './ext/*')
16
17 TEST_SOURCES := $(shell find test/spec $(FIND_JS))
18
19 LINT_TARGETS := $(call jshint-stampify,$(MY_SOURCES))
20 TEST_TARGETS := $(call jstest-stampify,$(TEST_SOURCES))
21
22 JSHINTCONFIG := test/jshint.config
23 JSTEST_NODE_PATH := src
24 VPATH := src
25
26 ICONSETS := $(shell find src -type d -name '*.iconset')
27 ICONS := $(ICONSETS:.iconset=.icns) $(ICONSETS:.iconset=.ico)
28
29 IMAGEGZSRC := $(shell find src -type f -name '*.xcf.gz')
30 IMAGESRC := $(shell find src -type f -name '*.xcf')
31 IMAGES := $(IMAGEGZSRC:.xcf.gz=.png) $(IMAGESRC:.xcf=.png)
32
33 BUILT := $(ICONS) $(IMAGES)
34
35 HTTP_SERVER_PORT ?= 8000
36
37 all: $(BUILT) $(call pngcrush-stampify,$(IMAGES))
38
39 $(DISTDIR):
40 mkdir -p $@
41
42 dist: $(addprefix $(DISTROOT),-src.zip -src.tar.gz .appcache .nw -osx-ia32.zip -osx-x64.zip -linux-ia32.tar.gz -linux-x64.tar.gz -win-ia32.zip)
43
44 test/spec/%.js: %.js
45 touch $@
46
47 lint: $(LINT_TARGETS)
48
49 test: $(TEST_TARGETS)
50
51 check: lint test
52
53 serve: | $(npmbindir)/http-server
54 $(npmbindir)/http-server $(@D) -p $(HTTP_SERVER_PORT) -c-1
55
56 clean:
57 $(RM) $(IMAGES)
58 $(RM) $(ICONS)
59 $(RM) -r build
60
61 distclean: clean
62 $(RM) -r node_modules
63 $(RM) $(node-webkit-archives)
64
65 $(DISTROOT)-src.zip $(DISTROOT)-src.tar.gz: | .git
66 mkdir -p $(@D)
67 $(call git-archive,$@,$(notdir $(DISTROOT))/)
68
69 $(DISTROOT).bare.zip: | .git
70 $(RM) $@
71 $(RM) -r $@.tmp
72 mkdir -p $@.tmp
73 cd src && $(GIT) archive $(call git-describe) . | tar -x -C ../$@.tmp
74 $(MAKE) $(BUILT:src/%=$@.tmp/%)
75 $(RM) $(IMAGESRC:src/%=$@.tmp/%) $(IMAGEGZSRC:src/%=$@.tmp/%)
76 cd $@.tmp && $(ZIP) ../$(@F) -r .
77 $(RM) -r $@.tmp
78
79 %.appcache: %.bare.zip tools/generate-appcache
80 $(RM) -r $@.tmp $@
81 $(UNZIP) -d $@.tmp $<
82 tools/generate-appcache $@.tmp
83 mv $@.tmp $@
84
85 # Python's zipfile module generates zipfiles that node-webkit cannot
86 # read, so delegate to a real zip tool.
87 %.nw: %.bare.zip tools/generate-nw
88 $(RM) -r $@ $@.tmp
89 $(UNZIP) -d $@.tmp $<
90 tools/generate-nw $@.tmp `echo $(*F) | sed -E 's/.+_[^0-9]+//'`
91 cd $@.tmp && $(ZIP) -r ../$(@F) .
92 $(RM) -r $@.tmp
93
94 include rules/programs.mk
95 include rules/javascript.mk
96 include rules/icons.mk
97 include rules/node-webkit.mk
98 include rules/pngcrush.mk
99
100 .DELETE_ON_ERROR:
101 .PHONY: all check distclean lint test dist clean serve