Skip to content
Snippets Groups Projects
Makefile 1.64 KiB
Newer Older
PREFIX=/usr
GHCFLAGS=-O2 -Wall
GHCMAKE=ghc -odir build -hidir build $(GHCFLAGS) --make
Joey Hess's avatar
Joey Hess committed

Joey Hess's avatar
Joey Hess committed
bins=git-annex git-annex-shell
mans=git-annex.1 git-annex-shell.1

all: $(bins) $(mans) docs
	$(GHCMAKE) configure
	./configure

Joey Hess's avatar
Joey Hess committed
$(bins): SysConfig.hs
	$(GHCMAKE) $@

git-annex.1:
	./mdwn2man git-annex 1 doc/git-annex.mdwn > git-annex.1
Joey Hess's avatar
Joey Hess committed
git-annex-shell.1:
	./mdwn2man git-annex 1 doc/git-annex-shell.mdwn > git-annex-shell.1
Joey Hess's avatar
add
Joey Hess committed

	install -d $(DESTDIR)$(PREFIX)/bin
Joey Hess's avatar
Joey Hess committed
	install $(bins) $(DESTDIR)$(PREFIX)/bin
	install -d $(DESTDIR)$(PREFIX)/share/man/man1
Joey Hess's avatar
Joey Hess committed
	install -m 0644 $(mans) $(DESTDIR)$(PREFIX)/share/man/man1
	install -d $(DESTDIR)$(PREFIX)/share/doc/git-annex
	if [ -d html ]; then \
		rsync -a --delete html/ $(DESTDIR)$(PREFIX)/share/doc/git-annex/html/; \
	fi
Joey Hess's avatar
Joey Hess committed

Joey Hess's avatar
Joey Hess committed
test:
	$(GHCMAKE) test
	./test

testcoverage:
	rm -f test.tix test
	ghc -odir build/test -hidir build/test $(GHCFLAGS) --make -fhpc test
	./test
Joey Hess's avatar
Joey Hess committed
	@echo ""
Joey Hess's avatar
Joey Hess committed
	@hpc report test --exclude=Main --exclude=QC
	@hpc markup test --exclude=Main --exclude=QC --destdir=.hpc >/dev/null
Joey Hess's avatar
Joey Hess committed
# If ikiwiki is available, build static html docs suitable for being
# shipped in the software package.
Joey Hess's avatar
Joey Hess committed
ifeq ($(shell which ikiwiki),)
IKIWIKI=@echo "** ikiwiki not found, skipping building docs" >&2; true
Joey Hess's avatar
Joey Hess committed
else
IKIWIKI=ikiwiki
endif

Joey Hess's avatar
Joey Hess committed
docs: $(mans)
Joey Hess's avatar
Joey Hess committed
	$(IKIWIKI) doc html -v --wikiname git-annex --plugin=goodstuff \
Joey Hess's avatar
Joey Hess committed
		--no-usedirs --disable-plugin=openid --plugin=sidebar \
Joey Hess's avatar
Joey Hess committed
		--underlaydir=/dev/null --disable-plugin=shortcut \
		--disable-plugin=smiley \
		--exclude='news/.*'
Joey Hess's avatar
add
Joey Hess committed

Joey Hess's avatar
Joey Hess committed
clean:
	rm -rf build $(bins) $(mans) test configure SysConfig.hs *.tix .hpc
Joey Hess's avatar
Joey Hess committed
	rm -rf doc/.ikiwiki html

Joey Hess's avatar
Joey Hess committed
.PHONY: $(bins) test install