forked from h2oai/wave
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
98 lines (76 loc) · 2.67 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
OS?=linux
VERSION ?= $(shell cat VERSION)
BUILD_DATE?=$(shell date '+%Y%m%d%H%M%S')
REL=wave-$(VERSION)-$(OS)-amd64
LDFLAGS := -ldflags '-X main.Version=$(VERSION) -X main.BuildDate=$(BUILD_DATE)'
all: clean setup build ## Setup and build everything
setup: ## Set up development dependencies
cd ui && $(MAKE) setup
cd py && $(MAKE) setup
cd tools/wavegen && $(MAKE) setup build
clean: ## Clean
rm -rf build
cd ui && $(MAKE) clean
cd py && $(MAKE) clean
cd tools/wavegen && $(MAKE) clean
rm -f waved
.PHONY: build
build: build-ui build-server ## Build everything
build-ui: ## Build UI
cd ui && $(MAKE) build
build-ide: ## Build IDE
cd ide && npm run build
rm -rf ui/build/_ide
mv ide/dist ui/build/_ide
generator: ## Build driver generator
cd tools/wavegen && $(MAKE) build
run-ui: ## Run UI in development mode (hot reloading)
cd ui && $(MAKE) run
test-ui-ci: ## Run UI unit tests in CI mode
cd ui && $(MAKE) test-ci
test-ui-watch: ## Run UI unit tests
cd ui && $(MAKE) test
build-server: ## Build server for current OS/Arch
go build $(LDFLAGS) -o waved cmd/wave/main.go
build-py: ## Build h2o_wave wheel
cd py && $(MAKE) release
build-docker:
docker build \
--build-arg uid=$(shell id -u) \
--build-arg gid=$(shell id -g) \
-t wave-test:$(VERSION) \
.
run: ## Run server
go run cmd/wave/main.go -web-dir ./ui/build -debug -editable
run-cypress: ## Run Cypress
cd test && ./node_modules/.bin/cypress open
generate: ## Generate driver bindings
cd tools/wavegen && $(MAKE) run
.PHONY: docs
docs: ## Generate API docs and copy to website
cd py && $(MAKE) docs
release: build-ui build-py ## Prepare release builds (e.g. "VERSION=1.2.3 make release)"
$(MAKE) OS=linux release-os
$(MAKE) OS=darwin release-os
$(MAKE) OS=windows EXE_EXT=".exe" release-os
$(MAKE) build-website
$(MAKE) publish-website
release-os:
rm -rf build/$(REL)
mkdir -p build/$(REL)
rsync -a ui/build/ build/$(REL)/www
rsync -a py/examples build/$(REL)/
rsync -a py/demo build/$(REL)/
rm -rf test/cypress/integration/*.js
rm -rf test/cypress/screenshots/*.*
rm -rf test/cypress/videos/*.*
rsync --exclude node_modules -a test build/$(REL)/
GOOS=$(OS) GOARCH=amd64 go build $(LDFLAGS) -o build/$(REL)/waved$(EXE_EXT) cmd/wave/main.go
cp readme.txt build/$(REL)/readme.txt
cd build && tar -czf $(REL).tar.gz --exclude='*.state' --exclude='__pycache__' $(REL)
build-website: docs ## Build website
cd website && npm ci && npm run build
publish-website: ## Publish website
rm -rf docs && mkdir docs && rsync -a website/build/ docs/
help: ## List all make tasks
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'