-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathMakefile
More file actions
333 lines (278 loc) · 6.61 KB
/
Makefile
File metadata and controls
333 lines (278 loc) · 6.61 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
include common/base.mk
include $(COMMON)/java.mk
include $(COMMON)/docker.mk
include $(MAKES)/claude.mk
include $(MAKES)/gh.mk
include $(SHELL-LANGS:%=$(MAKES)/%.mk)
include $(MAKES)/shell.mk
CLAUDE-NONO-R-FILES += \
$(XAUTHORITY) \
/etc/gitconfig \
CLAUDE-NONO-R-DIRS += \
/tmp/.X11-unix \
BINDINGS := \
clojure \
crystal \
csharp \
go \
haskell \
java \
julia \
lua \
nodejs \
perl \
perl-alien \
php \
python \
raku \
ruby \
rust \
DIRS := \
core \
libys \
$(BINDINGS) \
ys \
BUILD-DIRS := \
libys \
go \
haskell \
nodejs \
python \
ruby \
rust \
ys \
INSTALL-DIRS := \
libys \
ys \
BUILD := $(BUILD-DIRS:%=build-%)
BUILD-DOC := $(BINDINGS:%=build-doc-%)
INSTALL := $(INSTALL-DIRS:%=install-%)
TEST := $(DIRS:%=test-%)
TEST-BINDINGS := $(BINDINGS:%=test-%)
PUBLISH := $(DIRS:%=publish-%)
CLEAN := $(DIRS:%=clean-%)
REALCLEAN := $(DIRS:%=realclean-%)
DISTCLEAN := $(DIRS:%=distclean-%)
export HEAD := $(shell git rev-parse HEAD)
LYS-JAR-RELEASE := libys-$(YS_VERSION)-standalone.jar
YS-JAR-RELEASE := yamlscript.cli-$(YS_VERSION)-standalone.jar
LYS-JAR-PATH := libys/target/libys-$(YS_VERSION)-standalone.jar
YS-JAR-PATH := ys/target/uberjar/yamlscript.cli-$(YS_VERSION)-SNAPSHOT-standalone.jar
YS-RELEASE := $(RELEASE-YS-NAME).tar.xz
LYS-RELEASE := $(RELEASE-LYS-NAME).tar.xz
JAR-ASSETS := \
$(LYS-JAR-RELEASE) \
$(YS-JAR-RELEASE) \
ifndef JAR_ONLY
RELEASE-ASSETS := \
$(LYS-RELEASE) \
$(YS-RELEASE)
endif
RELEASE-ASSETS += \
$(JAR-ASSETS) \
RELEASE-LOG := release-$n.log
ifdef PREFIX
override PREFIX := $(abspath $(PREFIX))
endif
ifdef v
export YS_RELEASE_VERBOSE := 1
endif
ifdef d
export YS_RELEASE_DRYRUN := 1
endif
ifdef l
export YS_RELEASE_LAST_STEP := $l
endif
ifdef n
export YS_RELEASE_VERSION_NEW := $n
endif
ifdef o
export YS_OLD_TAG := $o
export YS_RELEASE_VERSION_OLD := $o
endif
default::
# Claude Code's paste-image flow writes the clipboard image to
# $CLAUDE_CODE_TMPDIR (default /tmp) and then reads it back. Nono's
# default profile allows writes to /tmp but blocks reads, so redirect
# to the already-RW /tmp/claude-<uid> dir from claude.mk.
claude: export CLAUDE_CODE_TMPDIR := /tmp/claude-$(shell id -u)
claude: claude-nono
# Sync the local ys-skill plugin source into Claude Code's marketplace
# cache so edits take effect without a push/pull round-trip.
CLAUDE-CACHE := $(HOME)/.claude/plugins/marketplaces/yamlscript
claude-skill-local-update:
[[ -d $(CLAUDE-CACHE)/ai/claude/ys-skill ]]
$(RM) -r $(CLAUDE-CACHE)/ai/claude/ys-skill
cp -pPR ai/claude/ys-skill $(CLAUDE-CACHE)/ai/claude/
cp -pPR .claude-plugin/marketplace.json \
$(CLAUDE-CACHE)/.claude-plugin/marketplace.json
@echo "Updated ys-skill -> $(CLAUDE-CACHE)"
env::
@env | sort | less -FRX
chown::
sudo chown -R $(USER):$(USER) .
ys-files:
@( \
find . -name '*.ys' | cut -c3-; \
ag -asl --hidden '^#!/usr/bin/env ys-0$$' .; \
) | grep -Ev '(^note/)' | \
LC_ALL=C sort | uniq
nrepl nrepl-stop nrepl+:
$(MAKE) -C core $@
$(BUILD):
build:: $(BUILD)
build-%: %
$(MAKE) -C $< build
force:
$(BUILD-DOC):
build-doc: force $(BUILD-DOC)
@:
build-doc-%: %
$(MAKE) -C $< build-doc
$(INSTALL):
install: $(INSTALL)
install-%: % build-%
-$(MAKE) -C $< install PREFIX=$(PREFIX)
$(TEST):
test:
$(TIME) $(MAKE) test-all
test-all: $(TEST)
@echo
@echo 'ALL TESTS PASSED!'
test-core:
@echo
@echo "=== Testing 'core' ==="
@echo
$(TIME) $(MAKE) -C core test v=$v
test-ys:
@echo
@echo "=== Testing 'ys' ==="
@echo
$(TIME) $(MAKE) -C ys test v=$v GRAALVM-O=b
test-%: %
@echo
@echo "=== Testing '$<' ==="
@echo
$(TIME) $(MAKE) -C $< test v=$v GRAALVM-O=b
test-unit:
$(TIME) $(MAKE) -C core test v=$v
$(TIME) $(MAKE) -C ys test v=$v
test-bindings: $(TEST-BINDINGS)
serve publish:
$(MAKE) -C www $@
ifneq (,$(or $s,$(YS_RELEASE_ID),$(YS_RELEASE_NO_CHECK)))
release: _release-yamlscript
else
release: release-check realclean release-pull _release-yamlscript
endif
release-check:
ifndef YS_RELEASE_NO_CHECK
ifneq (v0,$(shell git rev-parse --abbrev-ref HEAD))
$(error Must be on branch 'v0' to release)
endif
ifeq (,$(wildcard $(HOME)/.yamlscript-secrets.yaml))
$(error YS release requires $(SECRETS) file)
endif
endif
ifndef d
ifndef RELEASE-ID
ifndef YS_RELEASE_VERSION_OLD
$(error 'make release' needs the 'o' variable set to the old version)
endif
ifndef YS_RELEASE_VERSION_NEW
$(error 'make release' needs the 'n' variable set to the new version)
endif
endif
endif
release-pull:
ifndef d
( \
set -ex; \
git pull --rebase; \
if [[ $$(git rev-parse HEAD) != $$HEAD ]]; then \
echo "Pulled new changes. Please re-run 'make release'."; \
exit 1; \
fi \
)
endif
ifdef IS-LINUX
ifdef IS-INTEL
docker-build := YS_BUILD_IN_DOCKER=1
endif
endif
_release-yamlscript: $(YS)
($(TIME) $(docker-build) \
$< $(ROOT)/util/release-yamlscript $o $n $s) 2>&1 | \
tee -a $(RELEASE-LOG)
release-assets: $(RELEASE-ASSETS)
release-assets $^
release-build: release-build-ys release-build-libys
release-build-ys: $(YS-RELEASE)
release-build-libys: $(LYS-RELEASE)
jars: $(JAR-ASSETS)
$(YS-RELEASE): $(RELEASE-YS-NAME)
mkdir -p $<
cp -pPR ys/bin/ys* $</
cp common/install.mk $</Makefile
ifeq (true,$(IS-MACOS))
$(TIME) tar -J -cf $@ $<
else
$(TIME) tar -I'xz -0' -cf $@ $<
endif
$(LYS-RELEASE): $(RELEASE-LYS-NAME)
mkdir -p $<
cp -pPR libys/lib/libys*.$(SO)* $</
cp -pPR libys/lib/*.h $</
cp common/install.mk $</Makefile
ifeq (true,$(IS-MACOS))
$(TIME) tar -J -cf $@ $<
else
$(TIME) tar -I'xz -0' -cf $@ $<
endif
$(RELEASE-YS-NAME): build-ys
$(RELEASE-LYS-NAME): build-libys
$(LYS-JAR-RELEASE): $(LYS-JAR-PATH)
cp $< $@
$(YS-JAR-RELEASE): $(YS-JAR-PATH)
cp $< $@
$(LYS-JAR-PATH):
$(MAKE) -C libys jar
$(YS-JAR-PATH):
$(MAKE) -C ys jar
delete-tag:
-git tag --delete $(YS_VERSION)
-git push --delete origin $(YS_VERSION)
bump: $(YS)
$< $(ROOT)/util/version-bump
$(CLEAN):
clean:: $(CLEAN)
$(RM) -r $(MAVEN-REPOSITORY)/yamlscript
$(RM) -r $(MAVEN-REPOSITORY)/org/yamlscript
$(RM) -r libys/lib ys/bin
$(RM) -r libys-0* ys-0* yamlscript.cli-*.jar
$(RM) -r sample/advent/hearsay-rust/target/
$(RM) -r homebrew-yamlscript
$(RM) NO-NAME release*.log
clean-%: %
$(MAKE) -C $< clean
ifdef d
realclean::
else
$(REALCLEAN):
realclean:: clean $(REALCLEAN)
$(MAKE) docker-kill
$(MAKE) -C www $@
$(RM) release-* $(DOCKER-FILE)
realclean-%: %
$(MAKE) -C $< realclean
endif
$(DISTCLEAN):
distclean:: realclean $(DISTCLEAN)
$(MAKE) -C www $@
$(RM) -r bin/ lib/ website/
distclean-%: %
$(MAKE) -C $< distclean
$(RM) -r .calva/ .clj-kondo/.cache .lsp/
sysclean:: realclean
$(RM) -r $(ROOT)/.cache/
$(RM) -r $(ROOT)/.clj-kondo/.cache/