-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
176 lines (148 loc) · 4.28 KB
/
Makefile
File metadata and controls
176 lines (148 loc) · 4.28 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
##############
# parameters #
##############
# do the javascript stuff ?
DO_JS:=1
# should we do documentation ?
DO_DOCS:=1
# do you want to validate html?
DO_CHECKHTML:=0
# do you want to debug the makefile?
DO_MKDBG?=0
# where is the web folder?
DOCS:=docs
# do you want dependency on the Makefile itself ?
DO_ALLDEP:=1
########
# code #
########
ALL:=
PROJECT_NAME=jschess
JSCHECK:=out/$(PROJECT_NAME).stamp
JSFULL:=$(DOCS)/$(PROJECT_NAME).js
JSMIN:=$(DOCS)/$(PROJECT_NAME).min.js
JSMIN_JSMIN:=out/$(PROJECT_NAME).min.jsmin.js
JSMIN_YUI:=out/$(PROJECT_NAME).min.yui.js
JSMIN_CLOSURE:=out/$(PROJECT_NAME).min.closure.js
JSPACKFULL:=$(DOCS)/$(PROJECT_NAME).pack.js
JSPACKMIN:=$(DOCS)/$(PROJECT_NAME).pack.min.js
JSZIP:=out/$(PROJECT_NAME).zip
JS_TEMPLATES:=$(shell find templates/out/src -type f -and -name "*.mako")
JS_SOURCES:=$(shell find out/src -type f -and -name "*.js")
SOURCES_HTML_MAKO:=$(shell find templates/docs -type f -and -name "*.mako")
SOURCES_HTML:=$(shell pymakehelper remove_folders $(SOURCES_HTML_MAKO))
# SOURCES_HTML:=$(shell find docs -type f -and -name "*.html")
HTMLCHECK:=out/html.stamp
JSDOC_FOLDER=$(DOCS)/jsdoc
JSDOC_FILE=$(DOCS)/jsdoc/index.html
ifeq ($(DO_MKDBG),1)
Q=
# we are not silent in this branch
else # DO_MKDBG
Q=@
#.SILENT:
endif # DO_MKDBG
ifeq ($(DO_JS),1)
ALL+=$(JSPACKFULL) $(JSPACKMIN) $(JSZIP)
endif # DO_JS
ifeq ($(DO_DOCS),1)
ALL+=$(JSDOC_FILE)
endif # DO_DOCS
ifeq ($(DO_CHECKHTML),1)
ALL+=$(HTMLCHECK)
endif # DO_CHECKHTML
# this line guarantees that if a receipe fails then the target file
# will be deleted.
.DELETE_ON_ERROR:
#########
# rules #
#########
# do not touch this rule
all: $(ALL)
@true
$(JSZIP): $(JS_SOURCES)
$(info doing [$@])
$(Q)zip -qr $@ $(JS_SOURCES)
$(JSCHECK): $(JS_SOURCES) .jshintrc
$(info doing [$@])
$(Q)pymakehelper touch_mkdir $@
# $(Q)node_modules/.bin/jslint --browser --terse --todo --plusplus --forin --vars --sloppy --white --config support/jslintrc $(JS_SOURCES) 2> /dev/null
# $(Q)node_modules/.bin/jshint $(JS_SOURCES)
# $(Q)pymakehelper only_print_on_error gjslint --flagfile support/gjslint.cfg $(JS_SOURCES)
# $(Q)tools/jsl/jsl --conf=support/jsl.conf --quiet --nologo --nosummary --nofilelisting $(JS_SOURCES)
$(JSFULL): $(JS_SOURCES) $(JSCHECK)
$(info doing [$@])
$(Q)mkdir -p $(dir $@)
$(Q)cat $(JS_SOURCES) > $@
$(JSMIN): $(JSFULL)
$(info doing [$@])
$(Q)mkdir -p $(dir $@)
$(Q)node_modules/.bin/jsmin < $< > $(JSMIN_JSMIN)
$(Q)node_modules/.bin/yuicompressor $< -o $(JSMIN_YUI)
$(Q)cp $(JSMIN_YUI) $@
# $(Q)cp $(JSMIN_CLOSURE) $@
# $(Q)tools/closure.jar --jscomp_error '*' --externs templates/out/src/externs.js.mako --jscomp_off checkTypes $< --js_output_file $(JSMIN_CLOSURE)
$(JSPACKFULL): $(JSFULL)
$(info doing [$@])
$(Q)mkdir -p $(dir $@)
$(Q)cat $(JS_DEPLIST) $(JSFULL) > $@
$(JSPACKMIN): $(JSMIN)
$(info doing [$@])
$(Q)mkdir -p $(dir $@)
$(Q)cat $(JS_DEPLIST) $(JSMIN) > $@
$(JSDOC_FILE): $(JS_SOURCES)
$(info doing [$@])
$(Q)rm -rf $(JSDOC_FOLDER)
$(Q)mkdir -p $(dir $@)
$(Q)node_modules/.bin/jsdoc -d $(JSDOC_FOLDER) -c support/jsdoc.json out/src
.PHONY: check_js
check_js: $(JSCHECK)
$(info doing [$@])
.PHONY: check_html
check_html: $(HTMLCHECK)
$(info doing [$@])
.PHONY: check_grep
check_grep:
$(info doing [$@])
$(Q)pymakehelper only_print_on_error git grep "\"" src/
$(Q)pymakehelper only_print_on_error git grep " $$" src/
$(Q)pymakehelper only_print_on_error git grep "eval" src/
.PHONY: check_all
check_all: check_grep
.PHONY: jsdoc
jsdoc: $(JSDOC_FILE)
$(info doing [$@])
.PHONY: jsdoc_rm
jsdoc_rm:
$(info doing [$@])
$(Q)rm -rf $(JSDOC_FOLDER)
.PHONY: debug
debug:
$(info ALL is $(ALL))
$(info JSFULL is $(JSFULL))
$(info JSMIN is $(JSMIN))
$(info SOURCES_HTML is $(SOURCES_HTML))
$(info JS_TEMPLATES is $(JS_TEMPLATES))
$(info JS_SOURCES is $(JS_SOURCES))
.PHONY: clean_hard
clean_hard:
$(info doing [$@])
$(Q)git clean -qffxd
.PHONY: clean
clean:
$(Q)rm -f $(ALL)
.PHONY: sloccount
sloccount:
$(info doing [$@])
$(Q)sloccount .
$(HTMLCHECK): $(SOURCES_HTML) .htmlhintrc
$(info doing [$@])
$(Q)pymakehelper only_print_on_error node_modules/.bin/htmlhint $(SOURCES_HTML)
$(Q)pymakehelper touch_mkdir $@
# $(Q)tidy -errors -q -utf8 $(SOURCES_HTML)
##########
# alldep #
##########
ifeq ($(DO_ALLDEP),1)
.EXTRA_PREREQS+=$(foreach mk, ${MAKEFILE_LIST},$(abspath ${mk}))
endif # DO_ALLDEP