1# Copyright (C) 2013-2015 Yubico AB 2# 3# This program is free software; you can redistribute it and/or modify it 4# under the terms of the GNU Lesser General Public License as published by 5# the Free Software Foundation; either version 2.1, or (at your option) 6# any later version. 7# 8# This program is distributed in the hope that it will be useful, but 9# WITHOUT ANY WARRANTY; without even the implied warranty of 10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 11# General Public License for more details. 12# 13# You should have received a copy of the GNU Lesser General Public License 14# along with this program; if not, see <http://www.gnu.org/licenses/>. 15 16LIBJSONVERSION=0.13.1 17HIDAPIHASH=0cbc3a409bcb45cefb3edbf144d64ddd4e0821ce 18PACKAGE=libu2f-host 19 20all: usage 32bit 64bit 21 22.PHONY: usage 23usage: 24 @if test -z "$(VERSION)"; then \ 25 echo "Try this instead:"; \ 26 echo " make VERSION=[VERSION]"; \ 27 echo "For example:"; \ 28 echo " make VERSION=1.6.0"; \ 29 exit 1; \ 30 fi 31 32doit: 33 rm -rf tmp$(ARCH) && mkdir tmp$(ARCH) && cd tmp$(ARCH) && \ 34 mkdir -p root/licenses && \ 35 cp ../json-c-$(LIBJSONVERSION).tar.gz . || \ 36 wget --no-check-certificate https://s3.amazonaws.com/json-c_releases/releases/json-c-$(LIBJSONVERSION).tar.gz && \ 37 tar xfa json-c-$(LIBJSONVERSION).tar.gz && \ 38 cd json-c-$(LIBJSONVERSION) && \ 39 ac_cv_func_realloc_0_nonnull=yes ac_cv_func_malloc_0_nonnull=yes ./configure --host=$(HOST) --build=x86_64-unknown-linux-gnu --prefix=$(PWD)/tmp$(ARCH)/root && \ 40 make install && \ 41 cp COPYING $(PWD)/tmp$(ARCH)/root/licenses/json-c.txt && \ 42 cd .. && \ 43 git clone https://github.com/signal11/hidapi.git && \ 44 cd hidapi && \ 45 git checkout $(HIDAPIHASH) && \ 46 ./bootstrap && \ 47 ./configure --host=$(HOST) --build=x86_64-unknown-linux-gnu --prefix=$(PWD)/tmp$(ARCH)/root && \ 48 make install $(CHECK) && \ 49 cp LICENSE-gpl3.txt $(PWD)/tmp$(ARCH)/root/licenses/hidapi.txt && \ 50 cd .. && \ 51 cp ../$(PACKAGE)-$(VERSION).tar.xz . && \ 52 tar xfa $(PACKAGE)-$(VERSION).tar.xz && \ 53 cd $(PACKAGE)-$(VERSION)/ && \ 54 CC="$(HOST)-gcc -static-libgcc -lbcrypt" PKG_CONFIG_PATH=$(PWD)/tmp$(ARCH)/root/lib/pkgconfig lt_cv_deplibs_check_method=pass_all ./configure --host=$(HOST) --build=x86_64-unknown-linux-gnu --prefix=$(PWD)/tmp$(ARCH)/root LDFLAGS=-L$(PWD)/tmp$(ARCH)/root/lib CPPFLAGS="-I$(PWD)/tmp$(ARCH)/root/include" && \ 55 make install $(CHECK) && \ 56 cp COPYING $(PWD)/tmp$(ARCH)/root/licenses/$(PACKAGE).txt && \ 57 cd .. && \ 58 cd root && \ 59 zip -r ../../$(PACKAGE)-$(VERSION)-win$(ARCH).zip * 60 6132bit: 62 $(MAKE) -f windows.mk doit ARCH=32 HOST=i686-w64-mingw32 63 6464bit: 65 $(MAKE) -f windows.mk doit ARCH=64 HOST=x86_64-w64-mingw32 66