-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
140 lines (99 loc) · 3.36 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
.PHONY: nrepl chrome clean run-jar cljs cljs-prod http-server app-test test figwheel
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
VERSION := 1.0.4
CLJ_FILES := $(shell find . -type f \
\( -path "./test/*" -o -path "./dev/*" -o -path "./src/*" \) \
\( -iname "*.clj" -o -iname "*.cljc" \) -print)
CLJS_FILES := $(shell find . -type f \
\( -path "./test/*" -o -path "./dev/*" -o -path "./src/*" \) \
\( -iname "*.cljs" -o -iname "*.cljc" \) -print)
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# repl / dev
nrepl:
clojure -R:dev:deps:cljs:nrepl:test -C:cljs:nrepl:test -m org-analyzer.nrepl-server
figwheel:
clj -R:cljs -C:dev -m figwheel.main -b dev -r
chrome:
chromium \
--remote-debugging-port=9222 \
--no-first-run \
--user-data-dir=chrome-user-profile
http-server: cljs-prod
clojure -A:http-server
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# cljs
JS_FILES := resources/public/cljs-out/dev/
JS_PROD_FILES := resources/public/cljs-out/prod/
$(JS_FILES): $(CLJS_FILES) deps.edn dev.cljs.edn
clojure -A:dev:cljs -C:test
$(JS_PROD_FILES): $(CLJS_FILES) deps.edn prod.cljs.edn
clojure -R:cljs -A:cljs-prod
cljs: $(JS_FILES)
cljs-prod: $(JS_PROD_FILES)
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# packaging / jar
pom.xml: deps.edn
clojure -Spom
AOT := target/classes
$(AOT): $(CLJ_FILES) $(CLJS_FILES)
mkdir -p $(AOT)
clojure -A:aot
JAR := target/org-analyzer-$(VERSION).jar
$(JAR): cljs-prod $(AOT) pom.xml
mkdir -p $(dir $(JAR))
clojure -C:http-server:aot -A:depstar -m hf.depstar.uberjar $(JAR) -m org_analyzer.main
chmod a+x $(JAR)
cp $(JAR) org-analyzer-el/org-analyzer.jar
jar: $(JAR)
run-jar: jar
cp $(JAR) org-analyzer-el/org-analyzer.jar
java -jar $(JAR) -m org-analyzer.main
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# graal
RESOURCE_CONFIG := target/graal-resource-config.json
$(RESOURCE_CONFIG): $(CLJS_FILES)
clojure -A:graal-prep
BIN := bin/run
$(BIN): $(AOT) cljs $(CLJS_FILES) $(CLJ_FILES) $(RESOURCE_CONFIG)
mkdir -p bin
native-image \
--report-unsupported-elements-at-runtime \
--verbose \
--no-server \
--initialize-at-build-time \
-cp $(shell clojure -C:aot:http-server -Spath) \
--no-fallback \
--enable-http --enable-https --allow-incomplete-classpath \
-H:+ReportExceptionStackTraces \
-H:ResourceConfigurationFiles=$(RESOURCE_CONFIG) \
org_analyzer.main \
$(BIN)
cp -r resources/public $(dir $(BIN))/public
bin: $(BIN)
run-bin: bin
$(BIN)
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# emacs
EMACS_PACKAGE_NAME:=org-analyzer-for-emacs-$(VERSION)
EMACS_PACKAGE_DIR:=/tmp/$(EMACS_PACKAGE_NAME)
update-version:
sed -e "s/[0-9].[0-9].[0-9]/$(VERSION)/" -i org-analyzer-el/org-analyzer-pkg.el
$(EMACS_PACKAGE_DIR): update-version $(JAR)
@mkdir -p $@
cp -r org-analyzer-el/*el org-analyzer-el/*jar $@
emacs-package: $(EMACS_PACKAGE_DIR)
mkdir -p target
tar czvf target/$(EMACS_PACKAGE_NAME).tar.gz \
-C $(EMACS_PACKAGE_DIR)/.. $(EMACS_PACKAGE_NAME)
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# app-test:
# clojure -R:test:cljs -m figwheel.main -co test.cljs.edn -m org-analyzer.app-test
test:
clojure -A:test
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
clean:
rm -rf target/$(EMACS_PACKAGE_NAME).tar.gz \
$(EMACS_PACKAGE_DIR) \
target .cpcache $(AOT) \
resources/public/cljs-out \
$(JAR) bin