chore: Very very rough impl

This commit is contained in:
Karan Sharma 2020-12-09 22:41:09 +05:30
parent bae72607bf
commit f888bd220f
10 changed files with 319 additions and 0 deletions

29
Makefile Normal file
View file

@ -0,0 +1,29 @@
DOGGO-BIN := doggo.bin
HASH := $(shell git rev-parse --short HEAD)
COMMIT_DATE := $(shell git show -s --format=%ci ${HASH})
BUILD_DATE := $(shell date '+%Y-%m-%d %H:%M:%S')
VERSION := ${HASH} (${COMMIT_DATE})
.PHONY: build
build: ## Build the doggo binary
mkdir -p bin/; \
cd cmd/; \
go build -ldflags="-X 'main.buildVersion=${VERSION}' -X 'main.buildDate=${BUILD_DATE}'" -o ${DOGGO-BIN} ./... && \
mv ${DOGGO-BIN} ../bin/${DOGGO-BIN}
.PHONY: run
run: build ## Build and Execute the binary after the build step
./bin/${DOGGO-BIN}
fresh: clean build
clean:
go clean
- rm -f ./bin/${BIN}
# pack-releases runns stuffbin packing on a given list of
# binaries. This is used with goreleaser for packing
# release builds for cross-build targets.
pack-releases:
$(foreach var,$(RELEASE_BUILDS),stuffbin -a stuff -in ${var} -out ${var} ${STATIC} $(var);)