# Mcat Makefile

CXXFLAGS += -g -O0 -Wall -fPIC -I..
LDFLAGS  += -lpthread

TESTS =     test_buffer     test_common     test_mrl     test_ring_buffer     test_input_file     test_input_std     test_output_file     test_output_std     test_io_udp     test_io_tcp
TESTS_SRC = test_buffer.cpp test_common.cpp test_mrl.cpp test_ring_buffer.cpp test_input_file.cpp test_input_std.cpp test_output_file.cpp test_output_std.cpp test_io_udp.cpp test_io_tcp.cpp

all: check

OBJ = $(wildcard ../*.o)

$(TESTS): $(TESTS_SRC)
	$(CXX) $@.cpp -o $@ $(CXXFLAGS) $(LDFLAGS) $(OBJ)

check: prog $(TESTS)
	@./test_buffer
	@./test_common
	@./test_mrl
	@./test_ring_buffer
	@./test_input_file
	@./test_input_std
	@./test_output_file
	@./test_output_std
	@./test_io_udp
	@./test_io_tcp

clean:
	@rm -f mc $(TESTS)

prog:
	@cd .. && $(MAKE)

.PHONY: clean check prog
