Archived
1
0
Fork 0

Makefile: adding configuration file.

This commit is contained in:
Henrik Hautakoski 2010-09-27 08:54:16 +02:00
parent 3e4723aa06
commit 34e3eff9c4
3 changed files with 28 additions and 7 deletions

1
.gitignore vendored
View file

@ -1,4 +1,5 @@
*.o *.o
Makefile.local.mk
build/ build/
test/test_* test/test_*
nbproject nbproject

View file

@ -4,21 +4,27 @@
CC = gcc CC = gcc
CFLAGS = -O2 -Werror CFLAGS = -O2 -Werror
LD = $(CC)
LDFLAGS = LDFLAGS =
FINDOBJ = find . -name "*.o" -type f -printf "%P\n"
BUILD := build
PROGRAM := $(BUILD)/archived
include Makefile.local.mk
ifdef DEBUG ifdef DEBUG
CFLAGS += -g -D__DEBUG__ CFLAGS += -g -D__DEBUG__
endif endif
ifndef V ifndef VERBOSE
QUIET_CC = @echo ' ' CC $@; QUIET_CC = @echo ' ' CC $@;
QUIET_LD = @echo ' ' LD $@; QUIET_LD = @echo ' ' LD $@;
endif endif
ifeq ($(VERBOSE), 2)
FINDOBJ = find . -name "*.o" -type f -printf "%P\n" CFLAGS += -v
endif
BUILD := ./build
PROGRAM := $(BUILD)/arch
ifeq ($(output), mysql) ifeq ($(output), mysql)
CFLAGS += `mysql_config --cflags` CFLAGS += `mysql_config --cflags`
@ -52,7 +58,7 @@ all : $(PROGRAM)
$(PROGRAM) : $(obj) $(PROGRAM) : $(obj)
@mkdir -p $(BUILD) @mkdir -p $(BUILD)
$(QUIET_LD)$(CC) $(LDFLAGS) $^ -o $@ $(QUIET_LD)$(LD) $(LDFLAGS) $^ -o $@
clean : clean :
@for obj in `$(FINDOBJ)`; do \ @for obj in `$(FINDOBJ)`; do \
@ -64,3 +70,7 @@ cleaner : clean
%.o : %.c %.o : %.c
$(QUIET_CC)$(CC) $(CFLAGS) -c $< -o $@ $(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

10
Makefile.local.mk-dist Normal file
View file

@ -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