tImprove makefile logic - filmtools - various tools for photographic film development and darkroom printing
(HTM) git clone git://src.adamsgaard.dk/filmtools
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) commit 6e8a8268dd7306c7168c0ae212c8fe5663d8d82a
(DIR) parent 3546ae81af5a877bae48e2e2592c504cebc0dc1a
(HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Thu, 16 Jul 2020 22:21:50 +0200
Improve makefile logic
Diffstat:
M Makefile | 16 ++++++++++------
M config.mk | 7 +++----
2 files changed, 13 insertions(+), 10 deletions(-)
---
(DIR) diff --git a/Makefile b/Makefile
t@@ -2,20 +2,24 @@
include config.mk
-SRC = timeadj.c
-BIN = timeadj
+SRC = timeadj.c reciprocity.c
+BIN = timeadj reciprocity
BIN_SCRIPT = filmprice filmscan
-MAN1 = timeadj.1 filmscan.1
+MAN1 = ${BIN:=.1} ${BIN_SCRIPT:=.1}
+
+all: ${BIN}
+
+${BIN}: ${@:=.o}
OBJ = ${SRC:.c=.o}
-all: ${BIN}
+${OBJ}:
.o:
- ${CC} ${FILMTOOLS_LDFLAGS} -o $@
+ ${CC} ${FILMTOOLS_LDFLAGS} -o $@ $<
.c.o:
- ${CC} -c ${FILMTOOLS_CFLAGS} -o $@ -c $<
+ ${CC} ${FILMTOOLS_CFLAGS} ${FILMTOOLS_CPPFLAGS} -o $@ -c $<
filmprice_snapshot: filmprice
@out="filmprice_$$(date '+%Y-%m-%d')"; \
(DIR) diff --git a/config.mk b/config.mk
t@@ -1,14 +1,13 @@
+.POSIX:
+
# customize below to fit your system
# paths
PREFIX = /usr/local
MANPREFIX = ${PREFIX}/man
-# compiler and linker
-CC = cc
-
FILMTOOLS_CFLAGS = ${CFLAGS}
-FILMTOOLS_LDFLAGS = ${LDFLAGS}
+FILMTOOLS_LDFLAGS = ${LDFLAGS} -lm
FILMTOOLS_CPPFLAGS = -D_DEFAULT_SOURCE
# debug