# Tv Makefile
#
# SYNOPSIS:
#
#   make [all]  - makes everything.
#   make TARGET - makes the given target.
#   make clean  - removes all files generated by make.

CC=gcc

# iutest root directory
IUTEST_DIR = ..

# Flags passed to the preprocessor.
CFLAGS += -I$(IUTEST_DIR)/include

#
# Flags passed to the C++ compiler.
CCFLAGS += -g -Wall -Wextra
CCFLAGS += $(DEFS)


TARGETS = iutest_all_tests \
          iutest_disabled_tests \
          iutest_filter_tests \
          iutest_help_tests \
          iutest_listener_tests \
          iutest_minimum_tests \
          iutest_no_test_tests \
          iutest_repeat_tests \
#          iutest_uninitialize_tests
          
OBJS   = $(TARGET:%=%.o)
SRCS   = $(TARGET:%=%.c)


# All iutest headers.  Usually you shouldn't change this
# definition.
IUTEST_HEADERS = $(IUTEST_DIR)/include/*.h \
                 $(IUTEST_DIR)/include/internal/*.h \
                 $(IUTEST_DIR)/include/listener/*.h

# House-keeping build targets.

default: $(TARGETS)

all : default test

test :
	@for i in $(TARGETS); do \
		./$$i.exe; \
	done
clean :
	rm -f $(TARGETS) *.o

# Builds a sample test.  

$(TARGETS) : $(SRCS) $(IUTEST_HEADERS) Makefile
	@for i in $(TARGETS); do \
		$(CC) $(CFLAGS) $(CCFLAGS) -c $$i.c; \
		$(CC) $$i.o -o $$i; \
	done
