# Makefile

# This line allows NMAKE to work as well MAKE
all: gdirsrcs.exe

# Defines
APP_name = GDIRSRCS     #### APP NAME GOES HERE ######
OBJS = $(APP_name).obj init.obj mainwnd.obj dlgprocs.obj dlgopen.obj icon.obj cur.obj bmp.obj
APP_LIBS = libw slibcew
NONDEBUG=1

!IFNDEF NONDEBUG
# Default to Debugging build
APP_compile = -c -W3 -AS -Gsw -Zipe -Od -D_WINDOWS
APP_link = /NOD /NOE /CO
MAPSYM = mapsym $(APP_name)
!ELSE
# Non-Debugging build
APP_compile = -c -W3 -AS -Gsw -Zpe -Os -D_WINDOWS
APP_link = /NOD /NOE
MAPSYM = 
!ENDIF


# Rules

# Update the object files if necessary
# Compile
.c.obj:
    cl $(APP_compile) $*.c

$(APP_name).obj: $(APP_name).c  $(APP_name).h  init.h  global.h

mainwnd.obj: mainwnd.c  mainwnd.h  dlgprocs.h global.h

init.obj: init.c  init.h  mainwnd.h  global.h

dlgopen.obj: dlgopen.c dlgopen.h global.h

icon.obj: icon.c icon.h global.h

cur.obj: cur.c cur.h global.h

bmp.obj: bmp.c bmp.h global.h

dlgprocs.obj: dlgprocs.c  dlgprocs.h

# Update the resource if necessary
$(APP_name).res: $*.rc  $(APP_name).ico  global.h
    rc -r $*.rc

# Update the executable file if necessary, and if so, add the resource back in
$(APP_name).exe: $(OBJS) $(APP_name).def
#   link $(APP_link) $(OBJS),,,$(APP_LIBS), $(APP_name).def
    link @<<
        $(APP_link) $(OBJS)


        $(APP_LIBS)
        $(APP_name).def
<<
   rc $*.res

# Update the executable file if the resource has changed
$(APP_name).exe: $(APP_name).res
    rc $*.res
