-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
66 lines (57 loc) · 3.58 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
PACKAGE=github.com/hossted/cli
SERVICE_COMMON_PACKAGE=${PACKAGE}/hossted/service/common
VERSION=v"$(shell git describe --tags --always --abbrev=0 --match='[0-9]*.[0-9]*.[0-9]*' 2> /dev/null )"
COMMIT_HASH="$(shell git rev-parse --short HEAD)"
BUILD_TIMESTAMP=$(shell date '+%Y-%m-%d')
LDFLAGS="-X '${PACKAGE}/cmd.VERSION=${VERSION}' \
-X '${PACKAGE}/cmd.ENVIRONMENT=prod' \
-X '${PACKAGE}/cmd.COMMITHASH=${COMMIT_HASH}' \
-X '${SERVICE_COMMON_PACKAGE}.LOKI_PASSWORD=${LOKI_PASSWORD}' \
-X '${SERVICE_COMMON_PACKAGE}.LOKI_URL=${LOKI_URL}' \
-X '${SERVICE_COMMON_PACKAGE}.LOKI_USERNAME=${LOKI_USERNAME}' \
-X '${SERVICE_COMMON_PACKAGE}.MIMIR_PASSWORD=${MIMIR_PASSWORD}' \
-X '${SERVICE_COMMON_PACKAGE}.MIMIR_URL=${MIMIR_URL}' \
-X '${SERVICE_COMMON_PACKAGE}.MIMIR_USERNAME=${MIMIR_USERNAME}' \
-X '${SERVICE_COMMON_PACKAGE}.HOSSTED_API_URL=${HOSSTED_API_URL}' \
-X '${SERVICE_COMMON_PACKAGE}.HOSSTED_AUTH_URL=${HOSSTED_AUTH_URL}' \
-X '${SERVICE_COMMON_PACKAGE}.HOSSTED_CLIENT_ID=${HOSSTED_CLIENT_ID}' \
-X '${SERVICE_COMMON_PACKAGE}.HOSSTED_DEV_CLIENT_ID=${HOSSTED_DEV_CLIENT_ID}' \
-X '${SERVICE_COMMON_PACKAGE}.HOSSTED_DEV_API_URL=${HOSSTED_DEV_API_URL}' \
-X '${SERVICE_COMMON_PACKAGE}.HOSSTED_AUTH_TOKEN=${HOSSTED_AUTH_TOKEN}' \
-X '${SERVICE_COMMON_PACKAGE}.HOSSTED_DEV_AUTH_URL=${HOSSTED_DEV_AUTH_URL}' \
-X '${SERVICE_COMMON_PACKAGE}.LOKI_DEV_URL=${LOKI_DEV_URL}' \
-X '${SERVICE_COMMON_PACKAGE}.MIMIR_DEV_URL=${MIMIR_DEV_URL}'"
DEVFLAGS="-X '${PACKAGE}/cmd.VERSION=dev' \
-X '${PACKAGE}/cmd.ENVIRONMENT=dev' \
-X '${PACKAGE}/cmd.COMMITHASH=${COMMIT_HASH}' \
-X '${SERVICE_COMMON_PACKAGE}.LOKI_PASSWORD=${LOKI_PASSWORD}' \
-X '${SERVICE_COMMON_PACKAGE}.LOKI_URL=${LOKI_URL}' \
-X '${SERVICE_COMMON_PACKAGE}.LOKI_USERNAME=${LOKI_USERNAME}' \
-X '${SERVICE_COMMON_PACKAGE}.MIMIR_PASSWORD=${MIMIR_PASSWORD}' \
-X '${SERVICE_COMMON_PACKAGE}.MIMIR_URL=${MIMIR_URL}' \
-X '${SERVICE_COMMON_PACKAGE}.MIMIR_USERNAME=${MIMIR_USERNAME}' \
-X '${SERVICE_COMMON_PACKAGE}.HOSSTED_API_URL=${HOSSTED_API_URL}' \
-X '${SERVICE_COMMON_PACKAGE}.HOSSTED_AUTH_TOKEN=${HOSSTED_AUTH_TOKEN}' \
-X '${SERVICE_COMMON_PACKAGE}.HOSSTED_AUTH_URL=${HOSSTED_AUTH_URL}' \
-X '${SERVICE_COMMON_PACKAGE}.HOSSTED_CLIENT_ID=${HOSSTED_CLIENT_ID}' \
-X '${SERVICE_COMMON_PACKAGE}.HOSSTED_DEV_API_URL=${HOSSTED_DEV_API_URL}' \
-X '${SERVICE_COMMON_PACKAGE}.LOKI_DEV_URL=${LOKI_DEV_URL}' \
-X '${SERVICE_COMMON_PACKAGE}.HOSSTED_DEV_CLIENT_ID=${HOSSTED_DEV_CLIENT_ID}' \
-X '${SERVICE_COMMON_PACKAGE}.HOSSTED_DEV_AUTH_URL=${HOSSTED_DEV_AUTH_URL}' \
-X '${SERVICE_COMMON_PACKAGE}.MIMIR_DEV_URL=${MIMIR_DEV_URL}'"
linux: main.go
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o bin/linux/hossted-linux-amd64 -v -ldflags=${LDFLAGS}
windows: main.go
GOOS=windows GOARCH=386 go build -o bin/windows/hossted.exe -v -ldflags=${LDFLAGS}
osx: main.go
GOOS=darwin GOARCH=amd64 go build -o bin/osx/hossted-darwin-amd64 -v -ldflags=${LDFLAGS}
dev: main.go
go build -o bin/dev/hossted -v -ldflags=${DEVFLAGS}
linux-dev: main.go
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o bin/dev/hossted-dev-linux-amd64 -v -ldflags=${DEVFLAGS}
osx-dev: main.go
GOOS=darwin GOARCH=amd64 go build -o bin/dev/hossted-dev-darwin-amd64 -v -ldflags=${DEVFLAGS}
windows-dev: main.go
GOOS=windows GOARCH=386 go build -o bin/dev/hossted-dev.exe -v -ldflags=${DEVFLAGS}
test: main.go
go test -v ./... -short