commit 87ba73fd23a79ef17db75ba5519acee5b08d6de8
parent 229be95364ab5d6b9766c89b0e5ef0fde1876047
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Thu, 16 Apr 2026 17:08:30 +0200
Replace CMake with a POSIX Makefile
The build procedure is written in POSIX make and can be configured via
the config.mk file. A pkg-config file is also provided to link the
library as an external dependency.
Compared to the CMake alternative, this Makefile adds support for static
libraries and an uninstall target. It also enables compiler and linker
flags for various hardening features, improving the security and
robustness of generated binaries. More broadly, the motivation for this
rewrite is to rely on a well-established standard with a simple feature
set, available on all UNIX systems - reducing portability concerns and
maintenance burden while remaining significantly lighter.
Diffstat:
| M | .gitignore | | | 11 | ++++++----- |
| A | Makefile | | | 289 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| D | cmake/CMakeLists.txt | | | 204 | ------------------------------------------------------------------------------- |
| A | config.mk | | | 91 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | make.sh | | | 78 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | src/ssol_version.h.in | | | 23 | +++++++++++++++++++++++ |
| A | ssol.pc.in | | | 17 | +++++++++++++++++ |
7 files changed, 504 insertions(+), 209 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -1,12 +1,13 @@
.gitignore
-CMakeCache.txt
-CMakeFiles
-Makefile
tmp
[Bb]uild*
*.sw[po]
-*.[ao]
+*.[aodt]
*.orig
+*.so
*~
tags
-
+*.pc
+test_ssol_*
+!test*.[ch]
+src/ssol_version.h
diff --git a/Makefile b/Makefile
@@ -0,0 +1,289 @@
+# Copyright (C) 2016-2018 CNRS, 2018-2026 |Meso|Star>
+#
+# 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/>.
+
+.POSIX:
+.SUFFIXES: # Clean up default inference rules
+
+include config.mk
+
+LIBNAME_STATIC = libssol.a
+LIBNAME_SHARED = libssol.so
+LIBNAME = $(LIBNAME_$(LIB_TYPE))
+
+default: library
+all: default tests
+
+################################################################################
+# Library building
+################################################################################
+SRC =\
+ src/ssol_atmosphere.c\
+ src/ssol_camera.c\
+ src/ssol_data.c\
+ src/ssol_device.c\
+ src/ssol_draw.c\
+ src/ssol_draw_pt.c\
+ src/ssol_draw_draft.c\
+ src/ssol_estimator.c\
+ src/ssol_image.c\
+ src/ssol_material.c\
+ src/ssol_mc_receiver.c\
+ src/ssol_object.c\
+ src/ssol_instance.c\
+ src/ssol_param_buffer.c\
+ src/ssol_ranst_sun_dir.c\
+ src/ssol_ranst_sun_wl.c\
+ src/ssol_scene.c\
+ src/ssol_shape.c\
+ src/ssol_spectrum.c\
+ src/ssol_solver.c\
+ src/ssol_sun.c
+OBJ = $(SRC:.c=.o)
+DEP = $(SRC:.c=.d)
+
+CFLAGS_LIB = $(CFLAGS_SO) $(INCS) -DSSOL_SHARED_BUILD
+LDFLAGS_LIB = $(LDFLAGS_SO) $(LIBS)
+
+$(LIBNAME_SHARED) $(DEB) $(OBJ): config.mk .config
+
+library: .config $(DEP)
+ @$(MAKE) -fMakefile $$(for i in $(DEP); do echo -f $${i}; done) \
+ $$(if [ -n "$(LIBNAME)" ]; then \
+ echo "$(LIBNAME)"; \
+ else \
+ echo "$(LIBNAME_SHARED)"; \
+ fi)
+
+$(LIBNAME_SHARED): $(OBJ)
+ $(CC) $(CFLAGS_LIB) -o $@ $(OBJ) $(LDFLAGS_LIB)
+
+$(LIBNAME_STATIC): libssol.o
+ $(AR) -rc $@ $?
+ $(RANLIB) $@
+
+libssol.o: $(OBJ)
+ $(LD) -r $(OBJ) -o $@
+ $(OBJCOPY) $(OCPFLAGS) $@
+
+.config: config.mk
+ $(PKG_CONFIG) --atleast-version $(RSYS_VERSION) rsys
+ $(PKG_CONFIG) --atleast-version $(S3D_VERSION) s3d
+ $(PKG_CONFIG) --atleast-version $(S3DUT_VERSION) s3dut
+ $(PKG_CONFIG) --atleast-version $(SCPR_VERSION) scpr
+ $(PKG_CONFIG) --atleast-version $(SSF_VERSION) ssf
+ $(PKG_CONFIG) --atleast-version $(SSP_VERSION) star-sp
+ @echo "config done" > $@
+
+.SUFFIXES: .c .d .o
+.c.d:
+ @$(CC) $(CFLAGS_LIB) -MM -MT "$(@:.d=.o) $@" $< -MF $@
+
+.c.o:
+ $(CC) $(CFLAGS_LIB) -c $< -o $@
+
+################################################################################
+# Installation
+################################################################################
+pkg:
+ sed -e 's#@PREFIX@#$(PREFIX)#g'\
+ -e 's#@VERSION@#$(VERSION)#g'\
+ -e 's#@RSYS_VERSION@#$(RSYS_VERSION)#g'\
+ -e 's#@S3D_VERSION@#$(S3D_VERSION)#g'\
+ -e 's#@S3DUT_VERSION@#$(S3DUT_VERSION)#g'\
+ -e 's#@SCPR_VERSION@#$(SCPR_VERSION)#g'\
+ -e 's#@SSF_VERSION@#$(SSF_VERSION)#g'\
+ -e 's#@SSP_VERSION@#$(SSP_VERSION)#g'\
+ ssol.pc.in > ssol.pc
+
+ssol-local.pc: ssol.pc.in config.mk
+ sed -e '1d'\
+ -e 's#^includedir=.*#includedir=./src/#'\
+ -e 's#^libdir=.*#libdir=./#'\
+ -e 's#@RSYS_VERSION@#$(RSYS_VERSION)#g'\
+ -e 's#@S3D_VERSION@#$(S3D_VERSION)#g'\
+ -e 's#@S3DUT_VERSION@#$(S3DUT_VERSION)#g'\
+ -e 's#@SCPR_VERSION@#$(SCPR_VERSION)#g'\
+ -e 's#@SSF_VERSION@#$(SSF_VERSION)#g'\
+ -e 's#@SSP_VERSION@#$(SSP_VERSION)#g'\
+ ssol.pc.in > $@
+
+src/ssol_version.h: src/ssol_version.h.in config.mk
+ sed -e 's#@VERSION_MAJOR@#$(VERSION_MAJOR)#g' \
+ -e 's#@VERSION_MINOR@#$(VERSION_MINOR)#g' \
+ -e 's#@VERSION_PATCH@#$(VERSION_PATCH)#g' \
+ src/ssol_version.h.in > $@
+
+install: library pkg src/ssol_version.h
+ install() { mode="$$1"; prefix="$$2"; shift 2; \
+ mkdir -p "$${prefix}"; \
+ cp "$$@" "$${prefix}"; \
+ chmod "$${mode}" "$${prefix}/$${@##*/}"; \
+ }; \
+ if [ "$(LIB_TYPE)" = "STATIC" ]; then mode=644; else mode=755; fi; \
+ install "$${mode}" "$(DESTDIR)$(LIBPREFIX)" $(LIBNAME); \
+ install 644 "$(DESTDIR)$(LIBPREFIX)/pkgconfig" ssol.pc; \
+ install 644 "$(DESTDIR)$(INCPREFIX)" src/ssol.h; \
+ install 644 "$(DESTDIR)$(INCPREFIX)" src/ssol_version.h; \
+ install 644 "$(DESTDIR)$(PREFIX)/share/doc/stardis-solver" COPYING; \
+ install 644 "$(DESTDIR)$(PREFIX)/share/doc/stardis-solver" README.md
+
+uninstall:
+ rm -f "$(DESTDIR)$(LIBPREFIX)/$(LIBNAME)"
+ rm -f "$(DESTDIR)$(LIBPREFIX)/pkgconfig/ssol.pc"
+ rm -f "$(DESTDIR)$(INCPREFIX)/ssol.h"
+ rm -f "$(DESTDIR)$(INCPREFIX)/ssol_version.h"
+ rm -f "$(DESTDIR)$(PREFIX)/share/doc/stardis-solver/COPYING"
+ rm -f "$(DESTDIR)$(PREFIX)/share/doc/stardis-solver/README.md"
+
+clean: clean_test
+ rm -f $(DEP) $(OBJ) $(LIBNAME)
+ rm -f .config libssol.o ssol.pc ssol-local.pc
+
+################################################################################
+# Tests
+################################################################################
+TEST_SRC =\
+ src/test_ssol_atmosphere.c\
+ src/test_ssol_by_receiver_integration.c\
+ src/test_ssol_camera.c\
+ src/test_ssol_data.c\
+ src/test_ssol_device.c\
+ src/test_ssol_image.c\
+ src/test_ssol_material.c\
+ src/test_ssol_object.c\
+ src/test_ssol_param_buffer.c\
+ src/test_ssol_instance.c\
+ src/test_ssol_scene.c\
+ src/test_ssol_shape.c\
+ src/test_ssol_spectrum.c\
+ src/test_ssol_solver1.c\
+ src/test_ssol_solver2.c\
+ src/test_ssol_solver2b.c\
+ src/test_ssol_solver3.c\
+ src/test_ssol_solver4.c\
+ src/test_ssol_solver5.c\
+ src/test_ssol_solver6.c\
+ src/test_ssol_solver7.c\
+ src/test_ssol_solver8.c\
+ src/test_ssol_solver9.c\
+ src/test_ssol_solver10.c\
+ src/test_ssol_solver11.c\
+ src/test_ssol_solver12.c\
+ src/test_ssol_sun.c\
+ src/test_ssol_draw.c
+TEST_OBJ =\
+ $(TEST_SRC:.c=.o)
+TEST_DEP =\
+ $(TEST_SRC:.c=.d)
+TEST_TGT =\
+ $(TEST_SRC:.c=.t)
+
+# Regular cflags
+PKG_CONFIG_LOCAL = PKG_CONFIG_PATH="./:$${PKG_CONFIG_PATH}" $(PKG_CONFIG)
+INCS_TEST = $$($(PKG_CONFIG_LOCAL) $(PCFLAGS) --cflags rsys ssol-local)
+LIBS_TEST = $$($(PKG_CONFIG_LOCAL) $(PCFLAGS) --libs rsys ssol-local) -lm
+
+$(TEST_DEP) $(TEST_OBJ): config.mk .config_test
+
+tests: library $(TEST_DEP) $(TEST_TGT)
+ @$(MAKE) -fMakefile \
+ $$(for i in $(TEST_DEP); do echo -f"$${i}"; done) \
+ $$(for i in $(TEST_TGT); do echo -f"$${i}"; done) \
+ test_list
+
+$(TEST_TGT):
+ @{ \
+ exe="$$(basename "$@" ".t")"; \
+ printf '%s: %s\n' "$${exe}" $(@:.t=.o); \
+ printf 'test_list: %s\n' "$${exe}"; \
+ } > $@
+
+.config_test: config.mk
+ $(PKG_CONFIG) --atleast-version $(S3DUT_VERSION) s3dut
+ @echo "config done" > $@
+
+clean_test:
+ rm -f $(TEST_DEP) $(TEST_OBJ) $(TEST_TGT)
+ rm -f .config_test
+ rm -f super_shape_2d.obj paths_wos_2d.vtk paths_delta_sphere_2d.vtk
+ rm -f super_shape_3d.obj paths_wos_3d.vtk paths_delta_sphere_3d.vtk
+ rm -f rng_state
+
+test:
+ @err=0; \
+ check() { name="$$1"; prog="$$2"; shift 2; \
+ printf '%s' "$${name}"; \
+ if PATH=./:"$${PATH}" "$${prog}" $$@ > /dev/null 2>&1; then \
+ printf '\n'; \
+ else \
+ printf ': error %s\n' "$$?"; \
+ err=$$((err+1)); \
+ fi; \
+ }; \
+ \
+ for i in $(TEST_SRC); do \
+ test="$$(basename "$${i}" ".c")"; \
+ if [ "$${test}" != "test_ssol_draw" ]; then \
+ check "$${test}" "$${test}"; \
+ else \
+ check test_ssol_draw_draft test_ssol_draw draft; \
+ check test_ssol_draw_pt test_ssol_draw pt; \
+ fi \
+ done; \
+ \
+ [ "$${err}" -eq 0 ]
+
+################################################################################
+# Regular tests
+################################################################################
+CFLAGS_TEST = $(CFLAGS_EXE) $(INCS_TEST)
+LDFLAGS_TEST = $(LDFLAGS_EXE) $(LIBS_TEST)
+
+$(TEST_DEP) : config.mk ssol-local.pc
+ @$(CC) $(CFLAGS_TEST) -MM -MT "$(@:.d=.o) $@" $(@:.d=.c) -MF $@
+
+$(TEST_OBJ) : config.mk ssol-local.pc
+ $(CC) $(CFLAGS_TEST) -c $(@:.o=.c) -o $@
+
+test_ssol_atmosphere \
+test_ssol_by_receiver_integration \
+test_ssol_camera \
+test_ssol_data \
+test_ssol_device \
+test_ssol_image \
+test_ssol_material \
+test_ssol_object \
+test_ssol_param_buffer \
+test_ssol_instance \
+test_ssol_scene \
+test_ssol_shape \
+test_ssol_spectrum \
+test_ssol_solver1 \
+test_ssol_solver2 \
+test_ssol_solver2b \
+test_ssol_solver3 \
+test_ssol_solver4 \
+test_ssol_solver5 \
+test_ssol_solver6 \
+test_ssol_solver7 \
+test_ssol_solver8 \
+test_ssol_solver9 \
+test_ssol_solver10 \
+test_ssol_solver11 \
+test_ssol_solver12 \
+test_ssol_sun \
+test_ssol_draw \
+: config.mk ssol-local.pc $(LIBNAME)
+ $(CC) $(CFLAGS_TEST) -o $@ src/$@.o $(LDFLAGS_TEST)
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
@@ -1,204 +0,0 @@
-# Copyright (C) 2018, 2019, 2021 |Meso|Star> (contact@meso-star.com)
-# Copyright (C) 2016, 2018 CNRS
-#
-# 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/>.
-
-cmake_minimum_required(VERSION 3.1)
-project(solstice-solver C)
-enable_testing()
-
-set(SSOL_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../src)
-option(NO_TEST "Do not build tests" OFF)
-
-################################################################################
-# Check dependencies
-################################################################################
-find_package(RCMake 0.4 REQUIRED)
-find_package(RSys 0.10 REQUIRED)
-find_package(Star3D 0.8 REQUIRED)
-find_package(Star3DUT 0.3.1 REQUIRED)
-find_package(StarCPR 0.1.2 REQUIRED)
-find_package(StarSF 0.6 REQUIRED)
-find_package(StarSP 0.12 REQUIRED)
-find_package(OpenMP 1.2 REQUIRED)
-
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${RCMAKE_SOURCE_DIR})
-include(rcmake)
-include(rcmake_runtime)
-
-include_directories(
- ${RSys_INCLUDE_DIR}
- ${Star3D_INCLUDE_DIR}
- ${Star3DUT_INCLUDE_DIR}
- ${StarCPR_INCLUDE_DIR}
- ${StarSF_INCLUDE_DIR}
- ${StarSP_INCLUDE_DIR})
-
-rcmake_append_runtime_dirs(_runtime_dirs RSys Star3D Star3DUT StarCPR StarSF StarSP)
-
-################################################################################
-# Configure and define targets
-################################################################################
-set(VERSION_MAJOR 0)
-set(VERSION_MINOR 9)
-set(VERSION_PATCH 0)
-set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
-
-set(SSOL_FILES_SRC
- ssol_atmosphere.c
- ssol_camera.c
- ssol_data.c
- ssol_device.c
- ssol_draw.c
- ssol_draw_pt.c
- ssol_draw_draft.c
- ssol_estimator.c
- ssol_image.c
- ssol_material.c
- ssol_mc_receiver.c
- ssol_object.c
- ssol_instance.c
- ssol_param_buffer.c
- ssol_ranst_sun_dir.c
- ssol_ranst_sun_wl.c
- ssol_scene.c
- ssol_shape.c
- ssol_spectrum.c
- ssol_solver.c
- ssol_sun.c)
-
-set(SSOL_FILES_INC_API
- ssol.h)
-
-set(SSOL_FILES_INC
- ssol_atmosphere_c.h
- ssol_c.h
- ssol_camera.h
- ssol_device_c.h
- ssol_draw.h
- ssol_estimator_c.h
- ssol_image_c.h
- ssol_material_c.h
- ssol_object_c.h
- ssol_instance_c.h
- ssol_ranst_sun_dir.h
- ssol_ranst_sun_wl.h
- ssol_scene_c.h
- ssol_shape_c.h
- ssol_spectrum_c.h
- ssol_sun_c.h)
-
-set(SSOL_FILES_DOC COPYING README.md)
-
-# Prepend each file in the `SSOL_FILES_<SRC|INC>' list by `SSOL_SOURCE_DIR'
-rcmake_prepend_path(SSOL_FILES_SRC ${SSOL_SOURCE_DIR})
-rcmake_prepend_path(SSOL_FILES_INC ${SSOL_SOURCE_DIR})
-rcmake_prepend_path(SSOL_FILES_INC_API ${SSOL_SOURCE_DIR})
-rcmake_prepend_path(SSOL_FILES_DOC ${PROJECT_SOURCE_DIR}/../)
-
-add_library(solstice-solver SHARED ${SSOL_FILES_SRC} ${SSOL_FILES_INC} ${SSOL_FILES_INC_API})
-target_link_libraries(solstice-solver RSys Star3D Star3DUT StarCPR StarSF StarSP)
-
-if(CMAKE_COMPILER_IS_GNUCC)
- target_link_libraries(solstice-solver m)
-endif()
-
-set_target_properties(solstice-solver PROPERTIES
- DEFINE_SYMBOL SSOL_SHARED_BUILD
- COMPILE_FLAGS ${OpenMP_C_FLAGS}
- VERSION ${VERSION}
- SOVERSION ${VERSION_MAJOR})
-rcmake_copy_runtime_libraries(solstice-solver)
-
-if(CMAKE_COMPILER_IS_GNUCC)
- set_target_properties(solstice-solver PROPERTIES LINK_FLAGS ${OpenMP_C_FLAGS})
-endif()
-
-rcmake_setup_devel(solstice-solver SolSolver ${VERSION} solstice/ssol_version.h)
-
-################################################################################
-# Add tests
-################################################################################
-if(NOT NO_TEST)
- set(SSOL_TEST_FILES_INC
- test_ssol_circ2D_geometry.h
- test_ssol_geometries.h
- test_ssol_rect_geometry.h
- test_ssol_utils.h
- test_ssol_cube_geometry.h
- test_ssol_materials.h
- test_ssol_rect2D_geometry.h
- )
-
- rcmake_prepend_path(SSOL_TEST_FILES_INC ${SSOL_SOURCE_DIR})
-
- function(build_test _name)
- add_executable(${_name} ${SSOL_SOURCE_DIR}/${_name}.c ${SSOL_TEST_FILES_INC})
- target_link_libraries(${_name}
- solstice-solver RSys Star3D StarSP)
- endfunction()
-
- function(register_test _name)
- add_test(${_name} ${ARGN})
- rcmake_set_test_runtime_dirs(${_name} _runtime_dirs)
- endfunction()
-
- function(new_test _name)
- build_test(${_name})
- register_test(${_name} ${_name})
- endfunction()
-
- new_test(test_ssol_atmosphere)
- new_test(test_ssol_by_receiver_integration)
- new_test(test_ssol_camera)
- new_test(test_ssol_data)
- new_test(test_ssol_device)
- new_test(test_ssol_image)
- new_test(test_ssol_material)
- new_test(test_ssol_object)
- new_test(test_ssol_param_buffer)
- new_test(test_ssol_instance)
- new_test(test_ssol_scene)
- new_test(test_ssol_shape)
- new_test(test_ssol_spectrum)
- new_test(test_ssol_solver1)
- new_test(test_ssol_solver2)
- new_test(test_ssol_solver2b)
- new_test(test_ssol_solver3)
- new_test(test_ssol_solver4)
- new_test(test_ssol_solver5)
- new_test(test_ssol_solver6)
- new_test(test_ssol_solver7)
- new_test(test_ssol_solver8)
- new_test(test_ssol_solver9)
- new_test(test_ssol_solver10)
- new_test(test_ssol_solver11)
- new_test(test_ssol_solver12)
- new_test(test_ssol_sun)
-
- build_test(test_ssol_draw)
- register_test(test_ssol_draw_draft test_ssol_draw draft)
- register_test(test_ssol_draw_pt test_ssol_draw pt)
-endif()
-
-################################################################################
-# Define output & install directories
-################################################################################
-install(TARGETS solstice-solver
- ARCHIVE DESTINATION bin
- LIBRARY DESTINATION lib
- RUNTIME DESTINATION bin)
-install(FILES ${SSOL_FILES_INC_API} DESTINATION include/solstice)
-install(FILES ${SSOL_FILES_DOC} DESTINATION share/doc/solstice-solver)
-
diff --git a/config.mk b/config.mk
@@ -0,0 +1,91 @@
+VERSION_MAJOR = 0
+VERSION_MINOR = 8
+VERSION_PATCH = 0
+VERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)
+
+PREFIX = /usr/local
+LIBPREFIX = $(PREFIX)/lib
+INCPREFIX = $(PREFIX)/include
+
+LIB_TYPE = SHARED
+#LIB_TYPE = STATIC
+
+BUILD_TYPE = RELEASE
+#BUILD_TYPE = DEBUG
+
+################################################################################
+# Tools
+################################################################################
+AR = ar
+CC = cc
+LD = ld
+OBJCOPY = objcopy
+PKG_CONFIG = pkg-config
+RANLIB = ranlib
+
+################################################################################
+# Dependencies
+################################################################################
+PCFLAGS_SHARED =
+PCFLAGS_STATIC = --static
+PCFLAGS = $(PCFLAGS_$(LIB_TYPE))
+
+RSYS_VERSION = 0.15
+S3D_VERSION = 0.10
+S3DUT_VERSION = 0.4
+SCPR_VERSION = 0.5
+SSF_VERSION = 0.10
+SSP_VERSION = 0.15
+
+INCS = $$($(PKG_CONFIG) $(PCFLAGS) --cflags rsys s3d s3dut scpr ssf star-sp)\
+ -fopenmp
+LIBS = $$($(PKG_CONFIG) $(PCFLAGS) --libs rsys s3d s3dut scpr ssf star-sp)\
+ -fopenmp -lm
+
+################################################################################
+# Compilation options
+################################################################################
+WFLAGS =\
+ -Wall\
+ -Wcast-align\
+ -Wconversion\
+ -Wextra\
+ -Wmissing-declarations\
+ -Wmissing-prototypes\
+ -Wshadow
+
+CFLAGS_HARDENED =\
+ -D_FORTIFY_SOURCES=2\
+ -fcf-protection=full\
+ -fstack-clash-protection\
+ -fstack-protector-strong
+
+CFLAGS_COMMON =\
+ -std=c89\
+ -pedantic\
+ -fvisibility=hidden\
+ -fstrict-aliasing\
+ $(CFLAGS_HARDENED)\
+ $(WFLAGS)
+
+CFLAGS_RELEASE = -O2 -DNDEBUG $(CFLAGS_COMMON)
+CFLAGS_DEBUG = -g $(CFLAGS_COMMON)
+CFLAGS = $(CFLAGS_$(BUILD_TYPE))
+
+CFLAGS_SO = $(CFLAGS) -fPIC
+CFLAGS_EXE = $(CFLAGS) -fPIE
+
+################################################################################
+# Linker options
+################################################################################
+LDFLAGS_HARDENED = -Wl,-z,relro,-z,now
+LDFLAGS_DEBUG = $(LDFLAGS_HARDENED)
+LDFLAGS_RELEASE = -s $(LDFLAGS_HARDENED)
+LDFLAGS = $(LDFLAGS_$(BUILD_TYPE))
+
+LDFLAGS_SO = $(LDFLAGS) -shared -Wl,--no-undefined
+LDFLAGS_EXE = $(LDFLAGS) -pie
+
+OCPFLAGS_DEBUG = --localize-hidden
+OCPFLAGS_RELEASE = --localize-hidden --strip-unneeded
+OCPFLAGS = $(OCPFLAGS_$(BUILD_TYPE))
diff --git a/make.sh b/make.sh
@@ -0,0 +1,78 @@
+#!/bin/sh
+
+# Copyright (C) 2016-2018 CNRS, 2018-2026 |Meso|Star>
+#
+# 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/>.
+
+set -e
+
+config_test()
+{
+ for i in "$@"; do
+ test=$(basename "${i}" ".c")
+ test_list="${test_list} ${test}"
+ printf "%s: %s\n" "${test}" "src/${test}.o"
+ done
+ printf "test_bin: %s\n" "${test_list}"
+}
+
+check()
+{
+ name="$1"
+ prog="$2"
+ shift 2
+
+ printf "%s " "${name}"
+ if PATH=./:"${PATH}" "${prog}" "$@" > /dev/null 2>&1; then
+ printf "\033[1;32mOK\033[m\n"
+ else
+ printf "\033[1;31mError\033[m\n"
+ fi 2> /dev/null
+}
+
+run_test()
+{
+ for i in "$@"; do
+ prog="$(basename "${i}" ".c")"
+ check "${prog}" "${prog}"
+ done
+}
+
+clean_test()
+{
+ for i in "$@"; do
+ rm -f "$(basename "${i}" ".c")"
+ done
+}
+
+install()
+{
+ prefix=$1
+ shift 1
+
+ mkdir -p "${prefix}"
+
+ for i in "$@"; do
+ dst="${prefix}/${i##*/}"
+
+ if cmp -s "${i}" "${dst}"; then
+ printf "Up to date %s\n" "${dst}"
+ else
+ printf "Installing %s\n" "${dst}"
+ cp "${i}" "${prefix}"
+ fi
+ done
+}
+
+"$@"
diff --git a/src/ssol_version.h.in b/src/ssol_version.h.in
@@ -0,0 +1,23 @@
+/* Copyright (C) 2016-2018 CNRS, 2018-2026 |Meso|Star>
+ *
+ * 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/>. */
+
+#ifndef SSOL_VERSION_H
+#define SSOL_VERSION_H
+
+#define SSOL_VERSION_MAJOR @VERSION_MAJOR@
+#define SSOL_VERSION_MINOR @VERSION_MINOR@
+#define SSOL_VERSION_PATCH @VERSION_PATCH@
+
+#endif /* SSOL_VERSION_H */
diff --git a/ssol.pc.in b/ssol.pc.in
@@ -0,0 +1,17 @@
+prefix=@PREFIX@
+includedir=${prefix}/include
+libdir=${prefix}/lib
+
+Requires: \
+ rsys >= @RSYS_VERSION@,\
+ s3d >= @S3D_VERSION@,\
+ star-sp >= @SSP_VERSION@
+Requires.private:\
+ scpr >= @SCPR_VERSION@,\
+ ssf >= @SSF_VERSION@
+Name: ssol
+Description: Solstice Solver
+Version: @VERSION@
+Libs: -L${libdir} -lssol
+Libs.private: -fopenmp -lm
+CFlags: -I${includedir}