File: Makefile

package info (click to toggle)
jsxgraph 1.3.5+dfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 26,044 kB
  • sloc: xml: 5,869; java: 1,072; python: 747; php: 192; makefile: 146; sh: 47
file content (184 lines) | stat: -rw-r--r-- 5,742 bytes parent folder | download
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
177
178
179
180
181
182
183
184
.PHONY: tests test test-server

# build tools
REQUIREJS=./node_modules/bin/r.js
UGLIFYJS=/usr/bin/uglifyjs
JSDOC2=java -jar /usr/share/java/jsrun.jar /usr/share/jsdoc-toolkit/app/run.js
#JSDOC2=nodejs ./node_modules/.bin/jsdoc

LINT=./node_modules/jslint/bin/jslint.js
HINT=./node_modules/jshint/bin/hint
JSTESTDRIVER=java -jar ./node_modules/jstestdriver/lib/jstestdriver.jar
INTERN=./node_modules/.bin/intern-client

# general tools
CP=cp
CAT=cat
MKDIR=mkdir
RM=rm
CD=cd
ZIP=zip
UNZIP=unzip

# directories
OUTPUT=distrib
BUILD=build
TMP=tmp
BUILDBIN=$(BUILD)/bin
BUILDREADERS=$(BUILDBIN)/readers
JSDOC2PLG=doc/jsdoc-tk/plugins
JSDOC2TPL=doc/jsdoc-tk/template
#JSDOC2TPL=./node_modules/ink-docstrap/template
JSDOC2TPLSTAT=$(JSDOC2TPL)/static

# flags
MKDIRFLAGS=-p
RMFLAGS=-rf
JSDOC2FLAGS=-v -p -t=$(JSDOC2TPL) -d=$(TMP)/docs
#JSDOC2FLAGS=--verbose -p --template $(JSDOC2TPL) --destination $(TMP)/docs

ZIPFLAGS=-r
JSTESTPORT=4224
JSTESTSERVER=localhost:4224
JSTESTFLAGS=--reset --captureConsole --tests all

