commit 11eb9ba4227ad56cf677b04c8b9980147078d2d3
parent fc416cc9c3b8a2fef2422b55415e6633d825103d
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Thu, 29 Jun 2023 16:48:41 +0200
Add the Makefile that manages the installation of the sleef library
It provides targets to download, build and install the sleef library.
Clean, distclean and uninstall targets are also implemented. Even if it
is not yet used in any build, this Makefile is therefore compliant with
the star-build framework.
Diffstat:
| A | sleef.mk | | | 67 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 67 insertions(+), 0 deletions(-)
diff --git a/sleef.mk b/sleef.mk
@@ -0,0 +1,67 @@
+# Copyright (C) 2023 |Méso|Star> (contact@meso-star.com)
+#
+# This program 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.
+#
+# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Configuration macros
+SLEEF_TAG = 85440a5e87dae36ca1b891de14bc83b441ae7c43
+SLEEF_URL = https://github.com/shibatch/sleef
+
+# Helper macros
+SLEEF_DIR = sleef/$(SLEEF_TAG)
+SLEEF_CMAKE_OPTIONS =\
+ -G "Unix Makefiles"\
+ -DBUILD_TESTS=OFF\
+ -DCMAKE_BUILD_TYPE=Release\
+ -DCMAKE_INSTALL_LIBDIR=lib
+
+sleef: build_sleef prefix
+ @prefix=$$(cat .prefix) &&\
+ cd -- "$(SLEEF_DIR)/build" &&\
+ cmake -DCMAKE_INSTALL_PREFIX="$${prefix}" .. > /dev/null 2>&1 &&\
+ make install
+
+build_sleef: fetch_sleef
+ @cd -- "$(SLEEF_DIR)/build" &&\
+ cmake $(SLEEF_CMAKE_OPTIONS) .. &&\
+ make
+
+$(SLEEF_DIR):
+ @git clone $(SLEEF_URL) "$@"
+ @mkdir -p "$@/build"
+
+fetch_sleef: $(SLEEF_DIR)
+ @cd -- "$(SLEEF_DIR)" &&\
+ git fetch origin &&\
+ git checkout -B star-build &&\
+ git reset --hard $(SLEEF_TAG)
+
+clean_sleef:
+ if [ -d "$(SLEEF_DIR)/build" ]; then\
+ cd -- "$(SLEEF_DIR)/build" && make clean;\
+ fi
+
+uninstall_sleef: fetch_sleef prefix
+ @prefix=$$(cat .prefix) &&\
+ cd -- "$(SLEEF_DIR)/build" &&\
+ cmake -DCMAKE_INSTALL_PREFIX="$${prefix}" .. > /dev/null 2>&1 &&\
+ make install > /dev/null
+ xargs rm -f < $(SLEEF_DIR)/build/install_manifest.txt
+
+distclean_sleef:
+ rm -rf sleef
+
+clean_all: clean_sleef
+distclean_all: distclean_sleef
+install_all: sleef
+uninstall_all: uninstall_sleef