mps

morphux package server
Log | Files | Refs | Submodules | README | LICENSE | git clone https://git.ne02ptzero.me/git/mps

commit 7fcc64e5eb5a56180cace3005fc9e84331a645d5
parent 0ae81d3e4989c4c0b6c240c8ff6cc958dca64a44
Author: MrGosti <gostitsog@gmail.com>
Date:   Wed, 29 Mar 2017 09:22:15 +0200

Add a basic Makefile

Diffstat:
AMakefile | 49+++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile @@ -0,0 +1,48 @@ +SHELL := /bin/bash + +# The name of the executable (default is current directory name) +TARGET := $(shell echo $${PWD\#\#*/}) +.DEFAULT_GOAL: $(TARGET) + +# These will be provided to the target +VERSION := 1.0.0 +BUILD := `git rev-parse HEAD` + +# Use linker flags to provide version/build settings to the target +LDFLAGS=-ldflags "-X=main.Version=$(VERSION) -X=main.Build=$(BUILD)" + +# go source files, ignore vendor directory +SRC = $(shell find . -type f -name '*.go' -not -path "./vendors/*") + +.PHONY: all build clean install uninstall fmt simplify check run + +all: check install + +$(TARGET): $(SRC) + @go build $(LDFLAGS) -o $(TARGET) + +build: $(TARGET) + @true + +clean: + @rm -f $(TARGET) + +install: + @go install $(LDFLAGS) + +uninstall: clean + @rm -f $$(which ${TARGET}) + +fmt: + @gofmt -l -w $(SRC) + +simplify: + @gofmt -s -l -w $(SRC) + +check: + @test -z $(shell gofmt -l main.go | tee /dev/stderr) || echo "[WARN] Fix formatting issues with 'make fmt'" + @for d in $$(go list ./... | grep -v /vendors/); do golint $${d}; done + @go tool vet ${SRC} + +run: install + @$(TARGET)+ \ No newline at end of file