2011-06-08 11:29:22 +04:00
|
|
|
CC=cc
|
|
|
|
CXX=c++
|
2011-06-07 12:17:19 +04:00
|
|
|
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)
|
2011-06-10 14:31:10 +04:00
|
|
|
CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion
|
2011-06-07 12:17:19 +04:00
|
|
|
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
|
|
|
|
|
2011-06-10 14:31:10 +04:00
|
|
|
CFLAGS += -Wall
|
|
|
|
#~ $(shell pkg-config --cflags liblist)
|
|
|
|
LDFLAGS += -Wall
|
|
|
|
#~ $(shell pkg-config --libs liblist) -lpthread -lexpat
|
2011-06-07 12:17:19 +04:00
|
|
|
|
2011-06-29 11:02:59 +04:00
|
|
|
all: tex_parser_test
|
2011-06-07 12:17:19 +04:00
|
|
|
|
|
|
|
ifneq ($(mode),debug)
|
|
|
|
ifneq ($(mode),profile)
|
|
|
|
ifneq ($(mode),develop)
|
|
|
|
ifneq ($(mode),release)
|
|
|
|
@echo "Invalid build mode."
|
2011-06-30 16:38:54 +04:00
|
|
|
@echo "Please use 'make mode=release', 'make mode=develop' or 'make mode=debug'"
|
2011-06-07 12:17:19 +04:00
|
|
|
@exit 1
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
@echo ".........................."
|
|
|
|
@echo "Building on "$(mode)" mode "
|
|
|
|
@echo "CFLAGS=$(CFLAGS)"
|
2011-06-10 14:31:10 +04:00
|
|
|
@echo "LDFLAGS=$(LDFLAGS)"
|
2011-06-07 12:17:19 +04:00
|
|
|
@echo ".........................."
|
|
|
|
|
|
|
|
%.o :
|
2011-06-10 14:31:10 +04:00
|
|
|
$(CC) -c $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ $<
|
2011-06-07 12:17:19 +04:00
|
|
|
|
2011-06-30 16:38:54 +04:00
|
|
|
tex_parser_test_obj = tex_parser_test.o tex_parser.o zalloc_ext.o zalloc.o xalloc.o zerror.o xerror.o
|
2011-06-29 11:02:59 +04:00
|
|
|
tex_parser_test: $(tex_parser_test_obj)
|
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ $(tex_parser_test_obj)
|
2011-06-07 12:17:19 +04:00
|
|
|
|
2011-06-29 11:02:59 +04:00
|
|
|
tex_parser_test.o: tex_parser_test.c tex_parser.o
|
2011-06-08 15:13:26 +04:00
|
|
|
|
2011-06-30 16:38:54 +04:00
|
|
|
tex_parser.o: tex_parser.c tex_parser.h zalloc_ext.o zalloc.o xalloc.o zerror.o
|
2011-06-20 17:24:43 +04:00
|
|
|
|
|
|
|
zalloc_ext.o: $(KOLAN_INCLUDE)/zalloc_ext.c $(KOLAN_INCLUDE)/zalloc_ext.h zalloc.o xerror.o
|
2011-06-07 12:17:19 +04:00
|
|
|
|
2011-06-16 16:45:28 +04:00
|
|
|
zalloc.o: $(KOLAN_INCLUDE)/zalloc.c $(KOLAN_INCLUDE)/zalloc.h xerror.o
|
2011-06-07 12:17:19 +04:00
|
|
|
|
2011-06-16 16:45:28 +04:00
|
|
|
xalloc.o: $(KOLAN_INCLUDE)/xalloc.c $(KOLAN_INCLUDE)/xalloc.h xerror.o
|
2011-06-10 14:31:10 +04:00
|
|
|
|
2011-06-30 16:38:54 +04:00
|
|
|
zerror.o: $(KOLAN_INCLUDE)/zerror.c $(KOLAN_INCLUDE)/zerror.h
|
|
|
|
|
2011-06-10 14:31:10 +04:00
|
|
|
xerror.o: $(KOLAN_INCLUDE)/xerror.c $(KOLAN_INCLUDE)/xerror.h
|
2011-06-07 12:17:19 +04:00
|
|
|
|
|
|
|
clean:
|
2011-06-29 11:02:59 +04:00
|
|
|
$(RM) *.o *.out callgrind.out.* *.gcno tex_parser_test
|
2011-06-07 12:17:19 +04:00
|
|
|
|
|
|
|
.PHONY: all clean
|