-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
39 lines (28 loc) · 853 Bytes
/
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
NAME=nano-oj
BINDIR=build
VERSION=1.1.0
BUILDTIME=$(shell date -u)
GOBUILD=cd judge && go mod tidy && go build -ldflags '-s -w -X "main.version=$(VERSION)" -X "main.buildTime=$(BUILDTIME)"'
FRONTBUILD=cd web && pnpm i && pnpm run build --outDir=../$(BINDIR)/dist --emptyOutDir
.PHONY: web init
all: linux-amd64 windows-amd64 web
web:
$(FRONTBUILD)
linux-amd64:
GOOS=linux GOARCH=amd64 $(GOBUILD) -o ../$(BINDIR)/$(NAME)-$@
windows-amd64:
GOOS=windows GOARCH=amd64 $(GOBUILD) -o ../$(BINDIR)/$(NAME)[email protected]
dev:
(cd $(BINDIR) && ./$(NAME)-linux-amd64) & \
(cd web && pnpm i && vite dev --host --port 8080)
run:
cd $(BINDIR) && ./$(NAME)-linux-amd64
deploy: init web linux-amd64
docker-compose up -d
init:
(cd judge && go mod tidy) && \
(cd web && pnpm i)
push:
git push zero --all
clean:
rm -rf $(BINDIR)/$(NAME)-* $(BINDIR)/dist