summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-02-10 15:48:38 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-02-10 15:48:38 -0400
commit4e14ef3660924e7c005c42d4d58716ee0beb2d31 (patch)
tree4691e44203ded56f77bf2c4abf5de9a6acdac462 /Makefile
parent516d4899d3ea7e12ee9b408160b36190b8c2d3f2 (diff)
can now build Android targeted binary
Various things that don't work on Android are just ifdefed out. * the webapp (needs template haskell for arm) * --include and --exclude globbing (needs libpcre, which is not ported; probably I'll make it use the pure haskell glob library instead) * annex.diskreserve checking (missing sys/statvfs.h) * timestamp preservation support (yawn) * S3 * WebDAV * XMPP The resulting 17mb binary has been tested on Android, and it is able to, at least, print its usage message.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile25
1 files changed, 23 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 83fa33d47..841f52150 100644
--- a/Makefile
+++ b/Makefile
@@ -14,6 +14,12 @@ sources=Build/SysConfig.hs Utility/Touch.hs Utility/Mounts.hs
all=$(bins) $(mans) docs
OS:=$(shell uname | sed 's/[-_].*//')
+ifeq ($(ANDROID),1)
+OPTFLAGS?=-DWITH_INOTIFY -DWITH_ANDROID
+clibs=Utility/libdiskfree.o Utility/libmounts.o
+CFLAGS:=-Wall -DWITH_ANDROID
+THREADFLAGS=-threaded
+else
ifeq ($(OS),Linux)
OPTFLAGS?=-DWITH_INOTIFY -DWITH_DBUS
clibs=Utility/libdiskfree.o Utility/libmounts.o
@@ -41,6 +47,7 @@ clibs=Utility/libdiskfree.o Utility/libmounts.o Utility/libkqueue.o
endif
endif
endif
+endif
ALLFLAGS = $(BASEFLAGS) $(FEATURES) $(OPTFLAGS) $(THREADFLAGS)
@@ -51,7 +58,8 @@ ifdef PROFILE
GHCFLAGS=-prof -auto-all -rtsopts -caf-all -fforce-recomp $(ALLFLAGS)
endif
-GHCMAKE=ghc $(GHCFLAGS) --make
+GHC?=ghc
+GHCMAKE=$(GHC) $(GHCFLAGS) --make
# Am I typing :make in vim? Do a fast build.
ifdef VIM
@@ -113,7 +121,7 @@ test: $(sources) $(clibs)
testcoverage:
rm -f test.tix test
- ghc $(GHCFLAGS) -outputdir $(GIT_ANNEX_TMP_BUILD_DIR)/testcoverage --make -fhpc test
+ $(GHC) $(GHCFLAGS) -outputdir $(GIT_ANNEX_TMP_BUILD_DIR)/testcoverage --make -fhpc test
./test
@echo ""
@hpc report test --exclude=Main --exclude=QC
@@ -216,6 +224,19 @@ osxapp:
rm -f tmp/git-annex.dmg.bz2
bzip2 --fast tmp/git-annex.dmg
+# Cross compile for Android binary.
+# Uses https://github.com/neurocyte/ghc-android
+#
+# configure is run, probing the local system.
+# So the Android should have all the same stuff that configure probes for,
+# including the same version of git.
+android:
+ $(MAKE) Build/SysConfig.hs
+ GHC=$$HOME/.ghc-android-14-arm-linux-androideabi-4.7/bin/arm-unknown-linux-androideabi-ghc \
+ CC=$$HOME/.ghc-android-14-arm-linux-androideabi-4.7/bin/arm-linux-androideabi-gcc \
+ FEATURES="-DWITH_ANDROID -DWITH_ASSISTANT -DWITH_DNS" \
+ ANDROID=1 $(MAKE) fast
+
# used by ./ghci
getflags:
@echo $(ALLFLAGS) $(clibs)