NAME = play

#BUILD = DEBUG

.SILENT:

cc = cl -nologo -c
ccflags = -Ox -Ob0 -GR -GA -J -EHsc -I.
ccext = cpp

rc = rc
rcflags = -l0x409 -i.
rcext = $(rc)

link = link -NOLOGO 
linkflags = -LIBPATH:"$(LIB)"

GLEW = C:/Program Files/glew

OBJS =

RESS =

LIBS =

EXE = $(NAME)\$(NAME).exe

!include "math/makefile"
!include "graphics/makefile"
!include "sound/makefile"
!include "logic/makefile"
!include "$(NAME)/makefile"

OBJS = $(OBJS)\
  $(NAME)/$(NAME).obj\
  main.obj

!if "$(BUILD)"=="DEBUG"
linkflags = $(linkflags) -subsystem:CONSOLE
!else
linkflags = $(linkflags) -subsystem:WINDOWS
!endif

ALL: $(EXE)

RUN: ALL
	"$(MAKEDIR)\$(EXE)"

CLEAN:
	del /F/Q/S *.obj *.res *.exe

!if "$(OBJS)"!=""
$(OBJS): $*.$(ccext)
	$(cc) $(ccflags) -Fo$@ $*.$(ccext)
!endif

!if "$(RESS)"!=""
$(RESS): $*.$(rcext)
	$(rc) $(rcflags) -fo$@ $*.$(rcext)
!endif

$(EXE): $(OBJS) $(RESS)
	$(link) $(linkflags) /OUT:$@ $(OBJS) $(RESS) $(LIBS)

RELEASE: CLEAN ALL
	release $(NAME)
