Makefile 1.15 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
ZOSOURCE   = $(filter-out ../main.c,$(wildcard ../*.c))
12

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

24 25
ZOBJECTS = ${ZSOURCE:.c=.o}

26
all: ${PROJECT}
27

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

${OBJECTS}: ../config.mk

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

53
.PHONY: all options clean debug run
54 55

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