summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2016-05-17 23:02:25 +0200
committerFRIGN <dev@frign.de>2016-05-18 10:34:05 +0200
commitc494437937ee01c6d3eb5b630a15e207aae76c25 (patch)
tree1cc20abba300350b3b8add22be703f9b507b792b /Makefile
parent3d0f4c70385c8ad1dbaad1bb266e644c7109aa6a (diff)
Makefile improvements
- fix: rebuild on source change. - allow to override dependency flag per tool (the ones that have deps). - rebuild on config.mk or headers change.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile17
1 files changed, 10 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 21b82d9..2177d25 100644
--- a/Makefile
+++ b/Makefile
@@ -11,17 +11,20 @@ MAN5 = farbfeld.5
all: ${BIN}
-png2ff ff2png:
- ${CC} -o $@ ${CFLAGS} ${CPPFLAGS} -L${PNGLIB} -lpng -I${PNGINC} ${LDFLAGS} $@.c
+${BIN}: ${@:=.o}
-jpg2ff ff2jpg:
- ${CC} -o $@ ${CFLAGS} ${CPPFLAGS} -L${JPGLIB} -ljpeg -I${JPGINC} ${LDFLAGS} $@.c
+OBJ = ${SRC:.c=.o}
-.c:
- ${CC} -o $@ ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} $<
+${OBJ}: config.mk ${HDR}
+
+.o:
+ ${CC} ${CFLAGS} ${$*-LDFLAGS} -o $@ $<
+
+.c.o:
+ ${CC} ${CFLAGS} ${$*-CFLAGS} ${CPPFLAGS} -c $<
clean:
- rm -f ${BIN}
+ rm -f ${BIN} ${OBJ}
dist:
rm -rf "farbfeld-${VERSION}"