2012-07-26 01:26:13 +00:00
|
|
|
CFLAGS=-Wall
|
2012-08-07 16:24:12 +00:00
|
|
|
GIT_ANNEX_TMP_BUILD_DIR?=tmp
|
2012-07-26 01:26:13 +00:00
|
|
|
IGNORE=-ignore-package monads-fd -ignore-package monads-tf
|
2012-08-07 16:03:42 +00:00
|
|
|
BASEFLAGS=-threaded -Wall $(IGNORE) -outputdir $(GIT_ANNEX_TMP_BUILD_DIR) -IUtility
|
2012-09-07 18:54:00 +00:00
|
|
|
|
|
|
|
# If you get build failures due to missing haskell libraries,
|
|
|
|
# you can turn off some of these features.
|
2012-09-07 23:44:20 +00:00
|
|
|
FEATURES=-DWITH_ASSISTANT -DWITH_S3 -DWITH_WEBAPP -DWITH_OLD_YESOD -DWITH_PAIRING
|
2012-07-26 01:26:13 +00:00
|
|
|
|
2012-06-18 16:25:20 +00:00
|
|
|
bins=git-annex
|
|
|
|
mans=git-annex.1 git-annex-shell.1
|
2012-07-19 17:01:41 +00:00
|
|
|
sources=Build/SysConfig.hs Utility/Touch.hs Utility/Mounts.hs
|
2012-06-18 16:25:20 +00:00
|
|
|
all=$(bins) $(mans) docs
|
2012-06-18 08:20:35 +00:00
|
|
|
|
2012-06-18 16:25:20 +00:00
|
|
|
OS:=$(shell uname | sed 's/[-_].*//')
|
2012-06-18 08:20:35 +00:00
|
|
|
ifeq ($(OS),Linux)
|
2012-07-26 01:26:13 +00:00
|
|
|
OPTFLAGS=-DWITH_INOTIFY -DWITH_DBUS
|
2012-07-20 00:38:58 +00:00
|
|
|
clibs=Utility/libdiskfree.o Utility/libmounts.o
|
2012-06-18 16:25:20 +00:00
|
|
|
else
|
2012-07-24 15:01:15 +00:00
|
|
|
# BSD system
|
2012-07-26 01:26:13 +00:00
|
|
|
OPTFLAGS=-DWITH_KQUEUE
|
2012-07-20 00:38:58 +00:00
|
|
|
clibs=Utility/libdiskfree.o Utility/libmounts.o Utility/libkqueue.o
|
2012-07-24 15:01:15 +00:00
|
|
|
ifeq ($(OS),Darwin)
|
2012-07-26 01:26:13 +00:00
|
|
|
OPTFLAGS=-DWITH_KQUEUE -DOSX
|
2012-07-24 15:01:15 +00:00
|
|
|
# Ensure OSX compiler builds for 32 bit when using 32 bit ghc
|
|
|
|
GHCARCH:=$(shell ghc -e 'print System.Info.arch')
|
|
|
|
ifeq ($(GHCARCH),i386)
|
|
|
|
CFLAGS=-Wall -m32
|
|
|
|
endif
|
|
|
|
endif
|
2012-06-18 08:20:35 +00:00
|
|
|
endif
|
|
|
|
|
2010-12-11 21:29:50 +00:00
|
|
|
PREFIX=/usr
|
2012-07-26 17:02:00 +00:00
|
|
|
GHCFLAGS=-O2 $(BASEFLAGS) $(FEATURES) $(OPTFLAGS)
|
2011-11-10 01:36:11 +00:00
|
|
|
|
2011-04-05 18:00:51 +00:00
|
|
|
ifdef PROFILE
|
2012-07-26 01:26:13 +00:00
|
|
|
GHCFLAGS=-prof -auto-all -rtsopts -caf-all -fforce-recomp $(BASEFLAGS) $(FEATURES) $(OPTFLAGS)
|
2011-04-05 18:00:51 +00:00
|
|
|
endif
|
2011-11-10 01:36:11 +00:00
|
|
|
|
2011-01-07 06:15:23 +00:00
|
|
|
GHCMAKE=ghc $(GHCFLAGS) --make
|
2010-10-19 18:39:40 +00:00
|
|
|
|
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
|
|
|
|
|
2012-08-20 20:02:41 +00:00
|
|
|
build: $(all)
|
|
|
|
touch build-stamp
|
2010-11-10 14:49:35 +00:00
|
|
|
|
2012-01-15 17:26:17 +00:00
|
|
|
sources: $(sources)
|
|
|
|
|
2011-11-10 07:10:17 +00:00
|
|
|
# Disables optimisation. Not for production use.
|
2012-07-26 01:26:13 +00:00
|
|
|
fast: GHCFLAGS=$(BASEFLAGS) $(FEATURES) $(OPTFLAGS)
|
2011-11-10 07:10:17 +00:00
|
|
|
fast: $(bins)
|
|
|
|
|
2012-03-22 21:09:54 +00:00
|
|
|
Build/SysConfig.hs: configure.hs Build/TestConfig.hs Build/Configure.hs
|
2010-12-11 21:29:50 +00:00
|
|
|
$(GHCMAKE) configure
|
2010-11-18 17:30:42 +00:00
|
|
|
./configure
|
|
|
|
|
2011-03-22 19:39:36 +00:00
|
|
|
%.hs: %.hsc
|
2011-03-15 03:00:23 +00:00
|
|
|
hsc2hs $<
|
|
|
|
|
2012-08-07 17:25:06 +00:00
|
|
|
git-annex: $(sources) $(clibs)
|
2012-08-07 17:12:16 +00:00
|
|
|
install -d $(GIT_ANNEX_TMP_BUILD_DIR)
|
2012-08-07 16:03:42 +00:00
|
|
|
$(GHCMAKE) $@ -o $(GIT_ANNEX_TMP_BUILD_DIR)/git-annex $(clibs)
|
|
|
|
ln -sf $(GIT_ANNEX_TMP_BUILD_DIR)/git-annex git-annex
|
2010-12-30 20:52:24 +00:00
|
|
|
|
2011-01-25 22:54:27 +00:00
|
|
|
git-annex.1: doc/git-annex.mdwn
|
2012-09-01 19:22:13 +00:00
|
|
|
./Build/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
|
2012-09-01 19:22:13 +00:00
|
|
|
./Build/mdwn2man git-annex-shell 1 doc/git-annex-shell.mdwn > git-annex-shell.1
|
add git-union-merge
This is a new git subcommand, that does a generic union merge operation
between two refs, storing the result in a branch. It operates efficiently
without touching the working tree. It does need to write out a temporary
index file, and may need to write out some other temp files as well.
This could be useful for anything that stores data in a branch,
and needs to merge changes into that branch without actually checking the
branch out. Since conflict handling can't be done without a working copy,
the merge type is always a union merge, which is fine for data stored in
log format (as git-annex does), or in non-conflicting files
(as pristine-tar does).
This probably belongs in git proper, but it will live in git-annex for now.
---
Plan is to move .git-annex/ to a git-annex branch, and use git-union-merge
to handle merging changes when pulling from remotes.
Some preliminary benchmarking using real .git-annex/ data indicates
that it's quite fast, except for the "git add" call, which is as slow
as "git add" tends to be with a big index.
2011-06-20 23:44:45 +00:00
|
|
|
git-union-merge.1: doc/git-union-merge.mdwn
|
2012-09-01 19:22:13 +00:00
|
|
|
./Build/mdwn2man git-union-merge 1 doc/git-union-merge.mdwn > git-union-merge.1
|
2010-10-10 04:18:16 +00:00
|
|
|
|
2012-06-03 22:05:59 +00:00
|
|
|
install-mans: $(mans)
|
2010-12-12 17:15:16 +00:00
|
|
|
install -d $(DESTDIR)$(PREFIX)/share/man/man1
|
2010-12-30 20:52:24 +00:00
|
|
|
install -m 0644 $(mans) $(DESTDIR)$(PREFIX)/share/man/man1
|
2012-06-03 22:05:59 +00:00
|
|
|
|
|
|
|
install-docs: docs install-mans
|
2010-12-12 17:15:16 +00:00
|
|
|
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
|
|
|
|
2012-08-20 20:02:41 +00:00
|
|
|
install: build-stamp install-docs
|
2012-06-03 22:05:59 +00:00
|
|
|
install -d $(DESTDIR)$(PREFIX)/bin
|
|
|
|
install $(bins) $(DESTDIR)$(PREFIX)/bin
|
|
|
|
ln -sf git-annex $(DESTDIR)$(PREFIX)/bin/git-annex-shell
|
2012-08-02 01:04:25 +00:00
|
|
|
runghc Build/InstallDesktopFile.hs $(PREFIX)/bin/git-annex || true
|
2012-06-03 22:05:59 +00:00
|
|
|
|
2012-06-11 01:59:16 +00:00
|
|
|
test: $(sources) $(clibs)
|
2012-04-05 20:37:44 +00:00
|
|
|
@if ! $(GHCMAKE) -O0 test $(clibs); then \
|
2012-01-03 18:52:20 +00:00
|
|
|
echo "** failed to build the test suite" >&2; \
|
|
|
|
exit 1; \
|
|
|
|
elif ! ./test; then \
|
|
|
|
echo "** test suite failed!" >&2; \
|
|
|
|
exit 1; \
|
2011-04-25 16:43:22 +00:00
|
|
|
fi
|
2010-12-11 21:37:24 +00:00
|
|
|
|
2011-12-20 20:02:59 +00:00
|
|
|
testcoverage:
|
2011-01-05 01:05:31 +00:00
|
|
|
rm -f test.tix test
|
2012-08-07 16:03:42 +00:00
|
|
|
ghc $(GHCFLAGS) -outputdir $(GIT_ANNEX_TMP_BUILD_DIR)/testcoverage --make -fhpc test
|
2011-01-05 01:05:31 +00:00
|
|
|
./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.)"
|
2011-01-05 01:05:31 +00:00
|
|
|
|
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),)
|
2010-11-02 00:27:30 +00:00
|
|
|
IKIWIKI=@echo "** ikiwiki not found, skipping building docs" >&2; true
|
2010-10-19 18:37:19 +00:00
|
|
|
else
|
|
|
|
IKIWIKI=ikiwiki
|
|
|
|
endif
|
|
|
|
|
2010-12-30 20:52:24 +00:00
|
|
|
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 \
|
2010-12-03 01:37:55 +00:00
|
|
|
--disable-plugin=smiley \
|
2011-03-28 16:09:47 +00:00
|
|
|
--plugin=comments --set comments_pagespec="*" \
|
2010-12-03 01:37:55 +00:00
|
|
|
--exclude='news/.*'
|
2010-10-10 04:18:16 +00:00
|
|
|
|
2010-10-19 19:59:40 +00:00
|
|
|
clean:
|
2012-08-07 16:03:42 +00:00
|
|
|
rm -rf $(GIT_ANNEX_TMP_BUILD_DIR) $(bins) $(mans) test configure *.tix .hpc $(sources) \
|
2012-08-20 20:02:41 +00:00
|
|
|
doc/.ikiwiki html dist $(clibs) build-stamp
|
2010-10-19 19:59:40 +00:00
|
|
|
|
2012-06-11 02:24:15 +00:00
|
|
|
sdist: clean $(mans)
|
2012-09-01 19:22:13 +00:00
|
|
|
./Build/make-sdist.sh
|
2011-07-02 18:53:55 +00:00
|
|
|
|
2012-01-13 19:08:28 +00:00
|
|
|
# Upload to hackage.
|
|
|
|
hackage: sdist
|
|
|
|
@cabal upload dist/*.tar.gz
|
|
|
|
|
2012-09-24 23:40:21 +00:00
|
|
|
OSXAPP_BASE=ui-macos/git-annex.app/Contents/MacOS
|
|
|
|
THIRDPARTY_BINS=git curl lsof xargs rsync uuid wget xargs \
|
|
|
|
sha1sum sha224sum sha256sum sha384sum sha512sum
|
|
|
|
|
|
|
|
osxapp: $(bins)
|
|
|
|
install -d "$(OSXAPP_BASE)/bin"
|
|
|
|
for bin in git-annex $(THIRDPARTY_BINS); do \
|
|
|
|
cp "$$(which "$$bin")" "$(OSXAPP_BASE)/bin/" || echo "$$bin not available; skipping"; \
|
|
|
|
done
|
|
|
|
|
|
|
|
ln -sf git-annex "$(OSXAPP_BASE)/bin/git-annex-shell"
|
|
|
|
install -d "$(OSXAPP_BASE)/git-core"
|
|
|
|
(cd "$(shell git --exec-path)" && tar c .) | (cd "$(OSXAPP_BASE)"/git-core && tar x)
|
|
|
|
|
|
|
|
install -d "$(OSXAPP_BASE)/lib"
|
|
|
|
for lib in $$(otool -L "$(OSXAPP_BASE)"/bin/* "$(OSXAPP_BASE)"/git-core/* | egrep '^ ' | cut -d ' ' -f 1 | sed 's/^ //' | sort | uniq); do \
|
|
|
|
base=$$(basename "$$lib"); \
|
|
|
|
cp "$$lib" "$(OSXAPP_BASE)/lib/$$base"; \
|
|
|
|
done
|
|
|
|
|
2010-12-30 20:52:24 +00:00
|
|
|
.PHONY: $(bins) test install
|