Add basic Makefile

pull/3/head
Malachi Soord 2021-02-11 21:21:22 +01:00
parent 0c2fd3066e
commit b30453cc09
No known key found for this signature in database
GPG Key ID: C61BEBD6CC542333
2 changed files with 25 additions and 0 deletions

4
.gitignore vendored
View File

@ -14,3 +14,7 @@ main
# Dependency directories (remove the comment below to include it) # Dependency directories (remove the comment below to include it)
# vendor/ # vendor/
# Build
/bin

21
Makefile 100644
View File

@ -0,0 +1,21 @@
PROJECT?=github.com/edgebox-iot/sysctl
RELEASE ?= dev
COMMIT := $(shell git rev-parse --short HEAD)
BUILD_DATE := $(shell date -u '+%Y-%m-%d_%H:%M:%S')
BUILD_DIR = bin
build-all:
GOOS=linux GOARCH=amd64 make build
build:
@echo "Building ${GOOS}-${GOARCH}"
GOOS=${GOOS} GOARCH=${GOARCH} go build \
-trimpath -ldflags "-s -w -X ${PROJECT}/internal/diagnostics.Version=${RELEASE} \
-X ${PROJECT}/internal/diagnostics.Commit=${COMMIT} \
-X ${PROJECT}/internal/diagnostics.BuildDate=${BUILD_DATE}" \
-o bin/sysctl-${GOOS}-${GOARCH} ${PROJECT}
clean:
rm -rf ${BUILD_DIR} ${DIST_DIR}
go clean