# ==============================================================================
#  Makefile  for  D
# ==============================================================================
TARGET       = sdl-sample.exe
DMD          = dmd.exe
DFLAGS       = -O -unittest -w
LDFLAGS      = -L/exet:nt -L/su:windows
INCLUDES     = -Iimport
LIBS         = lib/SDL.lib lib/SDL_image.lib lib/SDL_mixer.lib lib/SDL_ttf.lib

SOURCES      = $(wildcard src/*.d src/*/*.d src/*/*/*.d src/*/*/*/*.d)
DOCDIR       = docs
OBJS         = $(SOURCES:.d=.obj)
BACKUP_FILES = $(SOURCES:.d=.d~)

.SUFFIXES: .d .obj

all: $(TARGET)

$(TARGET): $(OBJS)
	$(DMD) -of$(TARGET) $(LDFLAGS) $(OBJS) $(LIBS)

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

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

