Commit c4944379 authored by Hiltjo Posthuma's avatar Hiltjo Posthuma Committed by FRIGN

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.
parent 3d0f4c70
......@@ -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}"
......
......@@ -23,3 +23,17 @@ LDFLAGS = -s ${LIBS}
# compiler and linker
CC = cc
# flags per tool.
png2ff-CFLAGS := -I${PNGINC}
png2ff-LDFLAGS := -L${PNGLIB} -lpng
ff2png-CFLAGS := -I${PNGINC}
ff2png-LDFLAGS := -L${PNGLIB} -lpng
jpg2ff-CFLAGS := -I${JPGINC}
jpg2ff-LDFLAGS := -L${JPGLIB} -ljpeg
ff2jpg-CFLAGS := -I${JPGINC}
ff2jpg-LDFLAGS := -L${JPGLIB} -ljpeg
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment