solstice-pp

Post-processing utilities for the solstice app
git clone git://git.meso-star.com/solstice-pp.git
Log | Files | Refs | README | LICENSE

commit 186cd7da3b8cbdbb76d2e39bbbdd5f791f935b5e
parent 21b13fc030bcbdc3907412d36590d3f91d514a6e
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Fri, 20 Jun 2025 13:22:32 +0200

Make the build system POSIX-compatible

This improves portability.

Make the build system less opaque by not hiding executed commands.
Displaying them in the terminal makes it easy to follow the proposed
workflow.

Diffstat:
MMakefile | 36+++++++++++++++---------------------
DMakefile.in | 18------------------
Aconfig.mk | 19+++++++++++++++++++
Mcyl/Makefile | 59++++++++++++++++++++++-------------------------------------
Mthemis/Makefile | 70+++++++++++++++++++++++++++-------------------------------------------
5 files changed, 83 insertions(+), 119 deletions(-)

diff --git a/Makefile b/Makefile @@ -13,41 +13,35 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -include Makefile.in +.POSIX: -INSTALL_PATH = /usr/local/bin -SOURCES = solmaps.c solpp.c solppraw.c solpaths.c -PROG = $(SOURCES:%.c=%) +include config.mk -PROJECTS = themis cyl -.PHONY: default -default: all +SRC = solmaps.c solpp.c solppraw.c solpaths.c +PROG = $(SRC:.c=) + +PROJECTS = themis cyl -.PHONY: all -all: $(PROG) +default: $(PROG) -.PHONY: install install: $(PROG) - cp $(PROG) $(INSTALL_PATH) + mkdir -p $(DESTDIR)$(PREFIX)/bin + cp $(PROG) $(DESTDIR)$(PREFIX)/bin + for i in $(PROG); do chmod 755 "$(DESTDIR)$(PREFIX)/bin/$${i}"; done .PHONY: clean clean: - @rm -rf $(PROG) - @for i in $(PROJECTS); do make --no-print-directory -C $$i clean; done + rm -rf $(PROG) + for i in $(PROJECTS); do $(MAKE) -C "$${i}" clean; done -$(PROG): %: %.c solpp.h - @echo -e " CC $<"; $(CC) -o $@ $(CFLAGS) $< +$(PROG): solpp.h + $(CC) -o $@ $(CFLAGS) $@.c -.PHONY: run run: $(PROJECTS) -.PHONY: $(PROJECTS) $(PROJECTS): $(PROG) - @tput bold @echo "----------------------------------------------------------------------" @echo -e " Run $@" @echo "----------------------------------------------------------------------" - @tput sgr0 - @make --no-print-directory -C $@ - + @$(MAKE) -C $@ diff --git a/Makefile.in b/Makefile.in @@ -1,18 +0,0 @@ -# Copyright (C) 2017-2018 |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/>. - -CFLAGS = -O2 -std=c99 -pedantic -Wall -#CFLAGS = -g -std=c99 -pedantic -Wall - diff --git a/config.mk b/config.mk @@ -0,0 +1,19 @@ +# Copyright (C) 2017-2018 |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/>. + +PREFIX = /usr/local + +CFLAGS = -O2 -std=c99 -pedantic -Wall +#CFLAGS = -g -std=c99 -pedantic -Wall diff --git a/cyl/Makefile b/cyl/Makefile @@ -13,51 +13,36 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -include ../Makefile.in +.POSIX: -NEXPERIMENTS=10000000 -NPATHS=1000 -SUN_DIRS=270,40 +include ../config.mk -RCV=cyl-rcv.yaml -INPUT=cyl.yaml -GEOM=geom -SIMUL=simul +NEXPERIMENTS = 10000000 +NPATHS = 1000 +SUN_DIRS = 270,40 -PATH := $(PATH):.:../ +RCV = cyl-rcv.yaml +INPUT = cyl.yaml +GEOM = geom +SIMUL = simul -.PHONY: default -default: all +default: run -.PHONY: all -all: run - -.PHONY: simul simul: $(INPUT) - @tput bold - @echo -e ">>> Run simulation: Sun dirs = $(SUN_DIRS); #Experiments = $(NEXPERIMENTS)" - @tput sgr0 - @solstice -D$(SUN_DIRS) -n$(NEXPERIMENTS) -R$(RCV) -fo $(SIMUL) $(INPUT) - @solstice -D$(SUN_DIRS) -g format=obj:split=geometry -fo $(GEOM) $(INPUT) - @solppraw $(SIMUL) - @solpp $(GEOM) $(SIMUL) - -.PHONY: paths + solstice -D$(SUN_DIRS) -n$(NEXPERIMENTS) -R$(RCV) -fo $(SIMUL) $(INPUT) + solstice -D$(SUN_DIRS) -g format=obj:split=geometry -fo $(GEOM) $(INPUT) + ../solppraw $(SIMUL) + ../solpp $(GEOM) $(SIMUL) + paths: $(PROG) $(INPUT) - @tput bold - @echo -e ">>> Sample paths: Sun dirs = $(SUN_DIRS); #Paths = $(NPATHS)" - @tput sgr0 - @solstice -D$(SUN_DIRS) -q -n$(NPATHS) -R$(RCV) -p default $(INPUT) | solpaths + solstice -D$(SUN_DIRS) -q -n$(NPATHS) -R$(RCV) -p default $(INPUT) | ../solpaths -.PHONY: run run: paths simul -.PHONY: clean clean: - @rm -rf $(GEOM) $(SIMUL) \ - *-miscellaneous.obj \ - *-paths.vtk \ - *-primaries.vtk \ - *-receivers.vtk \ - *-raw-results.txt - + rm -rf $(GEOM) $(SIMUL) + rm -rf *-miscellaneous.obj + rm -rf *-paths.vtk + rm -rf *-primaries.vtk + rm -rf *-receivers.vtk + rm -rf *-raw-results.txt diff --git a/themis/Makefile b/themis/Makefile @@ -13,58 +13,42 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -include ../Makefile.in +.POSIX: -NEXPERIMENTS=1000000 -NPATHS=30 -SUN_DIRS=270,30:160,40 +include ../config.mk -RCV=themis-rcv.yaml -INPUT=themis.yaml -GEOM=geom -SIMUL=simul +NEXPERIMENTS = 1000000 +NPATHS = 30 +SUN_DIRS = 270,30:160,40 -SOURCES = themis.c -PROG = $(SOURCES:%.c=%) -PATH := $(PATH):.:../ +RCV = themis-rcv.yaml +INPUT = themis.yaml +GEOM = geom +SIMUL = simul -.PHONY: default -default: all +default: run -.PHONY: all -all: run - -.PHONY: simul simul: $(INPUT) $(PROG) - @tput bold - @echo -e ">>> Run simulation: Sun dirs = $(SUN_DIRS); #Experiments = $(NEXPERIMENTS)" - @tput sgr0 - @solstice -D$(SUN_DIRS) -n$(NEXPERIMENTS) -R$(RCV) -fo $(SIMUL) $(INPUT) - @solstice -D$(SUN_DIRS) -g format=obj:split=geometry -fo $(GEOM) $(INPUT) - @solppraw $(SIMUL) - @solpp $(GEOM) $(SIMUL) + solstice -D$(SUN_DIRS) -n$(NEXPERIMENTS) -R$(RCV) -fo $(SIMUL) $(INPUT) + solstice -D$(SUN_DIRS) -g format=obj:split=geometry -fo $(GEOM) $(INPUT) + ../solppraw $(SIMUL) + ../solpp $(GEOM) $(SIMUL) -.PHONY: paths paths: $(PROG) $(INPUT) - @tput bold - @echo -e ">>> Sample paths: Sun dirs = $(SUN_DIRS); #Paths = $(NPATHS)" - @tput sgr0 - @solstice -D$(SUN_DIRS) -q -n$(NPATHS) -R$(RCV) -p default $(INPUT) | solpaths + solstice -D$(SUN_DIRS) -q -n$(NPATHS) -R$(RCV) -p default $(INPUT) | ../solpaths -.PHONY: run run: paths simul -.PHONY: clean clean: - @rm -rf $(PROG) $(INPUT) $(GEOM) $(SIMUL) \ - *-miscellaneous.obj \ - *-paths.vtk \ - *-primaries.vtk \ - *-receivers.vtk \ - *-raw-results.txt - -$(PROG): %: %.c - @echo -e " CC $<"; $(CC) -o $@ $(CFLAGS) $< -lm - -$(INPUT): $(PROG) - @themis > $@ + rm -rf themis $(INPUT) $(GEOM) $(SIMUL) + rm -rf *-miscellaneous.obj + rm -rf *-paths.vtk + rm -rf *-primaries.vtk + rm -rf *-receivers.vtk + rm -rf *-raw-results.txt + +themis: themis.c + $(CC) -o $@ $(CFLAGS) themis.c -lm + +$(INPUT): themis + ./themis > $@