2011-06-09 19:00:04 +04:00
|
|
|
CC=cc
|
|
|
|
CXX=c++
|
|
|
|
INCLUDE=-I$(HOME)/projects/include
|
|
|
|
KOLAN_PROJECTS=$(HOME)/projects
|
|
|
|
KOLAN_INCLUDE=$(KOLAN_PROJECTS)/include
|
|
|
|
|
|
|
|
# Compiler flags
|
|
|
|
# if mode variable is empty, setting debug build mode
|
|
|
|
ifeq ($(mode),)
|
|
|
|
mode = debug
|
|
|
|
endif
|
|
|
|
ifeq ($(mode),debug)
|
|
|
|
CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion
|
|
|
|
LDFLAGS =
|
|
|
|
endif
|
|
|
|
ifeq ($(mode),profile)
|
|
|
|
CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch
|
|
|
|
LDFLAGS = -g -p
|
|
|
|
endif
|
|
|
|
ifeq ($(mode),develop)
|
|
|
|
CFLAGS += -O2 -g
|
|
|
|
LDFLAGS += -O1
|
|
|
|
endif
|
|
|
|
ifeq ($(mode),release)
|
|
|
|
CFLAGS += -O2
|
|
|
|
LDFLAGS += -O1
|
|
|
|
endif
|
|
|
|
|
|
|
|
CFLAGS += -Wall
|
|
|
|
#~ $(shell pkg-config --cflags liblist)
|
|
|
|
LDFLAGS += -Wall
|
|
|
|
#~ $(shell pkg-config --libs liblist)
|
|
|
|
|
2011-06-13 12:18:12 +04:00
|
|
|
all: zalloc_test
|
2011-06-09 19:00:04 +04:00
|
|
|
|
|
|
|
ifneq ($(mode),debug)
|
|
|
|
ifneq ($(mode),profile)
|
|
|
|
ifneq ($(mode),develop)
|
|
|
|
ifneq ($(mode),release)
|
|
|
|
@echo "Invalid build mode."
|
|
|
|
@echo "Please use 'make mode=release' or 'make mode=develop' or 'make mode=debug'"
|
|
|
|
@exit 1
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
@echo ".........................."
|
|
|
|
@echo "Building on "$(mode)" mode "
|
|
|
|
@echo "CFLAGS=$(CFLAGS)"
|
|
|
|
@echo "LDFLAGS=$(LDFLAGS)"
|
|
|
|
@echo ".........................."
|
|
|
|
|
|
|
|
%.o :
|
|
|
|
$(CC) -c $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ $<
|
|
|
|
|
2011-06-13 12:18:12 +04:00
|
|
|
zalloc_test_obj = zalloc.o xerror.o
|
|
|
|
zalloc_test: zalloc_test.o $(zalloc_test_obj)
|
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ zalloc_test.o $(zalloc_test_obj)
|
2011-06-09 19:00:04 +04:00
|
|
|
|
2011-06-13 12:18:12 +04:00
|
|
|
zalloc_test.o: zalloc_test.c zalloc.o
|
2011-06-09 19:00:04 +04:00
|
|
|
|
2011-06-13 12:18:12 +04:00
|
|
|
zalloc.o: $(KOLAN_INCLUDE)/zalloc.c $(KOLAN_INCLUDE)/zalloc.h
|
2011-06-09 19:00:04 +04:00
|
|
|
|
|
|
|
xerror.o: $(KOLAN_INCLUDE)/xerror.c $(KOLAN_INCLUDE)/xerror.c
|
|
|
|
|
|
|
|
clean:
|
2011-06-13 12:18:12 +04:00
|
|
|
$(RM) *.o *.out callgrind.out.* *.gcno zalloc_test
|
2011-06-09 19:00:04 +04:00
|
|
|
|
|
|
|
.PHONY: all clean
|