-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
41 lines (32 loc) · 1.04 KB
/
Makefile
File metadata and controls
41 lines (32 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
.PHONY: all build backend frontend linux test check clean
all: build
# build is the default target, builds for the current OS/ARCH
# By default the build target runs the frontend step. To skip the frontend
# (for example when the frontend was already built and restored by CI), set
# SKIP_FRONTEND=1 in the environment.
build:
@if [ -z "$(SKIP_FRONTEND)" ] || [ "$(SKIP_FRONTEND)" != "1" ]; then \
$(MAKE) frontend; \
fi
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $(BINARY_NAME)$(EXT) .
# backend is an alias for build
backend: build
# frontend builds the web UI
frontend:
cd frontend && npm install && npm run build
rm -rf cmd/dist
cp -R frontend/dist cmd/
# linux target for cross-compilation
linux: frontend
GOOS=linux GOARCH=amd64 go build -o sshman-linux .
# test runs backend and frontend tests
test: frontend
go test ./...
cd frontend && npm run lint
# check is an alias for test, often used in CI
check: test
# clean removes build artifacts
clean:
rm -f sshman sshman-linux
rm -rf cmd/dist
cd frontend && rm -rf dist node_modules