star-phor-input

File format for describing photoreactor configurations
git clone https://www.edstar.cnrs.fr/git/star-phor-input.git
Log | Files | Refs | README | LICENSE

commit 860c57a4725a2f701f567ef59b1f552558776125
parent c76cd32949849fcc51fe56bc3d2d56892e263f7c
Author: Eduardo Fontana Lazzari <edufonlaz@gmail.com>
Date:   Wed,  4 Dec 2024 10:57:44 +0100

Set Makefile

Diffstat:
AMakefile | 82+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aconfig.mk | 70++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 152 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile @@ -0,0 +1,82 @@ +# Copyright (C) 2024 Centre National de la Recherche Scientifique +# Copyright (C) 2024 Clermont Auvergne INP +# Copyright (C) 2024 INSA Lyon +# Copyright (C) 2024 Institut Mines Télécom Albi-Carmaux +# Copyright (C) 2024 Institut National Polytechnique de Toulouse +# Copyright (C) 2024 |Méso|Star> (contact@meso-star.com) +# Copyright (C) 2024 PhotonLyX (info@photonlyx.com) +# Copyright (C) 2024 Université de Lorraine +# Copyright (C) 2024 Université Paul Sabatier +# Copyright (C) 2024 Université Toulouse - Jean Jaurès +# +# 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 = libsphin.so + +default: build_library + +################################################################################ +# Library building +################################################################################ +SRC = src/sphin.c +OBJ = $(SRC:.c=.o) +DEP = $(SRC:.c=.d) + +build_library: .config $(DEP) + @$(MAKE) -fMakefile $$(for i in $(DEP); do echo -f $${i}; done) $(LIBNAME) + +$(DEP) $(OBJ): config.mk + +$(LIBNAME): $(OBJ) + $(CC) $(CFLAGS_SO) $(INCS) -o $@ $(OBJ) $(LDFLAGS_SO) $(LIBS) + +.config: config.mk + $(PKG_CONFIG) --atleast-version $(RSYS_VERSION) rsys + echo "config done" > $@ + +.SUFFIXES: .c .d .o +.c.d: + @$(CC) $(CFLAGS_SO) $(INCS) -MM -MT "$(@:.d=.o) $@" $< -MF $@ + +.c.o: + $(CC) $(CFLAGS_SO) $(INCS) -DSPHIN_SHARED_BUILD -c $< -o $@ + +################################################################################ +# Installation +################################################################################ +pkg: + sed -e 's#@PREFIX@#$(PREFIX)#g'\ + -e 's#@VERSION@#$(VERSION)#g'\ + -e 's#@RSYS_VERSION@#$(RSYS_VERSION)#g'\ + svx.pc.in > sphin.pc + +sphin-local.pc: sphin.pc.in + sed -e '1d'\ + -e 's#^includedir=.*#includedir=./src/#'\ + -e 's#^libdir=.*#libdir=./#'\ + -e 's#@VERSION@#$(VERSION)#g'\ + -e 's#@RSYS_VERSION@#$(RSYS_VERSION)#g'\ + svx.pc.in > $@ + +install: + +uninstall: + +clean: + rm -f $(OBJ) $(LIBNAME) $(DEP) .config diff --git a/config.mk b/config.mk @@ -0,0 +1,70 @@ +VERSION = 0.0 +PREFIX = /usr/local + +BUILD_TYPE = RELEASE +#BUILD_TYPE = DEBUG + +################################################################################ +# Tools +################################################################################ +AR = ar +CC = cc +LD = ld +OBJCOPY = objcopy +PKG_CONFIG = pkg-config +RANLIB = ranlib + +################################################################################ +# Dependencies +################################################################################ +RSYS_VERSION=0.14 +INCS = $$($(PKG_CONFIG) --cflags rsys) +LIBS = $$($(PKG_CONFIG) --libs rsys) + +################################################################################ +# 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))