-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
39 lines (29 loc) · 1.76 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
UI_VERSION=$(shell cat web/bore/package.json | grep version | head -1 | awk -F: '{ print $$2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]')
VERSION_PATH=github.com/jkuri/bore/internal/version
GIT_COMMIT=$(shell git rev-list -1 HEAD)
BUILD_DATE=$(shell date +%FT%T%z)
RELEASE_DIR=build/release
OS="darwin freebsd linux windows"
ARCH="amd64 arm"
OSARCH="!darwin/arm !windows/arm"
build: statik_landing wire build_server build_client
build_server:
@CGO_ENABLED=0 go build -ldflags "-X ${VERSION_PATH}.GitCommit=${GIT_COMMIT} -X ${VERSION_PATH}.UIVersion=${UI_VERSION} -X ${VERSION_PATH}.BuildDate=${BUILD_DATE}" -o ./build/bore-server ./cmd/bore-server
build_client:
@CGO_ENABLED=0 go build -ldflags "-X ${VERSION_PATH}.GitCommit=${GIT_COMMIT} -X ${VERSION_PATH}.UIVersion=${UI_VERSION} -X ${VERSION_PATH}.BuildDate=${BUILD_DATE}" -o ./build/bore ./cmd/bore
build_ui_landing:
@if [ ! -d "web/bore/dist" ]; then cd web/bore && npm run build; fi
wire:
@wire ./cmd/bore-server
statik_landing: build_ui_landing
@if [ ! -r "internal/ui/landing/statik.go" ]; then statik -dest ./internal/ui -p landing -src ./web/bore/dist; fi
install_dependencies:
@go get github.com/jkuri/statik github.com/google/wire/cmd/... github.com/mitchellh/gox
@go install github.com/jkuri/statik
@go install github.com/google/wire/cmd/...
@cd web/bore && npm install
clean:
@rm -rf build/ internal/ui web/bore/dist
release: statik_landing wire
@CGO_ENABLED=0 gox -os=${OS} -arch=${ARCH} -osarch=${OSARCH} -output "${RELEASE_DIR}/{{.Dir}}_{{.OS}}_{{.Arch}}" -ldflags "-X ${VERSION_PATH}.GitCommit=${GIT_COMMIT} -X ${VERSION_PATH}.UIVersion=${UI_VERSION} -X ${VERSION_PATH}.BuildDate=${BUILD_DATE}" ./cmd/bore ./cmd/bore-server
.PHONY: wire build_server build_client build build_ui_landing statik_landing clean release