# Makefile for Icinga tests

CP=@CP@
CC=@CC@
CFLAGS=@CFLAGS@ @DEFS@

###############################
# Debug
###############################
ENABLE_DEBUG=@ENABLE_DEBUG@

# Compiler flags for use with Valgrind - set when debug is enabled
ifeq ('$(ENABLE_DEBUG)', 'yes')
        CFLAGS=-O0 -g -Wall
endif

all:

test:	JSON_checker
	@perl -I. -MTest::Harness -e '$$Test::Harness::verbose=1; runtests @ARGV;' *.t

clean:
	rm -f tests.log
	rm -f json_checker/JSON_checker_lib.o
	rm -f JSON_checker
distclean: clean
	rm -f Makefile

JSON_checker:
	$(CC) $(CFLAGS) -c -o json_checker/JSON_checker_lib.o json_checker/JSON_checker_lib.c
	$(CC) $(CFLAGS) -o JSON_checker json_checker/JSON_checker.c json_checker/JSON_checker_lib.o
