Makefile 1.12 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
# See LICENSE file for license and copyright information

include ../config.mk
include ../common.mk
include config.mk

PROJECT = tests
SOURCE  = tests.c $(wildcard test_*.c)
OBJECTS = ${SOURCE:.c=.o}

ZSOURCE   = $(shell find ../ -iname "*.c" -a ! -iname "database-*" ! -iname "main.c" ! -path "*tests*")
ZOBJECTS = ${ZSOURCE:.c=.o}

ifeq (${DATABASE}, sqlite)
15 16
INCS   += $(SQLITE_INC)
LIBS   += $(SQLITE_LIB)
17 18 19 20 21 22 23
ZSOURCE += ../database-sqlite.c
else
ifeq (${DATABASE}, plain)
ZSOURCE += ../database-plain.c
endif
endif

24
all: ${PROJECT}
25

26
run: ${PROJECT}
27 28 29 30 31 32 33 34 35 36 37 38 39 40
	$(QUIET)./${PROJECT}

options:
	@echo ${PROJECT} build options:
	@echo "CFLAGS  = ${CFLAGS}"
	@echo "LDFLAGS = ${LDFLAGS}"
	@echo "DFLAGS  = ${DFLAGS}"
	@echo "CC      = ${CC}"

%.o: %.c
	$(ECHO) CC $<
	@mkdir -p .depend
	$(QUIET)${CC} -c -I.. ${CPPFLAGS} ${CFLAGS} -o $@ $< -MMD -MF .depend/$@.dep

Moritz Lipp's avatar
Moritz Lipp committed
41 42
${PROJECT}: options ${OBJECTS}
	$(QUIET)make -C ..
43 44 45 46 47 48
	$(ECHO) CC -o $@
	$(QUIET)${CC} ${SFLAGS} ${LDFLAGS} -o $@ ${OBJECTS} ${ZOBJECTS} ${LIBS}

${OBJECTS}: ../config.mk

clean:
49
	$(QUIET)rm -rf ${OBJECTS} ${PROJECT} *.gcno *.gcda
50

51
.PHONY: all options clean debug run
52 53

-include $(wildcard .depend/*.dep)