# filelists - required for docs, linters, and to build the readers
FILELIST=$(shell cat src/loadjsxgraph.js | grep "baseFiles\s*=\s*'\(\w*,\)\+" | awk -F \' '{ print $$2 }' | sed 's/,/.js src\//g')

# Lintlist - jessiecode.js is developed externally (github:jsxgraph/jessiecode) and won't be linted in here
LINTLIST=$(shell echo $(FILELIST) | sed 's/src\/parser\/jessiecode\.js//')
LINTFLAGS=--bitwise true --white true

READERSOUT=build/bin/readers/geonext.min.js build/bin/readers/geogebra.min.js build/bin/readers/intergeo.min.js build/bin/readers/sketch.min.js

# rules
all: symlinks core compressor core-min readers docs movedocs

symlinks:
	# add symlinks to replace node_modules utilities
	#################################################
	# replace almond
	$(MKDIR) $(MKDIRFLAGS) node_modules/almond
	ln -s /usr/lib/nodejs/almond/almond.js node_modules/almond/
	$(MKDIR) $(MKDIRFLAGS) node_modules/requirejs/bin

movedocs:
	# change the location of zip files to make their packaging easier
	mv distrib/*.zip .

core:
	$(MKDIR) $(MKDIRFLAGS) $(BUILDBIN)
	nodejs $(REQUIREJS) -o $(BUILD)/core.build.json


core-min:
	$(MKDIR) $(MKDIRFLAGS) $(BUILDBIN)
	nodejs $(REQUIREJS) -o $(BUILD)/core.build.json optimize=uglify2 out=$(BUILDBIN)/jsxgraphcore-min.js;
	{ $(CAT) COPYRIGHT; $(CAT) $(BUILDBIN)/jsxgraphcore-min.js; } > $(BUILDBIN)/jsxgraphcore.min.js
	$(CP) $(BUILDBIN)/jsxgraphcore.min.js $(OUTPUT)/jsxgraphcore.js

release: core-min docs
	$(MKDIR) $(MKDIRFLAGS) $(TMP)
	$(MKDIR) $(MKDIRFLAGS) $(OUTPUT)
	$(CP) $(BUILDBIN)/jsxgraphcore.min.js $(TMP)/jsxgraphcore.js
	$(CP) $(BUILDBIN)/jsxgraphcore.js $(TMP)/jsxgraphsrc.js
	$(CP) $(OUTPUT)/docs.zip $(TMP)/docs.zip
	$(CP) distrib/jsxgraph.css $(TMP)/jsxgraph.css
	$(CP) -r src/themes $(TMP)/themes
	$(CP) README.md LICENSE.MIT LICENSE.LGPL $(TMP)/
	$(CD) $(TMP) && $(ZIP) $(ZIPFLAGS) jsxgraph.zip jsxgraph* themes/ docs.zip README.md LICENSE.*
	$(CP) $(TMP)/jsxgraph.zip $(OUTPUT)/jsxgraph.zip

	$(RM) $(RMFLAGS) tmp

docs: core core-min
	# set up tmp dir
	$(MKDIR) $(MKDIRFLAGS) $(TMP)
	$(MKDIR) $(MKDIRFLAGS) $(OUTPUT)

	# update template related files
	ln -s /usr/share/javascript/jquery/jquery.min.js $(JSDOC2TPLSTAT)/
	$(CP) $(BUILDBIN)/jsxgraphcore.min.js $(JSDOC2TPLSTAT)/jsxgraphcore.js
	$(CP) distrib/jsxgraph.css $(JSDOC2TPLSTAT)/jsxgraph.css

	# update the plugin
	$(MKDIR) $(MKDIRFLAGS) ./node_modules/jsdoc2/app/plugins
	$(CP) $(JSDOC2PLG)/*.js ./node_modules/jsdoc2/app/plugins/

	# run node-jsdoc2
	$(JSDOC2) $(JSDOC2FLAGS) src/loadjsxgraph.js src/$(FILELIST).js

	# zip -r tmp/docs.zip tmp/docs/
	$(CD) $(TMP) && $(ZIP) $(ZIPFLAGS) docs.zip docs/
	$(CP) $(TMP)/docs.zip $(OUTPUT)/docs.zip

	$(RM) $(RMFLAGS) tmp

	# Test
	$(CD) $(OUTPUT) && $(UNZIP) -o docs.zip

	# Protect against privacy breaches
	sed -e 's/.*gaJsHost.*//' \
	    -e 's/.*pageTracker.*//' \
	    distrib/docs/index.html > distrib/docs/index.html.tmp && \
	  mv distrib/docs/index.html.tmp distrib/docs/index.html

readers: $(READERSOUT)
	$(MKDIR) $(MKDIRFLAGS) $(OUTPUT)
	$(CP) $(BUILDREADERS)/* $(OUTPUT)

build/bin/readers/%.min.js: src/reader/%.js
	$(MKDIR) $(MKDIRFLAGS) $(BUILDREADERS)
	{ $(CAT) COPYRIGHT; $(UGLIFYJS) $^; } > $@

compressor: core
	nodejs $(REQUIREJS) -o build/compressor.build.json
	{ $(CAT) JSXCompressor/COPYING; $(CAT) $(BUILDBIN)/jsxcompressor.js; } > JSXCompressor/jsxcompressor.min.js
	$(CP) $(BUILDBIN)/jsxgraphcore.js JSXCompressor/jsxgraphcore.js
	$(CP) distrib/jsxgraph.css JSXCompressor/jsxgraph.css

plot:
	$(MKDIR) $(MKDIRFLAGS) $(BUILDBIN)
	nodejs $(REQUIREJS) -o build/plot.build.json

hint:
	$(HINT) src/$(LINTLIST).js

lint:
	$(LINT) $(LINTFLAGS) src/$(LINTLIST).js

#test-server:
#	$(JSTESTDRIVER) --port $(JSTESTPORT)

#test: core
#	$(JSTESTDRIVER) $(JSTESTSERVER) $(JSTESTFLAGS) --basePath ./ --config test/jsTestDriver.conf

#tests:
#	$(INTERN) config=tests/intern

clean:
	for d in $$(ls node_modules/ | grep -v bin); do \
	  rm -rf node_modules/$$d; \
	done
	rm -f build/bin/jsxgraphcore.js
	rm -f doc/jsdoc-tk/template/static/jquery.min.js
	rm -rf distrib/docs/*
	rm -f docs.zip
	rm -f jsxgraph_moodle.zip
	rm -f JSXCompressor/jsxcompressor.min.js
	rm -f JSXCompressor/jsxgraph.css
	rm -f JSXCompressor/jsxgraphcore.js
	rm -f build/bin/jsxcompressor.js
	rm -f build/bin/jsxgraphcore-min.js
	rm -f build/bin/jsxgraphcore.min.js
	rm -f build/bin/readers/geogebra.min.js
	rm -f build/bin/readers/geonext.min.js
	rm -f build/bin/readers/intergeo.min.js
	rm -f build/bin/readers/sketch.min.js
	rm -f distrib/geogebra.min.js
	rm -f distrib/geonext.min.js
	rm -f distrib/intergeo.min.js
	rm -f distrib/jsxgraphcore.js
	rm -f distrib/sketch.min.js
	rm -f doc/jsdoc-tk/template/static/jsxgraph.css
	rm -f doc/jsdoc-tk/template/static/jsxgraphcore.js