-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (33 loc) · 1.04 KB
/
Makefile
File metadata and controls
43 lines (33 loc) · 1.04 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
LDFLAGS := -s -w
CMD_PATH := ./cmd/clock
WEB_SRC := server/webapp
WEB_DEST := cmd/clock/web
all: fmt web build linux mac win
web:
@echo "Building frontend..."
cd $(WEB_SRC) && npm install && npm run build
@echo "Copying frontend to $(WEB_DEST)..."
rm -rf $(WEB_DEST)
mkdir -p $(WEB_DEST)
cp -r $(WEB_SRC)/dist $(WEB_DEST)
@echo "Frontend built"
build: linux
fmt:
go fmt ./...
linux:
env GOOS=linux GOARCH=amd64 go build -trimpath -buildvcs=false -ldflags "$(LDFLAGS)" -o bin/clock-linux $(CMD_PATH)
cp configs/config.toml bin/config.toml
mac:
env GOOS=darwin GOARCH=amd64 go build -trimpath -buildvcs=false -ldflags "$(LDFLAGS)" -o bin/clock-darwin $(CMD_PATH)
cp configs/config.toml bin/config.toml
win:
env GOOS=windows GOARCH=amd64 go build -trimpath -buildvcs=false -ldflags "$(LDFLAGS)" -o bin/clock-windows.exe $(CMD_PATH)
cp configs/config.toml bin/config.toml
test:
go test ./...
clean:
rm -f ./bin/clock*
rm -rf $(WEB_SRC)/node_modules
rm -rf $(WEB_SRC)/dist
rm -rf $(WEB_DEST)
.PHONY: all build web clean fmt linux mac win test