From 34e3eff9c4c26f8a3bcdfcae547204f3e16f5a56 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Mon, 27 Sep 2010 08:54:16 +0200 Subject: [PATCH] Makefile: adding configuration file. --- .gitignore | 1 + Makefile | 24 +++++++++++++++++------- Makefile.local.mk-dist | 10 ++++++++++ 3 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 Makefile.local.mk-dist diff --git a/.gitignore b/.gitignore index 729c43d..329618f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.o +Makefile.local.mk build/ test/test_* nbproject diff --git a/Makefile b/Makefile index 5ef1406..681989c 100644 --- a/Makefile +++ b/Makefile @@ -4,21 +4,27 @@ CC = gcc CFLAGS = -O2 -Werror +LD = $(CC) LDFLAGS = +FINDOBJ = find . -name "*.o" -type f -printf "%P\n" + +BUILD := build +PROGRAM := $(BUILD)/archived + +include Makefile.local.mk + ifdef DEBUG CFLAGS += -g -D__DEBUG__ endif -ifndef V +ifndef VERBOSE QUIET_CC = @echo ' ' CC $@; QUIET_LD = @echo ' ' LD $@; endif - -FINDOBJ = find . -name "*.o" -type f -printf "%P\n" - -BUILD := ./build -PROGRAM := $(BUILD)/arch +ifeq ($(VERBOSE), 2) + CFLAGS += -v +endif ifeq ($(output), mysql) CFLAGS += `mysql_config --cflags` @@ -52,7 +58,7 @@ all : $(PROGRAM) $(PROGRAM) : $(obj) @mkdir -p $(BUILD) - $(QUIET_LD)$(CC) $(LDFLAGS) $^ -o $@ + $(QUIET_LD)$(LD) $(LDFLAGS) $^ -o $@ clean : @for obj in `$(FINDOBJ)`; do \ @@ -64,3 +70,7 @@ cleaner : clean %.o : %.c $(QUIET_CC)$(CC) $(CFLAGS) -c $< -o $@ + +Makefile.local.mk : + @echo " Can't find 'Makefile.local.mk'; copying default configuration" + @cp Makefile.local.mk-dist Makefile.local.mk diff --git a/Makefile.local.mk-dist b/Makefile.local.mk-dist new file mode 100644 index 0000000..d068216 --- /dev/null +++ b/Makefile.local.mk-dist @@ -0,0 +1,10 @@ + +# Enable debug +# DEBUG = 1 + +# Verbose output +# VERBOSE = 1 + +# Define what type of output should be used. default stdout +# output = stdout +# output = mysql