git-annex/Makefile

112 lines
3.1 KiB
Makefile
Raw Normal View History

2010-12-11 21:29:50 +00:00
PREFIX=/usr
2011-04-05 18:00:51 +00:00
IGNORE=-ignore-package monads-fd
BASEFLAGS=-Wall $(IGNORE) -outputdir tmp -IUtility
GHCFLAGS=-O2 $(BASEFLAGS)
2011-11-10 01:36:11 +00:00
2011-04-05 18:00:51 +00:00
ifdef PROFILE
GHCFLAGS=-prof -auto-all -rtsopts -caf-all -fforce-recomp $(BASEFLAGS)
2011-04-05 18:00:51 +00:00
endif
2011-11-10 01:36:11 +00:00
GHCMAKE=ghc $(GHCFLAGS) --make
2010-10-19 18:39:40 +00:00
bins=git-annex
mans=git-annex.1 git-annex-shell.1
sources=Build/SysConfig.hs Utility/Touch.hs
clibs=Utility/libdiskfree.o
2011-11-10 01:36:11 +00:00
all=$(bins) $(mans) docs
2011-11-10 07:10:17 +00:00
# Am I typing :make in vim? Do a fast build.
2011-11-10 01:36:11 +00:00
ifdef VIM
2011-11-10 07:10:17 +00:00
all=fast
2011-11-10 01:36:11 +00:00
endif
all: $(all)
sources: $(sources)
2011-11-10 07:10:17 +00:00
# Disables optimisation. Not for production use.
fast: GHCFLAGS=$(BASEFLAGS)
2011-11-10 07:10:17 +00:00
fast: $(bins)
Build/SysConfig.hs: configure.hs Build/TestConfig.hs Build/Configure.hs
2010-12-11 21:29:50 +00:00
$(GHCMAKE) configure
./configure
2011-03-22 19:39:36 +00:00
%.hs: %.hsc
hsc2hs $<
git-annex: $(sources) $(clibs)
$(GHCMAKE) $@ $(clibs)
2011-01-25 22:54:27 +00:00
git-annex.1: doc/git-annex.mdwn
./mdwn2man git-annex 1 doc/git-annex.mdwn > git-annex.1
2011-01-25 22:54:27 +00:00
git-annex-shell.1: doc/git-annex-shell.mdwn
./mdwn2man git-annex-shell 1 doc/git-annex-shell.mdwn > git-annex-shell.1
git-union-merge.1: doc/git-union-merge.mdwn
./mdwn2man git-union-merge 1 doc/git-union-merge.mdwn > git-union-merge.1
2010-10-10 04:18:16 +00:00
install: all
2010-12-11 21:29:50 +00:00
install -d $(DESTDIR)$(PREFIX)/bin
install $(bins) $(DESTDIR)$(PREFIX)/bin
ln -sf git-annex $(DESTDIR)$(PREFIX)/bin/git-annex-shell
install -d $(DESTDIR)$(PREFIX)/share/man/man1
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
2010-10-16 20:41:24 +00:00
2011-12-20 20:02:59 +00:00
test:
2012-04-05 20:37:44 +00:00
@if ! $(GHCMAKE) -O0 test $(clibs); then \
echo "** failed to build the test suite" >&2; \
exit 1; \
elif ! ./test; then \
echo "** test suite failed!" >&2; \
exit 1; \
fi
2010-12-11 21:37:24 +00:00
2011-12-20 20:02:59 +00:00
testcoverage:
rm -f test.tix test
ghc $(GHCFLAGS) -outputdir tmp/testcoverage --make -fhpc test
./test
2011-01-07 01:39:26 +00:00
@echo ""
2011-01-05 01:07:58 +00:00
@hpc report test --exclude=Main --exclude=QC
@hpc markup test --exclude=Main --exclude=QC --destdir=.hpc >/dev/null
2011-12-20 20:07:34 +00:00
@echo "(See .hpc/ for test coverage details.)"
2010-10-19 18:39:40 +00:00
# If ikiwiki is available, build static html docs suitable for being
# shipped in the software package.
2010-10-19 18:37:19 +00:00
ifeq ($(shell which ikiwiki),)
IKIWIKI=@echo "** ikiwiki not found, skipping building docs" >&2; true
2010-10-19 18:37:19 +00:00
else
IKIWIKI=ikiwiki
endif
docs: $(mans)
2010-10-19 18:39:40 +00:00
$(IKIWIKI) doc html -v --wikiname git-annex --plugin=goodstuff \
2010-10-19 23:28:29 +00:00
--no-usedirs --disable-plugin=openid --plugin=sidebar \
2010-10-22 19:12:48 +00:00
--underlaydir=/dev/null --disable-plugin=shortcut \
--disable-plugin=smiley \
2011-03-28 16:09:47 +00:00
--plugin=comments --set comments_pagespec="*" \
--exclude='news/.*'
2010-10-10 04:18:16 +00:00
2010-10-19 19:59:40 +00:00
clean:
rm -rf tmp $(bins) $(mans) test configure *.tix .hpc $(sources) \
doc/.ikiwiki html dist $(clibs)
2010-10-19 19:59:40 +00:00
2011-07-02 18:53:55 +00:00
# Workaround for cabal sdist not running Setup hooks, so I cannot
# generate a file list there.
sdist: clean
@if [ ! -e git-annex.cabal.orig ]; then cp git-annex.cabal git-annex.cabal.orig; fi
@sed -e "s!\(Extra-Source-Files: \).*!\1$(shell find . -name .git -prune -or -not -name \\*.orig -not -type d -print | perl -ne 'print unless length >= 100')!i" < git-annex.cabal.orig > git-annex.cabal
2011-07-02 18:53:55 +00:00
@cabal sdist
@mv git-annex.cabal.orig git-annex.cabal
2012-01-13 19:08:28 +00:00
# Upload to hackage.
hackage: sdist
@cabal upload dist/*.tar.gz
.PHONY: $(bins) test install