tMakefile: rework for strict POSIX compatibility - cngf-pf - continuum model fo… | |
git clone git://src.adamsgaard.dk/cngf-pf | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit cd4f3c9eb925333b5a6f43df1c37bbc823a05359 | |
parent f7ea4f9e8fa21b0259b827640b0852c998b18fa2 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Mon, 23 Nov 2020 11:06:08 +0100 | |
Makefile: rework for strict POSIX compatibility | |
Diffstat: | |
M Makefile | 60 ++++++++++++++++++-----------… | |
1 file changed, 34 insertions(+), 26 deletions(-) | |
--- | |
diff --git a/Makefile b/Makefile | |
t@@ -1,51 +1,61 @@ | |
+.POSIX: | |
+ | |
NAME = cngf-pf | |
VERSION = 0.6.0 | |
-PREFIX ?= /usr/local | |
-MANPREFIX ?= ${PREFIX}/man | |
-DOCPREFIX ?= ${PREFIX}/share/doc/${NAME} | |
+# paths | |
+PREFIX = /usr/local | |
+MANPREFIX = ${PREFIX}/share/man | |
+DOCPREFIX = ${PREFIX}/share/doc/${NAME} | |
+BIN = \ | |
+ cngf-pf\ | |
+ max_depth_simple_shear\ | |
+ shear_flux | |
+SRC = ${BIN:=.c} | |
HDR = \ | |
arg.h\ | |
arrays.h\ | |
fluid.h\ | |
simulation.h | |
-BIN = \ | |
- cngf-pf\ | |
- max_depth_simple_shear\ | |
- shear_flux | |
-MAN1 = \ | |
- cngf-pf.1\ | |
- max_depth_simple_shear.1\ | |
- shear_flux.1 | |
+ | |
+LIBS = -lm | |
+ | |
+CNGFPFCFLAGS = ${CFLAGS} ${INCS} -DVERSION=\"${VERSION}\" | |
+CNGFPFLDFLAGS = ${LDFLAGS} ${LIBS} | |
+CNGFPFCPPFLAGS = ${CPPFLAGS} | |
+ | |
+MAN1 = ${BIN:=.1} | |
DOC = \ | |
README.md\ | |
LICENSE | |
-HERE_CFLAGS = ${CFLAGS} -O2 -g -std=c99 | |
-HERE_LDFLAGS = ${LDFLAGS} -lm -g | |
-GLOBALCONST = -DVERSION=\"${VERSION}\" | |
- | |
all: ${BIN} | |
+${BIN}: ${@:=.o} | |
+ | |
+OBJ = ${SRC:.c=.o} | |
+ | |
+${OBJ}: ${HDR} | |
+ | |
.o: | |
- ${CC} ${LDFLAGS} -o $@ ${LIBS} | |
+ ${CC} ${CNGFPFLDFLAGS} -o $@ $< | |
-.c.o: ${HDR} | |
- ${CC} ${HERE_CFLAGS} ${GLOBALCONST} -o $@ -c $< | |
+.c.o: | |
+ ${CC} ${CNGFPFCFLAGS} ${CNGFPFCPPFLAGS} -o $@ -c $< | |
cngf-pf: cngf-pf.o arrays.o fluid.o simulation.o | |
- ${CC} ${HERE_LDFLAGS}\ | |
+ ${CC} ${CNGFPFLDFLAGS}\ | |
cngf-pf.o arrays.o fluid.o simulation.o\ | |
-o $@ | |
-max_depth_simple_shear: max_depth_simple_shear.o arrays.o fluid.o simulation.o… | |
- ${CC} ${HERE_LDFLAGS}\ | |
+max_depth_simple_shear: max_depth_simple_shear.o arrays.o fluid.o simulation.o | |
+ ${CC} ${CNGFPFLDFLAGS}\ | |
max_depth_simple_shear.o arrays.o fluid.o simulation.o\ | |
-o $@ | |
-shear_flux: shear_flux.o ${HDR} | |
- ${CC} ${HERE_LDFLAGS}\ | |
+shear_flux: shear_flux.o | |
+ ${CC} ${CNGFPFLDFLAGS}\ | |
shear_flux.o\ | |
-o $@ | |
t@@ -76,8 +86,6 @@ test: ${BIN} | |
make -C test/ | |
clean: | |
- rm -f *.txt | |
- rm -f *.o | |
- rm -f ${BIN} | |
+ rm -f ${BIN} ${OBJ} test/*.txt | |
.PHONY: all install uninstall watch test memtest clean |