TARGET = main.exe
BUILDDIR = build
SOURCES = main.cpp capture_file_writer.cpp tty_protocol_writer.cpp
OBJS = $(BUILDDIR)\main.obj $(BUILDDIR)\capture_file_writer.obj $(BUILDDIR)\tty_protocol_writer.obj
CXXFLAGS = /nologo /std:c++17 /EHsc /O2 /I.

all: $(TARGET)

$(TARGET): $(SOURCES)
	if not exist $(BUILDDIR) mkdir $(BUILDDIR)
	cl $(CXXFLAGS) /Fo$(BUILDDIR)\ /Fd$(BUILDDIR)\ /Fe$(TARGET) $(SOURCES)

rebuild: clean all

clean:
	-del /Q $(TARGET) 2>nul
	-if exist $(BUILDDIR) rmdir /S /Q $(BUILDDIR)

run-help: $(TARGET)
	$(TARGET) help
