Skip to content

Instantly share code, notes, and snippets.

@tjstebbing
Created March 11, 2019 11:47
Show Gist options
  • Save tjstebbing/10820c758f28b9ac346939bd91dd902c to your computer and use it in GitHub Desktop.
Save tjstebbing/10820c758f28b9ac346939bd91dd902c to your computer and use it in GitHub Desktop.
golang makefile
VERSION ?=0.0.1
BUILD_TIME :=$(date -u '+%Y-%m-%d_%I:%M:%S%p')
BRANCH :=`git rev-parse --abbrev-ref HEAD`
COMMIT :=`git rev-parse HEAD`
LDFLAGS=-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILD_TIME} -X main.COMMIT=${COMMIT} -X main.BRANCH=${BRANCH}"
BINARY :="surge"
default: build/sitemap.xml
surge: vendor
go build ${LDFLAGS} -o $(BINARY) cmd/surge/main.go
vendor:
dep ensure
build/sitemap.xml: ./surge build
./sh/buildmaps.sh $(VERSION)
build:
mkdir -p build/sitemap
clean:
rm -rf ./build*
rm ./surge
reallyclean: clean
rm -f ./surge
rm -rf ./vendor
deploy: build/sitemap.xml
./sh/deploy.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment