commit 0183a927c8752ebf40b2948fcd1ae69de87f31c0
parent 833dc2df7128bf41fa3c62edf1c5ccb60636fe2c
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Mon, 18 Sep 2017 10:40:34 +0200
Make a specific Makefile for the themis project
Diffstat:
5 files changed, 118 insertions(+), 42 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -1,3 +1,13 @@
+solpp
+solppraw
+solpaths
+geom
+simul
+themis
+*.txt
+*.yaml
+*.vtk
+*.obj
.gitignore
tmp
[Bb]uild*
diff --git a/Makefile b/Makefile
@@ -13,19 +13,13 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-NEXPERIMENTS=1000000
-NPATHS=100
-SUN_DIRS=270,70:160,30
+include Makefile.in
-RCV=themis-rcv.yaml
-INPUT=themis.yaml
-GEOM=geom
-SIMUL=simul
+INSTALL_PATH = /usr/local/bin
+SOURCES = solpp.c solppraw.c solpaths.c
+PROG = $(SOURCES:%.c=%)
-CFLAGS = -O2 -std=c99 -pedantic -Wall
-SCRIPT = themis.c solpp.c solppraw.c solpaths.c
-PROG = $(SCRIPT:%.c=%)
-PATH := $(PATH):.
+PROJECTS = themis
.PHONY: default
default: all
@@ -33,42 +27,24 @@ default: all
.PHONY: all
all: $(PROG)
-.PHONY: receiver
-receiver:
- @echo "- {name: target, side: BACK, per_primitive: 1}" > $(RCV)
-
-.PHONY: simul
-simul: $(INPUT) receiver $(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)
-
-.PHONY: paths
-paths: $(PROG) $(INPUT) receiver
- @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
-
-.PHONY: run
-run: paths simul
+.PHONY: install
+install: $(PROG)
+ cp $(PROG) $(INSTALL_PATH)
.PHONY: clean
clean:
- @rm -rf $(PROG) $(INPUT) $(GEOM) $(SIMUL) $(RCV) \
- *-miscellaneous.obj \
- *-paths.vtk \
- *-primaries.vtk \
- *-receivers.vtk \
- *-raw-results.txt
+ @rm -rf $(PROG)
+ @for i in $(PROJECTS); do make --no-print-directory -C $$i clean; done
$(PROG): %: %.c solpp.h
@echo -e " CC $<"; $(CC) -o $@ $(CFLAGS) $<
-$(INPUT): $(PROG)
- @themis > $@
+.PHONY: $(PROJECTS)
+$(PROJECTS): $(PROG)
+ @tput bold
+ @echo "----------------------------------------------------------------------"
+ @echo -e " Run $@"
+ @echo "----------------------------------------------------------------------"
+ @tput sgr0
+ @make --no-print-directory -C $@
diff --git a/Makefile.in b/Makefile.in
@@ -0,0 +1,16 @@
+# Copyright (C) |Meso|Star> 2017
+#
+# 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
diff --git a/themis/Makefile b/themis/Makefile
@@ -0,0 +1,74 @@
+# Copyright (C) |Meso|Star> 2017
+#
+# 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/>.
+
+include ../Makefile.in
+
+NEXPERIMENTS=10000000
+NPATHS=100
+SUN_DIRS=270,70
+
+RCV=themis-rcv.yaml
+INPUT=themis.yaml
+GEOM=geom
+SIMUL=simul
+
+SOURCES = themis.c
+PROG = $(SOURCES:%.c=%)
+PATH := $(PATH):.:../
+
+.PHONY: default
+default: all
+
+.PHONY: all
+all: run
+
+.PHONY: receiver
+receiver:
+ @echo "- {name: target, side: BACK, per_primitive: 1}" > $(RCV)
+
+.PHONY: simul
+simul: $(INPUT) receiver $(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)
+
+.PHONY: paths
+paths: $(PROG) $(INPUT) receiver
+ @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
+
+.PHONY: run
+run: paths simul
+
+.PHONY: clean
+clean:
+ @rm -rf $(PROG) $(INPUT) $(GEOM) $(SIMUL) $(RCV) \
+ *-miscellaneous.obj \
+ *-paths.vtk \
+ *-primaries.vtk \
+ *-receivers.vtk \
+ *-raw-results.txt
+
+$(PROG): %: %.c
+ @echo -e " CC $<"; $(CC) -o $@ $(CFLAGS) $<
+
+$(INPUT): $(PROG)
+ @themis > $@
diff --git a/themis.c b/themis/themis.c