# ==============================================================================
#  Makefile  for  D
# ==============================================================================
TARGET      = unittest.exe
MAKE        = make
DMD         = dmd.exe
#DFLAGS      = -O -w
DFLAGS      = -O -g -unittest -cov -w
INCLUDE     = -I../src
LIB         = ../sal.lib
#LIB         = ws2_32.lib

SOURCES     = $(wildcard src/*.d src/*/*.d src/*/*/*.d src/*/*/*/*.d)
BACKUP_OBJS = $(SOURCES:.d=.d~)
DOCDIR      = docs

OBJS        = $(SOURCES:.d=.obj)

.SUFFIXES: .d .obj

all: $(TARGET)
	cd ..; unittest/$(TARGET);mv *.lst unittest
	cat *.lst | grep covered

$(TARGET): $(OBJS)
	$(DMD) -of$(TARGET) $(OBJS) $(LIB)

.d.obj:
	$(DMD) -Dd$(DOCDIR) $(INCLUDE) -of$@ -c $(DFLAGS) $<

clean:
	rm -rf $(OBJS) $(BACKUP_OBJS) *.map $(TARGET) $(DOCDIR)/*.html
	rm -rf *.lst
	rm -rf *~

