# Copyright © 2017-2019 Dynare Team # # This file is part of Dynare. # # Dynare is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Dynare is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Dynare. If not, see . include versions.mk ROOT_PATH = $(realpath .) WGET_OPTIONS := --no-verbose --no-use-server-timestamps --retry-connrefused --retry-on-host-error .PHONY: clean-openblas-src clean-openblas-tar clean-openblas-all clean-libopenblas \ clean-boost-src clean-boost-tar clean-boost-all clean-libboost \ clean-gsl-src clean-gsl-tar clean-gsl-all clean-libgsl\ clean-slicot-src clean-slicot-tar clean-slicot-all clean-libslicot \ clean-matio-src clean-matio-tar clean-matio-all clean-libmatio\ clean-zlib-src clean-zlib-tar clean-zlib-src clean-libzlib \ clean-x13as-tar clean-x13as-src clean-x13as-bin clean-x13as-all \ clean-src clean-all clean-lib clean-tar \ build build-openblas build-slicot build-matio build-boost build-gsl \ octave matlab mingw all: build octave matlab mingw build: build-openblas build-slicot build-matio build-boost build-gsl build-x13as clean-lib: clean-libopenblas clean-libgsl clean-libzlib clean-libmatio clean-libslicot clean-libboost clean-matlab clean-octave clean-mingw clean-x13as-bin clean-src: clean-openblas-src clean-boost-src clean-gsl-src clean-matio-src clean-slicot-src clean-zlib-src clean-x13as-src clean-tar: clean-openblas-tar clean-boost-tar clean-gsl-tar clean-matio-tar clean-slicot-tar clean-zlib-tar clean-x13as-tar clean-all: clean-lib clean-src clean-tar # # OpenBLAS library # tarballs/openblas-${OPENBLAS_VERSION}.tar.gz: mkdir -p tarballs wget $(WGET_OPTIONS) -O $@ https://github.com/xianyi/OpenBLAS/archive/v${OPENBLAS_VERSION}.tar.gz sources32/OpenBLAS-${OPENBLAS_VERSION}: tarballs/openblas-${OPENBLAS_VERSION}.tar.gz mkdir -p sources32 rm -rf sources32/OpenBLAS-* tar xf $< --directory sources32 patch $@/Makefile.rule < patches/openblas-w32.patch sources64/OpenBLAS-${OPENBLAS_VERSION}: tarballs/openblas-${OPENBLAS_VERSION}.tar.gz mkdir -p sources64 rm -rf sources64/OpenBLAS-* tar xf $< --directory sources64 patch $@/Makefile.rule < patches/openblas-w64.patch lib32/OpenBLAS/libopenblas.a: sources32/OpenBLAS-${OPENBLAS_VERSION} make -C $< i686-w64-mingw32-strip --strip-debug $ $@/user-config.jam sources64/boost_${BOOST_VERSION}: tarballs/boost_${BOOST_VERSION}.tar.bz2 mkdir -p sources64 rm -rf sources64/boost_* tar xf $< --directory sources64 echo "using gcc : mingw : x86_64-w64-mingw32-g++ ;" > $@/user-config.jam lib32/Boost: sources32/boost_${BOOST_VERSION} rm -rf lib32/Boost cd $< && ./bootstrap.sh --with-libraries=system,filesystem --prefix=${ROOT_PATH}/lib32/Boost && ./b2 -a -q --user-config=user-config.jam toolset=gcc-mingw target-os=windows address-model=32 variant=release install lib64/Boost: sources64/boost_${BOOST_VERSION} rm -rf lib64/Boost cd $< && ./bootstrap.sh --with-libraries=system,filesystem --prefix=${ROOT_PATH}/lib64/Boost && ./b2 -a -q --user-config=user-config.jam toolset=gcc-mingw target-os=windows address-model=64 variant=release install build-boost: lib32/Boost lib64/Boost clean-boost-tar: rm -f tarballs/boost_${BOOST_VERSION}.tar.bz2 clean-boost-src: rm -rf sources32/boost_${BOOST_VERSION} rm -rf sources64/boost_${BOOST_VERSION} clean-libboost: rm -rf lib32/Boost rm -rf lib64/Boost clean-boost-all: clean-boost-src clean-boost-tar clean-libboost # # Gsl # tarballs/gsl-${GSL_VERSION}.tar.gz: mkdir -p tarballs wget $(WGET_OPTIONS) -O $@ https://ftp.gnu.org/gnu/gsl/$(notdir $@) sources32/gsl-${GSL_VERSION}: tarballs/gsl-${GSL_VERSION}.tar.gz mkdir -p sources32 rm -rf sources32/gsl-* tar xf $< --directory sources32 sources64/gsl-${GSL_VERSION}: tarballs/gsl-${GSL_VERSION}.tar.gz mkdir -p sources64 rm -rf sources64/gsl-* tar xf $< --directory sources64 lib32/Gsl/lib/libgsl.a: sources32/gsl-${GSL_VERSION} rm -rf lib32/Gsl cd $< && ./configure --host=i686-w64-mingw32 --prefix=${ROOT_PATH}/lib32/Gsl --disable-shared --enable-static && make && make install lib64/Gsl/lib/libgsl.a: sources64/gsl-${GSL_VERSION} rm -rf lib64/Gsl cd $< && ./configure --host=x86_64-w64-mingw32 --prefix=${ROOT_PATH}/lib64/Gsl --disable-shared --enable-static && make && make install build-gsl: lib32/Gsl/lib/libgsl.a lib64/Gsl/lib/libgsl.a clean-gsl-tar: rm -f tarballs/gsl-${GSL_VERSION}.tar.gz clean-gsl-src: rm -rf sources32/gsl-${GSL_VERSION} rm -rf sources64/gsl-${GSL_VERSION} clean-libgsl: rm -rf lib32/Gsl rm -rf lib64/Gsl clean-gsl-all: clean-gsl-src clean-gsl-tar clean-libgsl # # matIO # tarballs/matio-${MATIO_VERSION}.tar.gz: mkdir -p tarballs wget $(WGET_OPTIONS) -O $@ https://sourceforge.net/projects/matio/files/matio/${MATIO_VERSION}/$(notdir $@)/download sources32/matio-${MATIO_VERSION}: tarballs/matio-${MATIO_VERSION}.tar.gz mkdir -p sources32 rm -rf sources32/matio-* tar xf $< --directory sources32 touch $@ sources64/matio-${MATIO_VERSION}: tarballs/matio-${MATIO_VERSION}.tar.gz mkdir -p sources64 rm -rf sources64/matio-* tar xf $< --directory sources64 touch $@ # The "ac_cv_va_copy=C99" argument is a workaround for https://github.com/tbeu/matio/issues/78 lib32/matIO/lib/libmatio.a: sources32/matio-${MATIO_VERSION} lib32/Zlib/lib/libz.a rm -rf lib32/matIO cd $< && ./configure --host=i686-w64-mingw32 --disable-shared --with-zlib=${ROOT_PATH}/lib32/Zlib --prefix=${ROOT_PATH}/lib32/matIO ac_cv_va_copy=C99 && make install ln -sf ${ROOT_PATH}/lib32/Zlib/include/zconf.h ${ROOT_PATH}/lib32/matIO/include/zconf.h ln -sf ${ROOT_PATH}/lib32/Zlib/include/zlib.h ${ROOT_PATH}/lib32/matIO/include/zlib.h ln -sf ${ROOT_PATH}/lib32/Zlib/lib/libz.a ${ROOT_PATH}/lib32/matIO/lib/libz.a lib64/matIO/lib/libmatio.a: sources64/matio-${MATIO_VERSION} lib64/Zlib/lib/libz.a rm -rf lib64/matIO cd $< && ./configure --host=x86_64-w64-mingw32 --disable-shared --with-zlib=${ROOT_PATH}/lib64/Zlib --prefix=${ROOT_PATH}/lib64/matIO ac_cv_va_copy=C99 && make install ln -sf ${ROOT_PATH}/lib64/Zlib/include/zconf.h ${ROOT_PATH}/lib64/matIO/include/zconf.h ln -sf ${ROOT_PATH}/lib64/Zlib/include/zlib.h ${ROOT_PATH}/lib64/matIO/include/zlib.h ln -sf ${ROOT_PATH}/lib64/Zlib/lib/libz.a ${ROOT_PATH}/lib64/matIO/lib/libz.a build-matio: build-zlib lib32/matIO/lib/libmatio.a lib64/matIO/lib/libmatio.a clean-matio-tar: rm -f tarballs/matio-${MATIO_VERSION}.tar.gz clean-matio-src: rm -rf sources32/matio-${MATIO_VERSION} rm -rf sources64/matio-${MATIO_VERSION} clean-libmatio: rm -rf lib32/matIO rm -rf lib64/matIO clean-matio-all: clean-matio-src clean-matio-tar clean-libmatio # # Slicot # tarballs/slicot-$(SLICOT_VERSION).tar.gz: mkdir -p tarballs wget $(WGET_OPTIONS) -O $@ https://deb.debian.org/debian/pool/main/s/slicot/slicot_$(SLICOT_VERSION).orig.tar.gz sources32/slicot-$(SLICOT_VERSION)-without-underscore: tarballs/slicot-$(SLICOT_VERSION).tar.gz rm -rf sources32/slicot-*-without-underscore mkdir -p $@ tar xf $< --directory $@ --strip-components=1 patch $@/make.inc < patches/slicot-32-without-underscore.patch sources32/slicot-$(SLICOT_VERSION)-with-underscore: tarballs/slicot-$(SLICOT_VERSION).tar.gz rm -rf sources32/slicot-*-with-underscore mkdir -p $@ tar xf $< --directory $@ --strip-components=1 patch $@/make.inc < patches/slicot-32-with-underscore.patch sources64/slicot-$(SLICOT_VERSION)-with-32bit-integer: tarballs/slicot-$(SLICOT_VERSION).tar.gz rm -rf sources64/slicot-*-with-32bit-integer mkdir -p $@ tar xf $< --directory $@ --strip-components=1 patch $@/make.inc < patches/slicot-64-with-32bit-integer.patch sources64/slicot-$(SLICOT_VERSION)-with-64bit-integer: tarballs/slicot-$(SLICOT_VERSION).tar.gz rm -rf sources64/slicot-*-with-64bit-integer mkdir -p $@ tar xf $< --directory $@ --strip-components=1 patch $@/make.inc < patches/slicot-64-with-64bit-integer.patch sources64/slicot-$(SLICOT_VERSION)-with-32bit-integer-and-underscore: tarballs/slicot-$(SLICOT_VERSION).tar.gz rm -rf sources64/slicot-*-with-32bit-integer-and-underscore mkdir -p $@ tar xf $< --directory $@ --strip-components=1 patch $@/make.inc < patches/slicot-64-with-32bit-integer-and-underscore.patch sources64/slicot-$(SLICOT_VERSION)-with-64bit-integer-and-underscore: tarballs/slicot-$(SLICOT_VERSION).tar.gz rm -rf sources64/slicot-*-with-64bit-integer-and-underscore mkdir -p $@ tar xf $< --directory $@ --strip-components=1 patch $@/make.inc < patches/slicot-64-with-64bit-integer-and-underscore.patch lib32/Slicot/without-underscore/lib/libslicot_pic.a: sources32/slicot-$(SLICOT_VERSION)-without-underscore make -C $< lib i686-w64-mingw32-strip --strip-debug $ /dev/null mv octave-${OCTAVE_VERSION}-w32 $@ # Clean up MinGW stuff that interferes with our cross-compiler cd $@/mingw32/lib && rm -f libadvapi32.a libkernel32.a libmingw32.a libmingwex.a libmoldname.a libmsvcrt.a libpthread.dll.a libshell32.a libuser32.a cd $@/mingw32/include && rm -f $$(grep -l "This file is part of the mingw-w64 runtime package" *.h) touch $@ octave64: tarballs/octave-${OCTAVE_VERSION}-w64${OCTAVE_W64_BUILD}.7z rm -rf $@ 7zr x $< > /dev/null mv octave-${OCTAVE_VERSION}-w64 $@ # Clean up MinGW stuff that interferes with our cross-compiler cd $@/mingw64/lib && rm -f libadvapi32.a libkernel32.a libmingw32.a libmingwex.a libmoldname.a libmsvcrt.a libpthread.dll.a libshell32.a libuser32.a cd $@/mingw64/include && rm -f $$(grep -l "This file is part of the mingw-w64 runtime package" *.h) touch $@ octave: octave32 octave64 clean-octave: rm -rf octave32 rm -rf octave64 rm -f tarballs/octave-${OCTAVE_VERSION}-w64${OCTAVE_W64_BUILD}.7z rm -f tarballs/octave-${OCTAVE_VERSION}-w32${OCTAVE_W32_BUILD}.7z # # MATLAB # tarballs/matlab%.tar.xz: mkdir -p tarballs wget $(WGET_OPTIONS) -O $@.gpg https://www.dynare.org/windows-pkg-build/$(notdir $@).gpg gpg --output $@ --decrypt $@.gpg rm $@.gpg matlab32: tarballs/matlab32-$(MATLAB32_VERSION).tar.xz rm -rf $@ mkdir -p $@ tar xf $< --directory $@ --strip-components=1 touch $@ matlab64: tarballs/matlab64-$(MATLAB64_VERSION).tar.xz rm -rf $@ mkdir -p $@ tar xf $< --directory $@ --strip-components=1 touch $@ matlab: matlab32 matlab64 clean-matlab: rm -f tarballs/matlab32.tar.xz rm -f tarballs/matlab64.tar.xz rm -rf matlab32 rm -rf matlab64 # # Embedded MinGW (for use_dll) # mingw: mingw32 mingw64 mingw32: tarballs/mingw-w64-i686-gcc-$(MINGW32_GCC_VERSION)-any.pkg.tar.xz tarballs/mingw-w64-i686-gmp-$(MINGW32_GMP_VERSION)-any.pkg.tar.xz tarballs/mingw-w64-i686-binutils-$(MINGW32_BINUTILS_VERSION)-any.pkg.tar.xz tarballs/mingw-w64-i686-headers-git-$(MINGW32_HEADERS_VERSION)-any.pkg.tar.xz tarballs/mingw-w64-i686-crt-git-$(MINGW32_CRT_VERSION)-any.pkg.tar.xz tarballs/mingw-w64-i686-winpthreads-git-$(MINGW32_WINPTHREADS_VERSION)-any.pkg.tar.xz tarballs/mingw-w64-i686-libwinpthread-git-$(MINGW32_LIBWINPTHREAD_VERSION)-any.pkg.tar.xz rm -rf $@ for f in $^; do tar xf $$f; done touch $@ mingw64: tarballs/mingw-w64-x86_64-gcc-$(MINGW64_GCC_VERSION)-any.pkg.tar.xz tarballs/mingw-w64-x86_64-gmp-$(MINGW64_GMP_VERSION)-any.pkg.tar.xz tarballs/mingw-w64-x86_64-binutils-$(MINGW64_BINUTILS_VERSION)-any.pkg.tar.xz tarballs/mingw-w64-x86_64-headers-git-$(MINGW64_HEADERS_VERSION)-any.pkg.tar.xz tarballs/mingw-w64-x86_64-crt-git-$(MINGW64_CRT_VERSION)-any.pkg.tar.xz tarballs/mingw-w64-x86_64-winpthreads-git-$(MINGW64_WINPTHREADS_VERSION)-any.pkg.tar.xz tarballs/mingw-w64-x86_64-libwinpthread-git-$(MINGW64_LIBWINPTHREAD_VERSION)-any.pkg.tar.xz rm -rf $@ for f in $^; do tar xf $$f; done touch $@ tarballs/mingw-w64-i686-%-any.pkg.tar.xz: wget $(WGET_OPTIONS) -O $@ http://repo.msys2.org/mingw/i686/$(notdir $@) tarballs/mingw-w64-x86_64-%-any.pkg.tar.xz: wget $(WGET_OPTIONS) -O $@ http://repo.msys2.org/mingw/x86_64/$(notdir $@) clean-mingw: rm -rf mingw32 rm -rf mingw64 rm -f tarballs/mingw-w64-i686-*.tar.xz rm -f tarballs/mingw-w64-x86_64-*.tar.xz # # X13AS # tarballs/x13assrc_V$(X13AS_VERSION).tar.gz: mkdir -p tarballs wget $(WGET_OPTIONS) -O $@ https://www.census.gov/ts/x13as/unix/x13assrc_V$(X13AS_VERSION).tar.gz sources32/x13as-$(X13AS_VERSION): tarballs/x13assrc_V$(X13AS_VERSION).tar.gz rm -rf sources32/x13as-* mkdir -p $@ tar xf $< --directory $@ sources64/x13as-$(X13AS_VERSION): tarballs/x13assrc_V$(X13AS_VERSION).tar.gz rm -rf sources64/x13as-* mkdir -p $@ tar xf $< --directory $@ lib32/x13as/x13as.exe: sources32/x13as-$(X13AS_VERSION) make -C $< -f makefile.gf FC=i686-w64-mingw32-gfortran LINKER=i686-w64-mingw32-gfortran FFLAGS="-O2" PROGRAM=x13as.exe i686-w64-mingw32-strip $