Created
February 14, 2017 07:43
-
-
Save liyu4/153132047981bd1259827953c67d849c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This how we want to name the binary output | |
BINARY=gomake | |
# These are the values we want to pass for VERSION and BUILD | |
VERSION=1.0.0 | |
BUILD=`date +%FT%T%z` | |
# Setup the -Idflags options for go build here,interpolate the variable values | |
LDFLAGS=-ldflags "-X main.Version=${VERSION} -X main.Build=${BUILD}" | |
# Builds the project | |
build: | |
go build ${LDFLAGS} -o ${BINARY} | |
# Installs our project: copies binaries | |
install: | |
go install ${LDFLAGS} | |
# Cleans our projects: deletes binaries | |
clean: | |
if [ -f ${BINARY} ] ; then rm ${BINARY} ; fi | |
.PHONY: clean install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment