Skip to content
Snippets Groups Projects
Makefile 2.21 KiB
Newer Older
PREFIX=/usr
IGNORE=-ignore-package monads-fd
Joey Hess's avatar
Joey Hess committed
GHCFLAGS=-O2 -Wall $(IGNORE)
ifdef PROFILE
GHCFLAGS=-prof -auto-all -rtsopts -caf-all -fforce-recomp $(IGNORE)
GHCMAKE=ghc $(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
Joey Hess's avatar
Joey Hess committed
SysConfig.hs: configure.hs TestConfig.hs
	$(GHCMAKE) configure
	./configure

Joey Hess's avatar
Joey Hess committed
%.hs: %.hsc
Joey Hess's avatar
Joey Hess committed
	hsc2hs $<
Joey Hess's avatar
Joey Hess committed
	perl -i -pe 's/^{-# INCLUDE.*//' $@
Joey Hess's avatar
Joey Hess committed

Remote/S3.o:
	@ln -sf S3real.hs Remote/S3.hs
	@if ! $(GHCMAKE) Remote/S3.hs; then \
		ln -sf S3stub.hs Remote/S3.hs; \
		echo "** building without S3 support"; \
	fi

$(bins): SysConfig.hs Touch.hs StatFS.hs Remote/S3.o
Joey Hess's avatar
Joey Hess committed
	$(GHCMAKE) $@

Joey Hess's avatar
Joey Hess committed
git-annex.1: doc/git-annex.mdwn
	./mdwn2man git-annex 1 doc/git-annex.mdwn > git-annex.1
Joey Hess's avatar
Joey Hess committed
git-annex-shell.1: doc/git-annex-shell.mdwn
	./mdwn2man git-annex-shell 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

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

testcoverage: $(bins)
	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 \
Joey Hess's avatar
Joey Hess committed
		--plugin=comments --set comments_pagespec="*" \
Joey Hess's avatar
add
Joey Hess committed

Joey Hess's avatar
Joey Hess committed
clean:
	rm -rf build $(bins) $(mans) test configure  *.tix .hpc \
		StatFS.hs Touch.hs SysConfig.hs Remote/S3.hs
Joey Hess's avatar
Joey Hess committed
	rm -rf doc/.ikiwiki html
	find . \( -name \*.o -or -name \*.hi \) -exec rm {} \;
Joey Hess's avatar
Joey Hess committed

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