From 43dae84fa5dc5050a99e0b15890bc2bb27c05170 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 12 Aug 2018 22:12:41 +0200 Subject: Improve makefile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- Makefile | 12 ++++++------ config.mk | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 config.mk diff --git a/Makefile b/Makefile index ae5830b..68e5b97 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,7 @@ .POSIX: -CFLAGS = -std=c99 -Wall -Wextra -O2 $(CPPFLAGS) -CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -LDFLAGS = -s +CONFIGFILE = config.mk +include $(CONFIGFILE) OBJ =\ allocn.o\ @@ -56,15 +55,16 @@ OBJ =\ libsimple.o all: libsimple.a -$(OBJ): libsimple.h +$(OBJ): $(@:.o=.c) libsimple.h libsimple.a: $(OBJ) $(AR) rc $@ $? $(AR) -s $@ clean: - -rm -r -- *.o libsimple.a libsimple.so libsimple.so.* + -rm -rf -- *.o *.su *.a *.so *.so.* *.gch *.gcda *.gcno *.gcov *.lo -.SUFFIXES: .c.o +.SUFFIXES: +.SUFFIXES: .o .c .PHONY: all clean diff --git a/config.mk b/config.mk new file mode 100644 index 0000000..2751186 --- /dev/null +++ b/config.mk @@ -0,0 +1,3 @@ +CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 +CFLAGS = -std=c99 -Wall -Wextra -O2 $(CPPFLAGS) +LDFLAGS = -s -- cgit v1.2.3-70-g09d2