chore(makefile): polish Makefile

This commit is contained in:
Piotr Grabowski 2023-02-04 18:13:57 +01:00
parent c35438c33d
commit d27039fdb7

View file

@ -1,4 +1,8 @@
.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)
@ -7,18 +11,21 @@ build:
go build -o target/gomicsv \
-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