-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (28 loc) · 785 Bytes
/
Makefile
File metadata and controls
37 lines (28 loc) · 785 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
# Binary name
BINARY=flux
VERSION=0.20
GITCOMMIT=`git rev-parse --short HEAD`
BUILD_DATE=`date +%FT%T%z`
# Setup the -ldflags option for go build here, interpolate the variable values
LDFLAGS=-ldflags "-w -s -X main.GitCommit=${GITCOMMIT} -X main.Version=${VERSION} -X main.BuildDate=${BUILD_DATE}"
BUFLAGS=CGO_ENABLED=0
# Release
BUILD_DIR=./build
# Binary
OUTPUT="${BUILD_DIR}/${BINARY}"
# Builds the project
build:
rm -rf ${BUILD_DIR}
mkdir -p ${BUILD_DIR}
# Build for linux
${BUFLAGS} go build ${LDFLAGS} -a -installsuffix cgo -o ${OUTPUT} ./main/main.go
# Copy configs and scripts
cp -R ./main/conf.d ${BUILD_DIR}
# Write version
echo "${VERSION}" > ${BUILD_DIR}/version
ls -lSh ${BUILD_DIR}
install:
go install
clean:
go clean
.PHONY: clean build