271 lines
9.5 KiB
Makefile
271 lines
9.5 KiB
Makefile
# Copyright © 2019-2022 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 <https://www.gnu.org/licenses/>.
|
|
|
|
include versions.mk
|
|
|
|
GCC_VERSION = 12
|
|
ROOT_PATH = $(realpath .)
|
|
|
|
WGET_OPTIONS := --no-verbose --no-use-server-timestamps --retry-connrefused --retry-on-host-error
|
|
|
|
.PHONY: all clean_all\
|
|
build-x86_64 build-x86_64-slicot build-x86_64-x13as \
|
|
build-arm64 build-arm64-slicot build-arm64-x13as \
|
|
clean-x86_64-lib clean-x86_64-libslicot clean-x86_64-x13as-bin \
|
|
clean-arm64-lib clean-arm64-libslicot clean-arm64-x13as-bin \
|
|
clean-x86_64-src clean-x86_64-slicot-src clean-x86_64-x13as-src \
|
|
clean-arm64-src clean-arm64-slicot-src clean-arm64-x13as-src \
|
|
clean-tar clean-slicot-tar clean-x13as-tar \
|
|
clean-x86_64-all clean-x86_64-lib clean-x86_64-src \
|
|
clean-arm64-all clean-arm64-lib clean-arm64-src \
|
|
ln-x86_64-matio ln-x86_64-gsl \
|
|
ln-arm64-matio ln-arm64-gsl
|
|
|
|
all: build-x86_64 build-arm64
|
|
|
|
clean_all: clean-x86_64-all clean-arm64-all
|
|
|
|
build-x86_64: build-x86_64-slicot build-x86_64-x13as ln-x86_64-matio ln-x86_64-gsl
|
|
|
|
build-arm64: build-arm64-slicot build-arm64-x13as ln-arm64-matio ln-arm64-gsl
|
|
|
|
clean-x86_64-lib: clean-x86_64-libslicot clean-x86_64-x13as-bin
|
|
|
|
clean-arm64-lib: clean-arm64-libslicot clean-arm64-x13as-bin
|
|
|
|
clean-x86_64-src: clean-x86_64-slicot-src clean-x86_64-x13as-src
|
|
|
|
clean-arm64-src: clean-arm64-slicot-src clean-arm64-x13as-src
|
|
|
|
clean-tar: clean-slicot-tar clean-x13as-tar
|
|
|
|
clean-x86_64-all: clean-x86_64-lib clean-x86_64-src clean-tar
|
|
|
|
clean-arm64-all: clean-arm64-lib clean-arm64-src clean-tar
|
|
|
|
#
|
|
# Matio & GSL
|
|
# (done to link only to static Matio and GSL libraries)
|
|
|
|
# Matio
|
|
lib64/x86_64/matio/lib/libmatio.a: /usr/local/lib/libmatio.a
|
|
mkdir -p $(dir $@) && ln -sf $< $@
|
|
|
|
lib64/arm64/matio/lib/libmatio.a: /opt/homebrew/lib/libmatio.a
|
|
mkdir -p $(dir $@) && ln -sf $< $@
|
|
|
|
lib64/x86_64/matio/lib/libhdf5.a: /usr/local/lib/libhdf5.a
|
|
mkdir -p $(dir $@) && ln -sf $< $@
|
|
|
|
lib64/arm64/matio/lib/libhdf5.a: /opt/homebrew/lib/libhdf5.a
|
|
mkdir -p $(dir $@) && ln -sf $< $@
|
|
|
|
lib64/x86_64/matio/lib/libsz.a: /usr/local/lib/libsz.a
|
|
mkdir -p $(dir $@) && ln -sf $< $@
|
|
|
|
lib64/arm64/matio/lib/libsz.a: /opt/homebrew/lib/libsz.a
|
|
mkdir -p $(dir $@) && ln -sf $< $@
|
|
|
|
lib64/x86_64/matio/include/matio.h: /usr/local/include/matio.h
|
|
mkdir -p $(dir $@) && cd $(dir $@).. && rm -rf include && ln -sf $(dir $<) .
|
|
|
|
lib64/arm64/matio/include/matio.h: /opt/homebrew/include/matio.h
|
|
mkdir -p $(dir $@) && cd $(dir $@).. && rm -rf include && ln -sf $(dir $<) .
|
|
|
|
ln-x86_64-matio: lib64/x86_64/matio/lib/libmatio.a \
|
|
lib64/x86_64/matio/lib/libhdf5.a \
|
|
lib64/x86_64/matio/lib/libsz.a \
|
|
lib64/x86_64/matio/include/matio.h
|
|
|
|
ln-arm64-matio: lib64/arm64/matio/lib/libmatio.a \
|
|
lib64/arm64/matio/lib/libhdf5.a \
|
|
lib64/arm64/matio/lib/libsz.a \
|
|
lib64/arm64/matio/include/matio.h
|
|
|
|
clean-x86_64-matio:
|
|
rm -rf lib64/x86_64/matio
|
|
|
|
clean-arm64-matio:
|
|
rm -rf lib64/arm64/matio
|
|
|
|
# GSL
|
|
lib64/x86_64/gsl/lib/libgsl.a: /usr/local/lib/libgsl.a
|
|
mkdir -p $(dir $@) && ln -sf $< $@
|
|
|
|
lib64/arm64/gsl/lib/libgsl.a: /opt/homebrew/lib/libgsl.a
|
|
mkdir -p $(dir $@) && ln -sf $< $@
|
|
|
|
lib64/x86_64/gsl/lib/libgslcblas.a: /usr/local/lib/libgslcblas.a
|
|
mkdir -p $(dir $@) && ln -sf $< $@
|
|
|
|
lib64/arm64/gsl/lib/libgslcblas.a: /opt/homebrew/lib/libgslcblas.a
|
|
mkdir -p $(dir $@) && ln -sf $< $@
|
|
|
|
lib64/x86_64/gsl/include/gsl/gsl_blas.h: /usr/local/include/gsl/gsl_blas.h
|
|
mkdir -p $(dir $@) && cd $(dir $@).. && rm -rf gsl && ln -sf $(dir $<) .
|
|
|
|
lib64/arm64/gsl/include/gsl/gsl_blas.h: /opt/homebrew/include/gsl/gsl_blas.h
|
|
mkdir -p $(dir $@) && cd $(dir $@).. && rm -rf gsl && ln -sf $(dir $<) .
|
|
|
|
ln-x86_64-gsl: lib64/x86_64/gsl/lib/libgsl.a \
|
|
lib64/x86_64/gsl/lib/libgslcblas.a \
|
|
lib64/x86_64/gsl/include/gsl/gsl_blas.h
|
|
|
|
ln-arm64-gsl: lib64/arm64/gsl/lib/libgsl.a \
|
|
lib64/arm64/gsl/lib/libgslcblas.a \
|
|
lib64/arm64/gsl/include/gsl/gsl_blas.h
|
|
|
|
clean-x86_64-gsl:
|
|
rm -rf lib64/x86_64/gsl
|
|
|
|
clean-arm64-gsl:
|
|
rm -rf lib64/arm64/gsl
|
|
|
|
#
|
|
# 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
|
|
|
|
sources64/x86_64/slicot-$(SLICOT_VERSION)-with-32bit-integer-and-underscore: tarballs/slicot-$(SLICOT_VERSION).tar.gz
|
|
rm -rf sources64/x86_64/slicot-*-with-32bit-integer-and-underscore
|
|
mkdir -p $@
|
|
tar xf $< --directory $@ --strip-components=1
|
|
touch $@
|
|
|
|
sources64/arm64/slicot-$(SLICOT_VERSION)-with-32bit-integer-and-underscore: tarballs/slicot-$(SLICOT_VERSION).tar.gz
|
|
rm -rf sources64/arm64/slicot-*-with-32bit-integer-and-underscore
|
|
mkdir -p $@
|
|
tar xf $< --directory $@ --strip-components=1
|
|
touch $@
|
|
|
|
sources64/x86_64/slicot-$(SLICOT_VERSION)-with-64bit-integer-and-underscore: tarballs/slicot-$(SLICOT_VERSION).tar.gz
|
|
rm -rf sources64/x86_64/slicot-*-with-64bit-integer-and-underscore
|
|
mkdir -p $@
|
|
tar xf $< --directory $@ --strip-components=1
|
|
touch $@
|
|
|
|
sources64/arm64/slicot-$(SLICOT_VERSION)-with-64bit-integer-and-underscore: tarballs/slicot-$(SLICOT_VERSION).tar.gz
|
|
rm -rf sources64/arm64/slicot-*-with-64bit-integer-and-underscore
|
|
mkdir -p $@
|
|
tar xf $< --directory $@ --strip-components=1
|
|
touch $@
|
|
|
|
lib64/x86_64/Slicot/with-underscore/lib/libslicot_pic.a: sources64/x86_64/slicot-$(SLICOT_VERSION)-with-32bit-integer-and-underscore
|
|
make -C $< FORTRAN=/usr/local/bin/gfortran LOADER=/usr/local/bin/gfortran SLICOTLIB=../libslicot_pic.a OPTS="-O2 -g" lib
|
|
strip -S $</libslicot_pic.a
|
|
mkdir -p $(dir $@)
|
|
cp $</libslicot_pic.a $@
|
|
|
|
lib64/arm64/Slicot/with-underscore/lib/libslicot_pic.a: sources64/arm64/slicot-$(SLICOT_VERSION)-with-32bit-integer-and-underscore
|
|
make -C $< FORTRAN=/opt/homebrew/bin/gfortran LOADER=/opt/homebrew/bin/gfortran SLICOTLIB=../libslicot_pic.a OPTS="-O2 -g" lib
|
|
strip -S $</libslicot_pic.a
|
|
mkdir -p $(dir $@)
|
|
cp $</libslicot_pic.a $@
|
|
|
|
lib64/x86_64/Slicot/with-underscore/lib/libslicot64_pic.a: sources64/x86_64/slicot-$(SLICOT_VERSION)-with-64bit-integer-and-underscore
|
|
make -C $< FORTRAN=/usr/local/bin/gfortran LOADER=/usr/local/bin/gfortran SLICOTLIB=../libslicot64_pic.a OPTS="-O2 -g -fdefault-integer-8" lib
|
|
strip -S $</libslicot64_pic.a
|
|
mkdir -p $(dir $@)
|
|
cp $</libslicot64_pic.a $@
|
|
|
|
lib64/arm64/Slicot/with-underscore/lib/libslicot64_pic.a: sources64/arm64/slicot-$(SLICOT_VERSION)-with-64bit-integer-and-underscore
|
|
make -C $< FORTRAN=/opt/homebrew/bin/gfortran LOADER=/opt/homebrew/bin/gfortran SLICOTLIB=../libslicot64_pic.a OPTS="-O2 -g -fdefault-integer-8" lib
|
|
strip -S $</libslicot64_pic.a
|
|
mkdir -p $(dir $@)
|
|
cp $</libslicot64_pic.a $@
|
|
|
|
build-x86_64-slicot: lib64/x86_64/Slicot/with-underscore/lib/libslicot_pic.a \
|
|
lib64/x86_64/Slicot/with-underscore/lib/libslicot64_pic.a
|
|
|
|
build-arm64-slicot: lib64/arm64/Slicot/with-underscore/lib/libslicot_pic.a \
|
|
lib64/arm64/Slicot/with-underscore/lib/libslicot64_pic.a
|
|
|
|
clean-slicot-tar:
|
|
rm -f tarballs/slicot-$(SLICOT_VERSION).tar.gz
|
|
|
|
clean-x86_64-slicot-src:
|
|
rm -rf sources64/x86_64/slicot-$(SLICOT_VERSION)-with-64bit-integer-and-underscore
|
|
rm -rf sources64/x86_64/slicot-$(SLICOT_VERSION)-with-32bit-integer-and-underscore
|
|
|
|
clean-arm64-slicot-src:
|
|
rm -rf sources64/arm64/slicot-$(SLICOT_VERSION)-with-64bit-integer-and-underscore
|
|
rm -rf sources64/arm64/slicot-$(SLICOT_VERSION)-with-32bit-integer-and-underscore
|
|
|
|
clean-x86_64-libslicot:
|
|
rm -rf lib64/x86_64/Slicot
|
|
|
|
clean-arm64-libslicot:
|
|
rm -rf lib64/arm64/Slicot
|
|
|
|
clean-slicot-all: clean-x86_64-slicot-src clean-arm64-slicot-src clean-slicot-tar clean-x86_64-libslicot clean-arm64-libslicot
|
|
|
|
|
|
|
|
#
|
|
# X13AS
|
|
#
|
|
tarballs/x13as_asciisrc-v$(X13AS_VERSION).tar.gz:
|
|
mkdir -p tarballs
|
|
wget $(WGET_OPTIONS) -O $@ https://www2.census.gov/software/x-13arima-seats/x13as/unix-linux/program-archives/x13as_asciisrc-v$(X13AS_VERSION).tar.gz
|
|
|
|
sources64/x86_64/x13as-$(X13AS_VERSION): tarballs/x13as_asciisrc-v$(X13AS_VERSION).tar.gz
|
|
rm -rf sources64/x86_64/x13as-*
|
|
mkdir -p $@
|
|
tar xf $< --directory $@
|
|
|
|
sources64/arm64/x13as-$(X13AS_VERSION): tarballs/x13as_asciisrc-v$(X13AS_VERSION).tar.gz
|
|
rm -rf sources64/arm64/x13as-*
|
|
mkdir -p $@
|
|
tar xf $< --directory $@
|
|
|
|
lib64/x86_64/x13as/x13as: sources64/x86_64/x13as-$(X13AS_VERSION)
|
|
cd $< && sed -i '' 's/-static//g' makefile.gf
|
|
arch -x86_64 make -C $< -f makefile.gf FC=/usr/local/bin/gfortran LINKER=/usr/local/bin/gfortran FFLAGS="-O2 -std=legacy" PROGRAM=x13as
|
|
strip $</x13as
|
|
mkdir -p $(dir $@)
|
|
cp $</x13as $@
|
|
|
|
lib64/arm64/x13as/x13as: sources64/arm64/x13as-$(X13AS_VERSION)
|
|
cd $< && sed -i '' 's/-static//g' makefile.gf
|
|
arch -arm64 make -C $< -f makefile.gf FC=/opt/homebrew/bin/gfortran LINKER=/opt/homebrew/bin/gfortran FFLAGS="-O2 -std=legacy" PROGRAM=x13as
|
|
strip $</x13as
|
|
mkdir -p $(dir $@)
|
|
cp $</x13as $@
|
|
|
|
build-x86_64-x13as: lib64/x86_64/x13as/x13as
|
|
|
|
build-arm64-x13as: lib64/arm64/x13as/x13as
|
|
|
|
clean-x13as-tar:
|
|
rm -f tarballs/x13as_asciisrc-v$(X13AS_VERSION).tar.gz
|
|
|
|
clean-x86_64-x13as-src:
|
|
rm -rf sources64/x86_64/x13as-$(X13AS_VERSION)
|
|
|
|
clean-arm64-x13as-src:
|
|
rm -rf sources64/arm64/x13as-$(X13AS_VERSION)
|
|
|
|
clean-x86_64-x13as-bin:
|
|
rm -rf lib64/x86_64/x13as
|
|
|
|
clean-arm64-x13as-bin:
|
|
rm -rf lib64/arm64/x13as
|
|
|
|
clean-x13as-all: clean-x13as-tar clean-x86_64-x13as-src clean-arm64-x13as-src clean-x86_64-x13as-bin clean-arm64-x13as-bin
|