From 60ed30e95a37a7a7eb1c988b41db48b5162eaebb Mon Sep 17 00:00:00 2001 From: Alberto Bertogli Date: Sat, 22 Oct 2016 18:36:45 +0100 Subject: [PATCH] Add a Makefile This patch introduces a Makefile to make it easier to build with version information, and run all the tests together. It's just for convenience, plain go commands continue to work just fine. --- .gitignore | 5 +++++ Makefile | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 79a0a55..9bb463a 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,12 @@ # The binaries. chasquid +chasquid-util +smtp-check +spf-check cmd/chasquid-util/chasquid-util +cmd/smtp-check/smtp-check +cmd/spf-check/spf-check # Exclude any .pem files, to prevent accidentally including test keys and # certificates. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..02c23cb --- /dev/null +++ b/Makefile @@ -0,0 +1,40 @@ + +ifndef VERSION + VERSION = `git describe --always --long --dirty` +endif + +# https://wiki.debian.org/ReproducibleBuilds/TimestampsProposal +ifndef SOURCE_DATE_EPOCH + SOURCE_DATE_EPOCH = `git log -1 --format=%ct` +endif + + +default: chasquid + +all: chasquid chasquid-util smtp-check spf-check + + +chasquid: + go build -ldflags="\ + -X main.version=${VERSION} \ + -X main.sourceDateTs=${SOURCE_DATE_EPOCH} \ + " ${GOFLAGS} + + +chasquid-util: + go build ${GOFLAGS} ./cmd/chasquid-util/ + +smtp-check: + go build ${GOFLAGS} ./cmd/smtp-check/ + +spf-check: + go build ${GOFLAGS} ./cmd/spf-check/ + + +test: + go test ${GOFLAGS} ./... + setsid -w ./test/run.sh + setsid -w ./cmd/chasquid-util/test.sh + + +.PHONY: chasquid chasquid-util smtp-check spf-check test