# 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_assertion_only_tests \
          iutest_disabled_tests \
          iutest_env_var_tests \
          iutest_environment_tests \
          iutest_filter_tests \
          iutest_help_tests \
          iutest_listener_tests \
          iutest_minimum_tests \
          iutest_no_test_tests \
          iutest_repeat_tests \
          iutest_uninitialize_tests
          
OBJS   := $(TARGETS:%=%.o)
SRCS   := $(TARGETS:%=%.c)
EXES   := $(TARGETS:%=%.exe)


# 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

clean :
	rm -f $(EXES) *.o

test: $(EXES)

$(EXES) : $(TARGETS)
	@echo $@
	./$@

# Builds a sample test.  

$(TARGETS) : $(SRCS) $(IUTEST_HEADERS) Makefile
	$(CC) $(CFLAGS) $(CCFLAGS) -c $@.c
	$(CC) $@.o -o $@
