From d27039fdb73b1a112acce32a997bb6d760d0181e Mon Sep 17 00:00:00 2001 From: Piotr Grabowski Date: Sat, 4 Feb 2023 18:13:57 +0100 Subject: [PATCH] chore(makefile): polish Makefile --- Makefile | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index a77e761..1d712c1 100755 --- a/Makefile +++ b/Makefile @@ -1,24 +1,31 @@ -.PHONY: build clean dist +# --- PREAMBLE +SHELL := bash +.ONESHELL: +.SHELLFLAGS := -eu -o pipefail -c +MAKEFLAGS += --warn-undefined-variables BUILD_DATE := $(shell date +'%Y%m%d') VERSION := $(shell support/get-version.sh) build: go build -o target/gomicsv \ - -ldflags="-X main.buildDate=$(BUILD_DATE) -X main.versionString=$(VERSION)" \ - cmd/gomicsv/main.go + -ldflags="-X main.buildDate=$(BUILD_DATE) -X main.versionString=$(VERSION)" \ + cmd/gomicsv/main.go +.PHONY: build clean: - rm -rf target/; \ + rm -rf target/ +.PHONY: clean dist: build - rm -rf target/dist; \ - rm -rf target/*.zip; \ - mkdir -p target/dist/gomicsv; \ - cp target/gomicsv target/dist/gomicsv/gomicsv; \ - cp README.md target/dist/gomicsv; \ - cp COPYING.md target/dist/gomicsv; \ - cp CHANGELOG.md target/dist/gomicsv; \ - pushd target/dist; \ - zip -r ../Gomics-v_$(VERSION).zip gomicsv; \ - rm -rf gomicsv; \ + rm -rf target/dist + rm -rf target/*.zip + mkdir -p target/dist/gomicsv + cp target/gomicsv target/dist/gomicsv/gomicsv + cp README.md target/dist/gomicsv + cp COPYING.md target/dist/gomicsv + cp CHANGELOG.md target/dist/gomicsv + pushd target/dist + zip -r ../Gomics-v_$(VERSION).zip gomicsv + rm -rf gomicsv +.PHONY: dist