Makefile: take advantage of having separate build units - gramscii - A simple editor for ASCII box-and-arrow charts
DIR Log
DIR Files
DIR Refs
DIR Tags
DIR README
DIR LICENSE
---
DIR commit 6042c9f07fe79651893953e1f3f69528806a8a5d
DIR parent 8c68f21cb18bf707d6d5dec1724d3bd11b5855d6
HTML Author: Quentin Rameau <quinq@fifth.space>
Date: Mon, 5 Aug 2019 00:53:35 +0200
Makefile: take advantage of having separate build units
Diffstat:
M Makefile | 14 ++++++++------
R main.c -> gramscii.c | 0
2 files changed, 8 insertions(+), 6 deletions(-)
---
DIR diff --git a/Makefile b/Makefile
@@ -3,8 +3,9 @@
include config.mk
-SRC = main.c draw.c screen.c files.c lineset.c
+SRC = gramscii.c draw.c screen.c files.c lineset.c
INC = config.h gramscii.h arg.h
+OBJ = ${SRC:.c=.o}
DISTFILES = ${SRC} ${INC} Makefile config.mk README.md Changelog
all: options gramscii
@@ -16,14 +17,15 @@ options:
@echo "LDFLAGS = ${LDFLAGS}"
@echo "CC = ${CC}"
@echo "-+-+-+-+-+-+-+-+-+-+-"
-
-gramscii: ${SRC} ${INC}
- ${CC} ${CFLAGS} ${LDFLAGS} -o $@ ${SRC}
-
+
+gramscii: ${OBJ}
+
+${OBJ}: ${INC}
+
clean:
@echo cleaning
- @rm -f gramscii
+ @rm -f gramscii ${OBJ}
install: all
@echo installing executable to ${DESTDIR}${BINDIR}
DIR diff --git a/main.c b/gramscii.c