forked from chhibber/pgme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
39 lines (31 loc) · 809 Bytes
/
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
SHELL := /bin/bash
APP="pgme"
PROJECT?=github.com/chhibber/pgme
PORT?=9101
RELEASE?=$(shell bash ./build/ver.sh)
COMMIT?=$(shell git rev-parse --short HEAD)
BUILD_TIME?=$(shell date -u '+%Y-%m-%d_%H:%M:%S')
CONTAINER_IMAGE?=chhibber/${APP}
GOOS?=linux
GOARCH?=amd64
.PHONY: clean
clean:
rm -f ${APP}
.PHONY: docker-build
docker-build:
docker build -t ${IMAGE_REPO_NAME}:${IMAGE_TAG} .
.PHONY: build
build: clean
CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} go build \
-ldflags "-s -w \
-X main.Release=${RELEASE} \
-X main.Commit=${COMMIT} \
-X main.BuildTime=${BUILD_TIME}" \
-o ${APP}
build-mac: clean
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build \
-ldflags "-s -w \
-X main.Release=${RELEASE} \
-X main.Commit=${COMMIT} \
-X main.BuildTime=${BUILD_TIME}" \
-o ${APP}