Add support for hlint

This commit is contained in:
Alexander Kobjolke 2023-01-05 12:13:11 +01:00
parent bb2a99b806
commit 799e804dab
2 changed files with 20 additions and 14 deletions

View file

@ -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 default: all
all: build all: build
@ -6,30 +6,34 @@ all: build
build: builddir build/bin/annotator build: builddir build/bin/annotator
GHCFLAGS = -iapp -isrc -Wall -O2 -outputdir build/.obj GHCFLAGS = -iapp -isrc -Wall -O2 -outputdir build/.obj
BUILDDIR = build
DESTDIR = ~/.local DESTDIR = ~/.local
BINDIR = ${DESTDIR}/bin BINDIR = ${DESTDIR}/bin
DOCDIR = ${DESTDIR}/share/doc/annotator DOCDIR = ${DESTDIR}/share/doc/annotator
builddir: 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 $@ ghc --make $(GHCFLAGS) $< -o $@
watch: watch:
@git ls-files src app Makefile | entr make -s build install @git ls-files src app Makefile | entr make -s build install
lint:
@-hlint -g --cc > $(BUILDDIR)/ci/hlint.report.json
clean: clean:
@rm -rf build @rm -rf $(BUILDDIR)
@find . -name "*.hi" -delete @find . -name "*.hi" -delete
@find . -name "*.fix" -delete @find . -name "*.fix" -delete
distclean: clean distclean: clean
@rm -rf dist @rm -rf dist
install: build/bin/annotator install: $(BUILDDIR)/bin/annotator
@install -D -t ${BINDIR} $< @install -m 0755 -D -t ${BINDIR} $<
@install -D -t ${DOCDIR} README.md @install -m 0644 -D -t ${DOCDIR} README.md
release: script/make-release release: script/make-release
@$< @$<

View file

@ -1,15 +1,17 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# -*- mode: sh -*- # -*- mode: sh -*-
set -e set -e
base=$(readlink -f $(dirname "$0")/..) 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} release=annotator-${version}
out=${base}/dist/${release} out=${base}/${BUILDDIR}/dist/${release}
pkg=${out}.tar.gz pkg=${out}.tar.gz
make -C "${base}" install DESTDIR=${out} >/dev/null make -C "${base}" install BUILDDIR=${BUILDDIR} DESTDIR=${out} >/dev/null
pushd ${base}/dist >/dev/null pushd ${base}/${BUILDDIR}/dist >/dev/null
tar cfz ${pkg} ${release} tar cfz ${pkg} ${release}
popd >/dev/null popd >/dev/null
echo created release for version ${version}: ${pkg} echo created release for version ${version}: ${base}/${BUILDDIR}/dist/${pkg}