1prefix?=/usr/local 2sbindir=$(prefix)/sbin 3datadir=$(prefix)/share 4mandir=$(datadir)/man 5 6DESTDIR= 7 8INSTALL=install 9INSTALL_FLAGS= 10 11MKDIR=mkdir 12MKDIR_FLAGS=-p 13 14RM=rm 15RM_FLAGS=-f 16 17TARGETOS = `uname` 18 19all: 20 @(cd src; $(MAKE) TARGETOS=$(TARGETOS) all) 21 22install: all 23 $(MKDIR) $(MKDIR_FLAGS) $(DESTDIR)$(sbindir) 24 $(INSTALL) $(INSTALL_FLAGS) bin/iodine $(DESTDIR)$(sbindir)/iodine 25 chmod 755 $(DESTDIR)$(sbindir)/iodine 26 $(INSTALL) $(INSTALL_FLAGS) bin/iodined $(DESTDIR)$(sbindir)/iodined 27 chmod 755 $(DESTDIR)$(sbindir)/iodined 28 $(MKDIR) $(MKDIR_FLAGS) $(DESTDIR)$(mandir)/man8 29 $(INSTALL) $(INSTALL_FLAGS) man/iodine.8 $(DESTDIR)$(mandir)/man8/iodine.8 30 chmod 644 $(DESTDIR)$(mandir)/man8/iodine.8 31 32uninstall: 33 $(RM) $(RM_FLAGS) $(DESTDIR)$(sbindir)/iodine 34 $(RM) $(RM_FLAGS) $(DESTDIR)$(sbindir)/iodined 35 $(RM) $(RM_FLAGS) $(DESTDIR)$(mandir)/man8/iodine.8 36 37test: all 38 @echo "!! The check library is required for compiling and running the tests" 39 @echo "!! Get it at http://check.sf.net" 40 @(cd tests; $(MAKE) TARGETOS=$(TARGETOS) all) 41 42clean: 43 @echo "Cleaning..." 44 @(cd src; $(MAKE) clean) 45 @(cd tests; $(MAKE) clean) 46 @rm -rf bin iodine-latest* 47 48#Helper target for windows/android zipfiles 49iodine-latest: 50 @rm -rf iodine-latest* 51 @mkdir -p iodine-latest 52 @echo "Create date: " > iodine-latest/VERSION.txt 53 @date >> iodine-latest/VERSION.txt 54 @echo "Git version: " >> iodine-latest/VERSION.txt 55 @git rev-parse HEAD >> iodine-latest/VERSION.txt 56 @for i in README CHANGELOG TODO; do cp $$i iodine-latest/$$i.txt; done 57 @unix2dos iodine-latest/* 58 59cross-android: 60 @(cd src; $(MAKE) base64u.c base64u.h) 61 @(cd src; ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk) 62 63iodine-latest-android.zip: iodine-latest 64 @mv iodine-latest iodine-latest-android 65 @mkdir -p iodine-latest-android/armeabi iodine-latest-android/x86 66 @$(MAKE) cross-android TARGET_ARCH_ABI=armeabi 67 @cp src/libs/armeabi/* iodine-latest-android/armeabi 68 @$(MAKE) cross-android TARGET_ARCH_ABI=x86 69 @cp src/libs/x86/* iodine-latest-android/x86 70 @cp README-android.txt iodine-latest-android 71 @zip -r iodine-latest-android.zip iodine-latest-android 72 73cross-mingw32: 74 @(cd src; $(MAKE) TARGETOS=windows32 CC=i686-w64-mingw32-gcc all) 75 76cross-mingw64: 77 @(cd src; $(MAKE) TARGETOS=windows32 CC=x86_64-w64-mingw32-gcc all) 78 79iodine-latest-windows.zip: iodine-latest 80 @mv iodine-latest iodine-latest-windows 81 @mkdir -p iodine-latest-windows/64bit iodine-latest-windows/32bit 82 @(cd src; $(MAKE) TARGETOS=windows32 CC=i686-w64-mingw32-gcc clean all) 83 @i686-w64-mingw32-strip bin/iodine* 84 @for i in `ls bin`; do cp bin/$$i iodine-latest-windows/32bit/$$i.exe; done 85 @cp /usr/i686-w64-mingw32/bin/zlib1.dll iodine-latest-windows/32bit 86 @(cd src; $(MAKE) TARGETOS=windows32 CC=x86_64-w64-mingw32-gcc clean all) 87 @x86_64-w64-mingw32-strip bin/iodine* 88 @for i in `ls bin`; do cp bin/$$i iodine-latest-windows/64bit/$$i.exe; done 89 @cp /usr/x86_64-w64-mingw32/bin/zlib1.dll iodine-latest-windows/64bit 90 @cp README-win32.txt iodine-latest-windows 91 @zip -r iodine-latest-windows.zip iodine-latest-windows 92 93cross-mingw: 94 @(cd src; $(MAKE) TARGETOS=windows32 CC=i686-mingw32-gcc all) 95 96iodine-latest-win32.zip: cross-mingw iodine-latest 97 @mv iodine-latest iodine-latest-win32 98 @mkdir -p iodine-latest-win32/bin 99 @i686-mingw32-strip bin/iodine* 100 @for i in `ls bin`; do cp bin/$$i iodine-latest-win32/bin/$$i.exe; done 101 @cp /usr/i686-mingw32/usr/bin/zlib1.dll iodine-latest-win32/bin 102 @cp README-win32.txt iodine-latest-win32 103 @zip -r iodine-latest-win32.zip iodine-latest-win32 104 105