#%ARCHIVE = libdebugstream.a
#%DEPENDS = std_compat_header_wrapper iostream_extension fdstream system_call_wrapper posix_compat

CXX = ../../bin/g++w
MAKE_ARCHIVE = ../../bin/make-archive
RM = rm

INCLUDES = -I../std_compat_header_wrapper/include \
	   -I../iostream_extension/include \
	   -I../fdstream/include \
	   -I../system_call_wrapper/include

CXXFLAGS = -g $(CCXXOPTFLAGS) $(CXXOPTFLAGS) $(INCLUDES) \
	      $(CCXXADDITIONALFLAGS) $(CXXADDITIONALFLAGS)

LDFLAGS = $(LDADDITIONALFLAGS)


#all: libdebugstream.a
all: libdebugstream.a debugstream-performance-test

library: libdebugstream.a

library-lean: libdebugstream.a
	$(RM) -f *.o debugstream-test debugstream-performance-test

debugstream-test: libdebugstream.a debugstream-test.o
	$(CXX) -o debugstream-test debugstream-test.o libdebugstream.a \
		$(CXXFLAGS) $(LDFLAGS)

debugstream-performance-test: libdebugstream.a debugstream-performance-test.o
	$(CXX) -o debugstream-performance-test \
		debugstream-performance-test.o libdebugstream.a \
		$(CXXFLAGS) $(LDFLAGS)

libdebugstream.a: debugstream.o
	$(MAKE_ARCHIVE) libdebugstream.a debugstream.o

clean:
	$(RM) -f *.o libdebugstream.a \
		     debugstream-test debugstream-performance-test

.PHONY: all library library-lean clean


##
DEBUGSTREAM_H_DEPEND_HEADERS = debugstream.h asynchronousbuf.h nullbuf.h

debugstream.o: debugstream.cc $(DEBUGSTREAM_H_DEPEND_HEADERS)
debugstream-test.o: debugstream-test.cc $(DEBUGSTREAM_H_DEPEND_HEADERS)
debugstream-performance-test.o: debugstream-performance-test.cc \
				$(DEBUGSTREAM_H_DEPEND_HEADERS)
