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=c99 -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 libhash) LDFLAGS += -Wall -lhash # $(shell pkg-config --libs libhash) all: libhash_ex 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 "LDLAGS=$(LDFLAGS)" @echo ".........................." %.o : $(CC) -c $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ $< libhash_ex: libhash_ex.o $(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ libhash_ex.o libhash_ex.o: libhash_ex.[c,h] mpool.o mpool.o: $(KOLAN_INCLUDE)/mpool.[c,h] xerror.o netfuncs.o: $(KOLAN_INCLUDE)/netfuncs.[c,h] listen.o: listen.[c,h] params.h xerror.o cfg_files.o: cfg_files.[c,h] ssdparser.o request.o: request.[c,h] ssdparser.o ssdparser.o: $(KOLAN_PROJECTS)/multiexpat/inc/ssdparser.[c,h] $(KOLAN_INCLUDE)/c_const.h \ $(KOLAN_INCLUDE)/map1251.h $(KOLAN_INCLUDE)/insys_parser/tags.h $(KOLAN_INCLUDE)/insys_parser/const.h xmalloc.o xmalloc.o: $(KOLAN_INCLUDE)/xmalloc.[c,h] xerror.o signals.o: signals.[c,h] xerror.o xerror.o: $(KOLAN_INCLUDE)/xerror.[c,h] clean: $(RM) *.o *.out callgrind.out.* *.gcno dataserver echo-client .PHONY: all clean