Makefile 1.14 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
# 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}

11
ZSOURCE   = $(shell find ../ -maxdepth 1 -iname "*.c" -a ! -iname "database-sqlite.c" ! -iname "main.c")
12 13
ZOBJECTS = ${ZSOURCE:.c=.o}

14
ifneq (${WITH_SQLITE},0)
15 16
INCS   += $(SQLITE_INC)
LIBS   += $(SQLITE_LIB)
17
ZSOURCE += ../database-sqlite.c
18 19
ifeq (,$(findstring -DWITH_SQLITE,${CPPFLAGS}))
CPPFLAGS += -DWITH_SQLITE
20 21 22
endif
endif

23
all: ${PROJECT}
24

25
run: ${PROJECT}
26 27 28 29 30 31 32 33 34 35 36 37 38 39
	$(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
40 41
${PROJECT}: options ${OBJECTS}
	$(QUIET)make -C ..
42 43 44 45 46 47
	$(ECHO) CC -o $@
	$(QUIET)${CC} ${SFLAGS} ${LDFLAGS} -o $@ ${OBJECTS} ${ZOBJECTS} ${LIBS}

${OBJECTS}: ../config.mk

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

50
.PHONY: all options clean debug run
51 52

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