| 1 |
# Copyright © 2019-2026 Dynare Team |
| 2 |
# |
| 3 |
# This file is part of Dynare. |
| 4 |
# |
| 5 |
# Dynare is free software: you can redistribute it and/or modify |
| 6 |
# it under the terms of the GNU General Public License as published by |
| 7 |
# the Free Software Foundation, either version 3 of the License, or |
| 8 |
# (at your option) any later version. |
| 9 |
# |
| 10 |
# Dynare is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with Dynare. If not, see <https://www.gnu.org/licenses/>. |
| 17 |
|
| 18 |
include versions.mk |
| 19 |
|
| 20 |
# settings for different architectures |
| 21 |
PKG_ARCH ?= x86_64 # use x86_64 by default |
| 22 |
|
| 23 |
BREWDIR := $(if $(filter arm64,$(PKG_ARCH)),/opt/homebrew,/usr/local) |
| 24 |
|
| 25 |
ROOT_PATH = $(realpath .) |
| 26 |
|
| 27 |
WGET_OPTIONS := --no-verbose --no-use-server-timestamps --retry-connrefused --retry-on-host-error |
| 28 |
|
| 29 |
NTHREADS=$(shell sysctl -n hw.perflevel0.physicalcpu) |
| 30 |
|
| 31 |
.PHONY: all clean clean-all |
| 32 |
|
| 33 |
all: $(PKG_ARCH)/src/slicot-matlab/build/lib/libslicot64_pic.a $(PKG_ARCH)/src/x13as/x13as $(PKG_ARCH)/panua-pardiso $(PKG_ARCH)/src/suitesparse |
| 34 |
|
| 35 |
# Clean everything except downloaded tarballs |
| 36 |
clean: |
| 37 |
rm -rf $(PKG_ARCH)/src $(PKG_ARCH)/panua-pardiso |
| 38 |
|
| 39 |
# Clean everything (including downloaded tarballs) |
| 40 |
clean-all: clean |
| 41 |
rm -rf tarballs |
| 42 |
|
| 43 |
# |
| 44 |
# Slicot |
| 45 |
# |
| 46 |
|
| 47 |
tarballs/slicot-$(SLICOT_VERSION).tar.gz: |
| 48 |
mkdir -p $(dir $@) |
| 49 |
wget $(WGET_OPTIONS) -O $@ https://github.com/SLICOT/SLICOT-Reference/archive/refs/tags/v$(SLICOT_VERSION).tar.gz |
| 50 |
|
| 51 |
$(PKG_ARCH)/src/slicot-matlab/build/lib/libslicot64_pic.a: tarballs/slicot-$(SLICOT_VERSION).tar.gz |
| 52 |
rm -rf $(realpath $(dir $@)/../..) |
| 53 |
mkdir -p $(dir $@)/../.. |
| 54 |
tar xf $< --directory $(dir $@)/../.. --strip-components=1 |
| 55 |
patch -d $(dir $@)/../.. -p1 < ../../windows/deps/slicot-no-blas-lapack-lookup.patch |
| 56 |
cmake -S $(dir $@)/../.. -B $(dir $@)/.. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DSLICOT_TESTING=OFF -DSLICOT_INTEGER8=ON |
| 57 |
cmake --build $(dir $@)/.. --verbose |
| 58 |
mv $(dir $@)/libslicot64.a $@ |
| 59 |
|
| 60 |
|
| 61 |
# |
| 62 |
# X13AS |
| 63 |
# |
| 64 |
|
| 65 |
tarballs/x13as_asciisrc-v$(X13AS_VERSION).tar.gz: |
| 66 |
mkdir -p $(dir $@) |
| 67 |
wget $(WGET_OPTIONS) -O $@ https://www.dynare.org/pkg-build/x13as/source/$(notdir $@) |
| 68 |
|
| 69 |
$(PKG_ARCH)/src/x13as/x13as: tarballs/x13as_asciisrc-v$(X13AS_VERSION).tar.gz |
| 70 |
rm -rf $(dir $@) |
| 71 |
mkdir -p $(dir $@) |
| 72 |
tar xf $< --directory $(dir $@) --strip-components=1 |
| 73 |
# Statically link x13as (see #1865). |
| 74 |
# Using -static is not possible, it does not work under Darwin. |
| 75 |
cd $(dir $@) && sed -i '' 's/-static//g' makefile.gf |
| 76 |
gmake -C $(dir $@) -f makefile.gf FC=$(BREWDIR)/bin/gfortran LINKER=$(BREWDIR)/bin/gfortran FFLAGS="-O3 -std=legacy" LDFLAGS="-static-libgcc -static-libgfortran -static-libquadmath" PROGRAM=x13as -j$(NTHREADS) |
| 77 |
strip $@ |
| 78 |
|
| 79 |
# |
| 80 |
# Panua PARDISO |
| 81 |
# |
| 82 |
|
| 83 |
$(PKG_ARCH)/panua-pardiso: tarballs/panua-pardiso-$(PANUA_PARDISO_VERSION)-mac_$(if $(filter x86_64,$(PKG_ARCH)),x86,arm64).zip |
| 84 |
rm -rf $@ |
| 85 |
unzip -o $< |
| 86 |
mv $(basename $(notdir $<)) $@ |
| 87 |
touch $@ |
| 88 |
|
| 89 |
# |
| 90 |
# SuiteSparse |
| 91 |
# |
| 92 |
|
| 93 |
tarballs/SuiteSparse-$(SUITESPARSE_VERSION).tar.gz: |
| 94 |
wget $(WGET_OPTIONS) -O $@ https://github.com/DrTimothyAldenDavis/SuiteSparse/archive/refs/tags/v$(SUITESPARSE_VERSION).tar.gz |
| 95 |
|
| 96 |
$(PKG_ARCH)/src/suitesparse: tarballs/SuiteSparse-$(SUITESPARSE_VERSION).tar.gz |
| 97 |
rm -rf $@ |
| 98 |
mkdir -p $@ |
| 99 |
tar xf $< --directory $@ --strip-components=1 |
| 100 |
touch $@ |