2012-07-25 21:26:13 -04:00
|
|
|
CFLAGS=-Wall
|
2012-08-07 12:24:12 -04:00
|
|
|
GIT_ANNEX_TMP_BUILD_DIR?=tmp
|
2012-07-25 21:26:13 -04:00
|
|
|
IGNORE=-ignore-package monads-fd -ignore-package monads-tf
|
2012-08-07 12:03:42 -04:00
|
|
|
BASEFLAGS=-threaded -Wall $(IGNORE) -outputdir $(GIT_ANNEX_TMP_BUILD_DIR) -IUtility
|
2012-09-07 14:54:00 -04:00
|
|
|
|
|
|
|
# If you get build failures due to missing haskell libraries,
|
|
|
|
# you can turn off some of these features.
|
2012-09-28 15:57:55 -04:00
|
|
|
#
|
|
|
|
# If you're using an old version of yesod, enable -DWITH_OLD_YESOD
|
|
|
|
FEATURES=$(GIT_ANNEX_LOCAL_FEATURES) -DWITH_ASSISTANT -DWITH_S3 -DWITH_WEBAPP -DWITH_PAIRING
|
2012-07-25 21:26:13 -04:00
|
|
|
|
2012-06-18 12:25:20 -04:00
|
|
|
bins=git-annex
|
|
|
|
mans=git-annex.1 git-annex-shell.1
|
2012-07-19 13:01:41 -04:00
|
|
|
sources=Build/SysConfig.hs Utility/Touch.hs Utility/Mounts.hs
|
2012-06-18 12:25:20 -04:00
|
|
|
all=$(bins) $(mans) docs
|
2012-06-18 09:20:35 +01:00
|
|
|
|
2012-06-18 12:25:20 -04:00
|
|
|
OS:=$(shell uname | sed 's/[-_].*//')
|
2012-06-18 09:20:35 +01:00
|
|
|
ifeq ($(OS),Linux)
|
2012-07-25 21:26:13 -04:00
|
|
|
OPTFLAGS=-DWITH_INOTIFY -DWITH_DBUS
|
2012-07-19 20:38:58 -04:00
|
|
|
clibs=Utility/libdiskfree.o Utility/libmounts.o
|
2012-06-18 12:25:20 -04:00
|
|
|
else
|
2012-07-24 11:01:15 -04:00
|
|
|
# BSD system
|
2012-07-25 21:26:13 -04:00
|
|
|
OPTFLAGS=-DWITH_KQUEUE
|
2012-07-19 20:38:58 -04:00
|
|
|
clibs=Utility/libdiskfree.o Utility/libmounts.o Utility/libkqueue.o
|
2012-07-24 11:01:15 -04:00
|
|
|
ifeq ($(OS),Darwin)
|
2012-07-25 21:26:13 -04:00
|
|
|
OPTFLAGS=-DWITH_KQUEUE -DOSX
|
2012-07-24 11:01:15 -04: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 09:20:35 +01:00
|
|
|
endif
|
|
|
|
|
2010-12-11 17:29:50 -04:00
|
|
|
PREFIX=/usr
|
2012-07-26 13:02:00 -04:00
|
|
|
GHCFLAGS=-O2 $(BASEFLAGS) $(FEATURES) $(OPTFLAGS)
|
2011-11-09 21:36:11 -04:00
|
|
|
|
2011-04-05 14:00:51 -04:00
|
|
|
ifdef PROFILE
|
2012-07-25 21:26:13 -04:00
|
|
|
GHCFLAGS=-prof -auto-all -rtsopts -caf-all -fforce-recomp $(BASEFLAGS) $(FEATURES) $(OPTFLAGS)
|
2011-04-05 14:00:51 -04:00
|
|
|
endif
|
2011-11-09 21:36:11 -04:00
|
|
|
|
2011-01-07 02:15:23 -04:00
|
|
|
GHCMAKE=ghc $(GHCFLAGS) --make
|
2010-10-19 14:39:40 -04:00
|
|
|
|
2011-11-10 03:10:17 -04:00
|
|
|
# Am I typing :make in vim? Do a fast build.
|
2011-11-09 21:36:11 -04:00
|
|
|
ifdef VIM
|
2011-11-10 03:10:17 -04:00
|
|
|
all=fast
|
2011-11-09 21:36:11 -04:00
|
|
|
endif
|
|
|
|
|
2012-08-20 16:02:41 -04:00
|
|
|
build: $(all)
|
|
|
|
touch build-stamp
|
2010-11-10 10:49:35 -04:00
|
|
|
|
2012-01-15 13:26:17 -04:00
|
|
|
sources: $(sources)
|
|
|
|
|
2011-11-10 03:10:17 -04:00
|
|
|
# Disables optimisation. Not for production use.
|
2012-07-25 21:26:13 -04:00
|
|
|
fast: GHCFLAGS=$(BASEFLAGS) $(FEATURES) $(OPTFLAGS)
|
2011-11-10 03:10:17 -04:00
|
|
|
fast: $(bins)
|
|
|
|
|
2012-03-22 17:09:54 -04:00
|
|
|
Build/SysConfig.hs: configure.hs Build/TestConfig.hs Build/Configure.hs
|
2010-12-11 17:29:50 -04:00
|
|
|
$(GHCMAKE) configure
|
2010-11-18 13:30:42 -04:00
|
|
|
./configure
|
|
|
|
|
2011-03-22 15:39:36 -04:00
|
|
|
%.hs: %.hsc
|
2011-03-14 23:00:23 -04:00
|
|
|
hsc2hs $<
|
|
|
|
|
2012-08-07 13:25:06 -04:00
|
|
|
git-annex: $(sources) $(clibs)
|
2012-08-07 13:12:16 -04:00
|
|
|
install -d $(GIT_ANNEX_TMP_BUILD_DIR)
|
2012-08-07 12:03:42 -04: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 16:52:24 -04:00
|
|
|
|
2011-01-25 18:54:27 -04:00
|
|
|
git-annex.1: doc/git-annex.mdwn
|
2012-09-01 15:22:13 -04:00
|
|
|
./Build/mdwn2man git-annex 1 doc/git-annex.mdwn > git-annex.1
|
2011-01-25 18:54:27 -04:00
|
|
|
git-annex-shell.1: doc/git-annex-shell.mdwn
|
2012-09-01 15:22:13 -04: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 19:44:45 -04:00
|
|
|
git-union-merge.1: doc/git-union-merge.mdwn
|
2012-09-01 15:22:13 -04:00
|
|
|
./Build/mdwn2man git-union-merge 1 doc/git-union-merge.mdwn > git-union-merge.1
|
2010-10-10 00:18:16 -04:00
|
|
|
|
2012-06-03 15:05:59 -07:00
|
|
|
install-mans: $(mans)
|
2010-12-12 13:15:16 -04:00
|
|
|
install -d $(DESTDIR)$(PREFIX)/share/man/man1
|
2010-12-30 16:52:24 -04:00
|
|
|
install -m 0644 $(mans) $(DESTDIR)$(PREFIX)/share/man/man1
|
2012-06-03 15:05:59 -07:00
|
|
|
|
|
|
|
install-docs: docs install-mans
|
2010-12-12 13:15:16 -04: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 16:41:24 -04:00
|
|
|
|
2012-08-20 16:02:41 -04:00
|
|
|
install: build-stamp install-docs
|
2012-06-03 15:05:59 -07:00
|
|
|
install -d $(DESTDIR)$(PREFIX)/bin
|
|
|
|
install $(bins) $(DESTDIR)$(PREFIX)/bin
|
|
|
|
ln -sf git-annex $(DESTDIR)$(PREFIX)/bin/git-annex-shell
|
2012-08-01 21:04:25 -04:00
|
|
|
runghc Build/InstallDesktopFile.hs $(PREFIX)/bin/git-annex || true
|
2012-06-03 15:05:59 -07:00
|
|
|
|
2012-06-10 18:59:16 -07:00
|
|
|
test: $(sources) $(clibs)
|
2012-04-05 16:37:44 -04:00
|
|
|
@if ! $(GHCMAKE) -O0 test $(clibs); then \
|
2012-01-03 14:52:20 -04:00
|
|
|
echo "** failed to build the test suite" >&2; \
|
|
|
|
exit 1; \
|
|
|
|
elif ! ./test; then \
|
|
|
|
echo "** test suite failed!" >&2; \
|
|
|
|
exit 1; \
|
2011-04-25 12:43:22 -04:00
|
|
|
fi
|
2010-12-11 17:37:24 -04:00
|
|
|
|
2011-12-20 16:02:59 -04:00
|
|
|
testcoverage:
|
2011-01-04 21:05:31 -04:00
|
|
|
rm -f test.tix test
|
2012-08-07 12:03:42 -04:00
|
|
|
ghc $(GHCFLAGS) -outputdir $(GIT_ANNEX_TMP_BUILD_DIR)/testcoverage --make -fhpc test
|
2011-01-04 21:05:31 -04:00
|
|
|
./test
|
2011-01-06 21:39:26 -04:00
|
|
|
@echo ""
|
2011-01-04 21:07:58 -04:00
|
|
|
@hpc report test --exclude=Main --exclude=QC
|
|
|
|
@hpc markup test --exclude=Main --exclude=QC --destdir=.hpc >/dev/null
|
2011-12-20 16:07:34 -04:00
|
|
|
@echo "(See .hpc/ for test coverage details.)"
|
2011-01-04 21:05:31 -04:00
|
|
|
|
2010-10-19 14:39:40 -04:00
|
|
|
# If ikiwiki is available, build static html docs suitable for being
|
|
|
|
# shipped in the software package.
|
2010-10-19 14:37:19 -04:00
|
|
|
ifeq ($(shell which ikiwiki),)
|
2010-11-01 20:27:30 -04:00
|
|
|
IKIWIKI=@echo "** ikiwiki not found, skipping building docs" >&2; true
|
2010-10-19 14:37:19 -04:00
|
|
|
else
|
|
|
|
IKIWIKI=ikiwiki
|
|
|
|
endif
|
|
|
|
|
2010-12-30 16:52:24 -04:00
|
|
|
docs: $(mans)
|
2010-10-19 14:39:40 -04:00
|
|
|
$(IKIWIKI) doc html -v --wikiname git-annex --plugin=goodstuff \
|
2010-10-19 19:28:29 -04:00
|
|
|
--no-usedirs --disable-plugin=openid --plugin=sidebar \
|
2010-10-22 15:12:48 -04:00
|
|
|
--underlaydir=/dev/null --disable-plugin=shortcut \
|
2010-12-02 21:37:55 -04:00
|
|
|
--disable-plugin=smiley \
|
2011-03-28 12:09:47 -04:00
|
|
|
--plugin=comments --set comments_pagespec="*" \
|
2010-12-02 21:37:55 -04:00
|
|
|
--exclude='news/.*'
|
2010-10-10 00:18:16 -04:00
|
|
|
|
2010-10-19 15:59:40 -04:00
|
|
|
clean:
|
2012-08-07 12:03:42 -04:00
|
|
|
rm -rf $(GIT_ANNEX_TMP_BUILD_DIR) $(bins) $(mans) test configure *.tix .hpc $(sources) \
|
2012-08-20 16:02:41 -04:00
|
|
|
doc/.ikiwiki html dist $(clibs) build-stamp
|
2010-10-19 15:59:40 -04:00
|
|
|
|
2012-06-10 19:24:15 -07:00
|
|
|
sdist: clean $(mans)
|
2012-09-01 15:22:13 -04:00
|
|
|
./Build/make-sdist.sh
|
2011-07-02 14:53:55 -04:00
|
|
|
|
2012-01-13 15:08:28 -04:00
|
|
|
# Upload to hackage.
|
|
|
|
hackage: sdist
|
|
|
|
@cabal upload dist/*.tar.gz
|
|
|
|
|
2012-09-26 16:53:30 -04:00
|
|
|
THIRDPARTY_BINS=git curl lsof xargs rsync uuid wget gpg \
|
2012-09-24 19:40:21 -04:00
|
|
|
sha1sum sha224sum sha256sum sha384sum sha512sum
|
|
|
|
|
2012-09-28 18:21:39 -04:00
|
|
|
LINUXSTANDALONE_DEST=$(GIT_ANNEX_TMP_BUILD_DIR)/git-annex.linux
|
|
|
|
linuxstandalone: $(bins)
|
|
|
|
rm -rf "$(LINUXSTANDALONE_DEST)"
|
|
|
|
|
|
|
|
cp -R standalone/linux "$(LINUXSTANDALONE_DEST)"
|
|
|
|
|
|
|
|
install -d "$(LINUXSTANDALONE_DEST)/bin"
|
|
|
|
cp git-annex "$(LINUXSTANDALONE_DEST)/bin/"
|
|
|
|
strip "$(LINUXSTANDALONE_DEST)/bin/git-annex"
|
|
|
|
ln -sf git-annex "$(LINUXSTANDALONE_DEST)/bin/git-annex-shell"
|
2012-09-28 19:08:13 -04:00
|
|
|
zcat standalone/licences.gz > $(LINUXSTANDALONE_DEST)/LICENSE
|
2012-09-28 18:21:39 -04:00
|
|
|
|
|
|
|
for bin in $(THIRDPARTY_BINS); do \
|
|
|
|
cp "$$(which "$$bin")" "$(LINUXSTANDALONE_DEST)/bin/" || echo "$$bin not available; skipping"; \
|
|
|
|
done
|
|
|
|
|
|
|
|
install -d "$(LINUXSTANDALONE_DEST)/git-core"
|
|
|
|
(cd "$(shell git --exec-path)" && tar c .) | (cd "$(LINUXSTANDALONE_DEST)"/git-core && tar x)
|
|
|
|
|
|
|
|
touch "$(LINUXSTANDALONE_DEST)/libdirs.tmp"
|
|
|
|
for lib in $$(ldd "$(LINUXSTANDALONE_DEST)"/bin/* $$(find "$(LINUXSTANDALONE_DEST)"/git-core/ -type f) | grep -v -f standalone/linux/glibc-libs | grep -v "not a dynamic executable" | egrep '^ ' | sed 's/^\t//' | sed 's/.*=> //' | cut -d ' ' -f 1 | sort | uniq); do \
|
|
|
|
dir=$$(dirname "$$lib"); \
|
|
|
|
install -d "$(LINUXSTANDALONE_DEST)/$$dir"; \
|
|
|
|
echo "$$dir" >> "$(LINUXSTANDALONE_DEST)/libdirs.tmp"; \
|
|
|
|
cp "$$lib" "$(LINUXSTANDALONE_DEST)/$$dir"; \
|
|
|
|
if [ -L "$lib" ]; then \
|
|
|
|
link=$$(readlink -f "$$lib"); \
|
|
|
|
cp "$$link" "$(LINUXSTANDALONE_DEST)/$$(dirname "$$link")"; \
|
|
|
|
fi; \
|
|
|
|
done
|
|
|
|
sort "$(LINUXSTANDALONE_DEST)/libdirs.tmp" | uniq > "$(LINUXSTANDALONE_DEST)/libdirs"
|
|
|
|
rm -f "$(LINUXSTANDALONE_DEST)/libdirs.tmp"
|
|
|
|
|
2012-09-28 18:33:46 -04:00
|
|
|
cd $(GIT_ANNEX_TMP_BUILD_DIR) && tar czf git-annex-standalone-$(shell dpkg --print-architecture).tar.gz git-annex.linux
|
2012-09-28 18:29:36 -04:00
|
|
|
|
2012-09-28 18:21:39 -04:00
|
|
|
OSXAPP_DEST=$(GIT_ANNEX_TMP_BUILD_DIR)/build-dmg/git-annex.app
|
|
|
|
OSXAPP_BASE=$(OSXAPP_DEST)/Contents/MacOS
|
2012-09-24 19:40:21 -04:00
|
|
|
osxapp: $(bins)
|
2012-09-25 10:12:25 -04:00
|
|
|
rm -rf "$(OSXAPP_DEST)"
|
2012-09-27 20:23:40 +01:00
|
|
|
install -d $(GIT_ANNEX_TMP_BUILD_DIR)/build-dmg
|
2012-09-25 10:12:25 -04:00
|
|
|
cp -R ui-macos/git-annex.app "$(OSXAPP_DEST)"
|
|
|
|
|
2012-09-24 19:40:21 -04:00
|
|
|
install -d "$(OSXAPP_BASE)/bin"
|
2012-09-27 11:44:40 -04:00
|
|
|
cp git-annex "$(OSXAPP_BASE)/bin/"
|
|
|
|
strip "$(OSXAPP_BASE)/bin/git-annex"
|
|
|
|
ln -sf git-annex "$(OSXAPP_BASE)/bin/git-annex-shell"
|
2012-09-28 19:08:13 -04:00
|
|
|
gzcat standalone/licences.gz > $(OSXAPP_BASE)/LICENSE
|
2012-09-28 16:24:23 -04:00
|
|
|
cp $(OSXAPP_BASE)/LICENSE $(GIT_ANNEX_TMP_BUILD_DIR)/build-dmg/LICENSE.txt
|
2012-09-27 11:44:40 -04:00
|
|
|
|
|
|
|
for bin in $(THIRDPARTY_BINS); do \
|
2012-09-24 19:40:21 -04:00
|
|
|
cp "$$(which "$$bin")" "$(OSXAPP_BASE)/bin/" || echo "$$bin not available; skipping"; \
|
|
|
|
done
|
|
|
|
|
|
|
|
install -d "$(OSXAPP_BASE)/git-core"
|
|
|
|
(cd "$(shell git --exec-path)" && tar c .) | (cd "$(OSXAPP_BASE)"/git-core && tar x)
|
|
|
|
|
2012-09-25 10:27:21 -04:00
|
|
|
touch "$(OSXAPP_BASE)/libdirs.tmp"
|
2012-09-24 19:40:21 -04:00
|
|
|
for lib in $$(otool -L "$(OSXAPP_BASE)"/bin/* "$(OSXAPP_BASE)"/git-core/* | egrep '^ ' | cut -d ' ' -f 1 | sed 's/^ //' | sort | uniq); do \
|
2012-09-25 10:27:21 -04:00
|
|
|
dir=$$(dirname "$$lib"); \
|
|
|
|
install -d "$(OSXAPP_BASE)/$$dir"; \
|
|
|
|
echo "$$dir" >> "$(OSXAPP_BASE)/libdirs.tmp"; \
|
|
|
|
cp "$$lib" "$(OSXAPP_BASE)/$$dir"; \
|
2012-09-24 19:40:21 -04:00
|
|
|
done
|
2012-09-25 10:27:21 -04:00
|
|
|
sort "$(OSXAPP_BASE)/libdirs.tmp" | uniq > "$(OSXAPP_BASE)/libdirs"
|
|
|
|
rm -f "$(OSXAPP_BASE)/libdirs.tmp"
|
2012-09-28 12:20:18 -04:00
|
|
|
rm -f tmp/git-annex.dmg
|
2012-09-27 20:23:40 +01:00
|
|
|
hdiutil create -size 640m -format UDRW -srcfolder $(GIT_ANNEX_TMP_BUILD_DIR)/build-dmg \
|
|
|
|
-volname git-annex -o tmp/git-annex.dmg
|
2012-09-28 12:20:18 -04:00
|
|
|
rm -f tmp/git-annex.dmg.bz2
|
2012-09-27 20:23:40 +01:00
|
|
|
bzip2 tmp/git-annex.dmg
|
|
|
|
|
2010-12-30 16:52:24 -04:00
|
|
|
.PHONY: $(bins) test install
|