This repository has been archived by the owner on Mar 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
116 lines (90 loc) · 2.98 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
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
bin = $(shell npm bin)
sjs = $(bin)/sjs
browserify = $(bin)/browserify
dollphie = $(bin)/dollphie
uglify = $(bin)/uglifyjs
VERSION = $(shell node -e 'console.log(require("./package.json").version)')
# -- Configuration -----------------------------------------------------
PACKAGE = text.pretty-printing
EXPORTS = Folktale.Text.PrettyPrinting
LIB_DIR = lib
SRC_DIR = src
SRC = $(wildcard $(SRC_DIR)/*.sjs)
TGT = ${SRC:$(SRC_DIR)/%.sjs=$(LIB_DIR)/%.js}
EX_DIR = examples
EX_BLD = examples
EX_SRC = $(wildcard $(EX_DIR)/*.sjs)
EX_TGT = ${EX_SRC:$(EX_DIR)/%.sjs=$(EX_BLD)/%.js}
TEST_DIR = test/specs-src
TEST_BLD = test/specs
TEST_SRC = $(wildcard $(TEST_DIR)/*.sjs)
TEST_TGT = ${TEST_SRC:$(TEST_DIR)/%.sjs=$(TEST_BLD)/%.js}
# -- Compilation -------------------------------------------------------
dist:
mkdir -p $@
dist/$(PACKAGE).umd.js: $(LIB_DIR)/index.js dist
$(browserify) $< --standalone $(EXPORTS) > $@
dist/$(PACKAGE).umd.min.js: dist/$(PACKAGE).umd.js
$(uglify) --mangle - < $< > $@
$(LIB_DIR)/%.js: $(SRC_DIR)/%.sjs
mkdir -p $(dir $@)
$(sjs) --readable-names \
--sourcemap \
--module lambda-chop/macros \
--module adt-simple/macros \
--module sparkler/macros \
--module es6-macros/macros/destructure \
--module macros.operators \
--output $@ \
$<
$(EX_BLD)/%.js: $(EX_DIR)/%.sjs
mkdir -p $(dir $@)
$(sjs) --readable-names \
--sourcemap \
--module lambda-chop/macros \
--module adt-simple/macros \
--module sparkler/macros \
--module es6-macros/macros/destructure \
--module macros.operators \
--output $@ \
$<
$(TEST_BLD)/%.js: $(TEST_DIR)/%.sjs
mkdir -p $(dir $@)
$(sjs) --readable-names \
--module specify-core/macros \
--module alright/macros \
--output $@ \
$<
docs/source/index.rst: src/index.sjs
$(dollphie) --input javascript --output sphinx src/index.sjs > docs/source/index.rst
# -- Tasks -------------------------------------------------------------
source: $(TGT)
examples: $(EX_TGT)
all: source examples
bundle: dist/$(PACKAGE).umd.js
minify: dist/$(PACKAGE).umd.min.js
documentation: docs/source/index.rst
cd docs && $(MAKE) html
clean:
rm -rf dist build $(LIB_DIR)
test: all $(TEST_TGT)
node test/run.js
package: documentation bundle minify
mkdir -p dist/$(PACKAGE)-$(VERSION)
cp -r docs dist/$(PACKAGE)-$(VERSION)
cp -r lib dist/$(PACKAGE)-$(VERSION)
cp dist/*.js dist/$(PACKAGE)-$(VERSION)
cp package.json dist/$(PACKAGE)-$(VERSION)
cp README.md dist/$(PACKAGE)-$(VERSION)
cp LICENCE dist/$(PACKAGE)-$(VERSION)
cd dist && tar -czf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
publish: clean test
npm install
npm publish
bump:
node tools/bump-version.js $$VERSION_BUMP
bump-feature:
VERSION_BUMP=FEATURE $(MAKE) bump
bump-major:
VERSION_BUMP=MAJOR $(MAKE) bump
.PHONY: test bump bump-feature bump-major publish package clean documentation