-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (34 loc) · 938 Bytes
/
Makefile
File metadata and controls
43 lines (34 loc) · 938 Bytes
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
SHELL=/bin/bash
OS=
ARCH=
PROFIX=
NAME=filegogo
VERSION=$(shell git describe --tags || git rev-parse --short HEAD || echo "unknown version")
COMMIT=$(shell git rev-parse HEAD || echo "unknown commit")
BUILD_TIME=$(shell date +%FT%T%z)
LD_FLAGS='\
-X "filegogo/version.Version=$(VERSION)" \
-X "filegogo/version.Commit=$(COMMIT)" \
-X "filegogo/version.Date=$(BUILD_TIME)" \
'
GOBUILD=CGO_ENABLED=0 \
go build -tags release -trimpath -ldflags $(LD_FLAGS)
.PHONY: default
default: webapp build
.PHONY: build
build:
GOOS=$(OS) GOARCH=$(ARCH) $(GOBUILD) -o $(NAME) ./main.go
.PHONY: install
install:
install -Dm755 ${NAME} -t ${PROFIX}/usr/bin/
install -Dm644 conf/${NAME}.toml -t ${PROFIX}/etc/
install -Dm644 conf/${NAME}.service -t ${PROFIX}/lib/systemd/system/
.PHONY: webapp
webapp:
npm run build
test-e2e: default
npm run test:e2e
webapp-clean:
rm -r server/build
clean: webapp-clean
go clean -cache