-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile
78 lines (64 loc) · 1.53 KB
/
Makefile
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
# Typescript compiler
TSC=tsc
TSCFLAGS=--module commonjs
# Python 2.7 "compiler"
PYC=python2.7 -m compileall
# Source and Example directory
SDIR=src
EDIR=examples
# Source files:
TSSOURCES=$(wildcard $(SDIR)/*.ts)
JSSOURCES=$(TSSOURCES:.ts=.js)
# Example files:
PYSOURCES=$(wildcard $(EDIR)/*.py) $(wildcard $(EDIR)/**/*.py)
EXSOURCES=$(PYSOURCES:.py=.pyc)
# Main library output file:
MAININ=main.js
MAINOUT=pyinterp.js
# Flags for compiling main file
# MAINFLAGS=--out pyinter.js # This fails silently. GG, TypeScript.
# Test application file:
TEST=test.ts
TESTJS=test.js
main:
@echo Compiling source files...
$(TSC) $(TSCFLAGS) $(TSSOURCES)
@echo
@echo Compiling main JS file...
browserify $(MAININ) > $(MAINOUT)
test: $(TESTJS) $(EXSOURCES)
@echo WARNING:
@echo Deleting the src/\*.js files will break $(TESTJS)!
$(TESTJS): $(TEST) $(TSSOURCES)
@echo
@echo Compiling $(TESTJS)
$(TSC) $(TSCFLAGS) $(TEST)
# $(JSSOURCES): $(TSSOURCES)
# $(TSC) $(TSCFLAGS) $^
%.js: %.ts
$(TSC) $(TSCFLAGS) $^
# $(EXSOURCES): $(PYSOURCES)
# @echo
# @echo Compiling all python sources files in $(EDIR)/
# $(PYC) $?
%.pyc: %.py
$(PYC) $^
.PHONY: clean clean-src clean-ex clean-test
clean-src:
@echo
@echo Cleaning $(SDIR)/ JS files
$(RM) $(JSFILE) $(JSSOURCES)
clean-ex:
@echo
@echo Cleaning $(EDIR)/ PYC files
$(RM) $(EXSOURCES)
clean-test: clean-ex
@echo
@echo Cleaning $(TESTJS)
$(RM) $(TESTJS)
clean-main: clean-src
@echo
@echo Cleaning $(MAINOUT)
$(RM) $(MAINOUT)
clean-all: clean-main clean-test clean-src clean-ex
clean: clean-main