-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
49 lines (40 loc) · 1.17 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
RELEASE_TARGET := $(shell go run . eval "__os + '-' + __arch" 2>/dev/null)
JSBUILTIN_FILES := $(shell cd internal/jsbuiltin/src && find . -type f -name '*.js' -print0 | xargs -0)
.PHONY: all
all: jssh jssh_m
.PHONY: info
info:
@echo "RELEASE_TARGET: $(RELEASE_TARGET)"
@echo "JSBUILTIN_FILES: $(JSBUILTIN_FILES)"
.PHONY: clean
clean:
@rm -rf release node_modules
.PHONY: jssh
jssh: jsbuiltin
@go run . build.js
@ln -sf $(RELEASE_TARGET)/jssh release/jssh
@ls -alh release/*
.PHONY: jssh-only
jssh-only:
@go run . build.js
@ln -sf $(RELEASE_TARGET)/jssh release/jssh
@ls -alh release/*
.PHONY: jssh_m
jssh_m: jssh
@cp release/$(RELEASE_TARGET)/jssh release/$(RELEASE_TARGET)/jssh_m
@upx --best --lzma release/$(RELEASE_TARGET)/jssh_m
@ln -sf $(RELEASE_TARGET)/jssh_m release/jssh_m
@ls -alh release/*
.PHONY: go-nm
go-nm:
@go build -o release/jssh .
@go tool nm -size -sort size -type release/jssh 2>/dev/null | head -500
.PHONY: jsbuiltin
jsbuiltin: node_modules
@echo "Building JS builtin files..."
@for f in $(JSBUILTIN_FILES); do \
echo " $$f"; \
npx uglifyjs -c -- internal/jsbuiltin/src/$$f > internal/jsbuiltin/$$f; \
done
node_modules: package.json
@npm install