annotator/Makefile
2023-01-06 14:48:31 +01:00

45 lines
1 KiB
Makefile

.PHONY: default all install watch clean build release distclean lint doc
default: all
all: build
GHCFLAGS = -iapp -isrc -Wall -O2 -outputdir build/.obj
BUILDDIR = build
DESTDIR = ~/.local
BINDIR = ${DESTDIR}/bin
DOCDIR = ${DESTDIR}/share/doc/annotator
build: builddir | $(BUILDDIR)/bin/annotator doc
builddir:
mkdir -p $(BUILDDIR)/{bin,.obj,ci,dist,doc}
doc: builddir | $(BUILDDIR)/doc/README.md
$(BUILDDIR)/bin/annotator: app/Main.hs src/*.hs
ghc --make $(GHCFLAGS) $< -o $@
$(BUILDDIR)/doc/README.md: README.org
pandoc -t gfm $< -o $@
watch:
@git ls-files src app Makefile | entr make -s build install
lint: builddir
hlint lint --git --cc --no-exit-code | tr -d '\0' | jq -s . > $(BUILDDIR)/ci/hlint.report.json
clean:
@rm -rf $(BUILDDIR)
@find . -name "*.hi" -delete
@find . -name "*.fix" -delete
distclean: clean
@rm -rf dist
install: build
@install -m 0755 -D -t ${BINDIR} $(BUILDDIR)/bin/annotator
@install -m 0644 -D -t ${DOCDIR} README.org
@install -m 0644 -D -t ${DOCDIR} $(BUILDDIR)/doc/README.md
release: script/make-release
@$<