diff --git a/Makefile b/Makefile index bb50ad7..970b7fd 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: default all install watch clean build release distclean +.PHONY: default all install watch clean build release distclean lint default: all all: build @@ -6,30 +6,34 @@ all: build build: builddir build/bin/annotator GHCFLAGS = -iapp -isrc -Wall -O2 -outputdir build/.obj +BUILDDIR = build DESTDIR = ~/.local BINDIR = ${DESTDIR}/bin DOCDIR = ${DESTDIR}/share/doc/annotator builddir: - mkdir -p build/bin build/.obj + mkdir -p $(BUILDDIR)/bin $(BUILDDIR)/.obj $(BUILDDIR)/ci $(BUILDDIR)/dist -build/bin/annotator: app/Main.hs src/*.hs +$(BUILDDIR)/bin/annotator: app/Main.hs src/*.hs ghc --make $(GHCFLAGS) $< -o $@ watch: @git ls-files src app Makefile | entr make -s build install +lint: + @-hlint -g --cc > $(BUILDDIR)/ci/hlint.report.json + clean: - @rm -rf build + @rm -rf $(BUILDDIR) @find . -name "*.hi" -delete @find . -name "*.fix" -delete distclean: clean @rm -rf dist -install: build/bin/annotator - @install -D -t ${BINDIR} $< - @install -D -t ${DOCDIR} README.md +install: $(BUILDDIR)/bin/annotator + @install -m 0755 -D -t ${BINDIR} $< + @install -m 0644 -D -t ${DOCDIR} README.md release: script/make-release @$< diff --git a/script/make-release b/script/make-release index 5d80e4b..ddf615b 100755 --- a/script/make-release +++ b/script/make-release @@ -1,15 +1,17 @@ #!/usr/bin/env bash # -*- mode: sh -*- - set -e base=$(readlink -f $(dirname "$0")/..) -make -C "${base}" build >/dev/null -version=$(${base}/build/bin/annotator --short-version) + +BUILDDIR=${BUILDDIR:-build} + +make -C "${base}" build BUILDDIR=${BUILDDIR} >/dev/null +version=$(${base}/${BUILDDIR}/bin/annotator --short-version) release=annotator-${version} -out=${base}/dist/${release} +out=${base}/${BUILDDIR}/dist/${release} pkg=${out}.tar.gz -make -C "${base}" install DESTDIR=${out} >/dev/null -pushd ${base}/dist >/dev/null +make -C "${base}" install BUILDDIR=${BUILDDIR} DESTDIR=${out} >/dev/null +pushd ${base}/${BUILDDIR}/dist >/dev/null tar cfz ${pkg} ${release} popd >/dev/null -echo created release for version ${version}: ${pkg} +echo created release for version ${version}: ${base}/${BUILDDIR}/dist/${pkg}