# Makefile

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

# Defines
APP_name = STKTRACE
OBJS = $(APP_name).obj gettrace.obj getsym.obj 
APP_LIBS = libw toolhelp mlibcew

!IFNDEF NONDEBUG
# Default to Debugging build
APP_compile = -c -W3 -AM -G2s -Zipe -Od
APP_link = /NOD /NOL /M /CO /AL:16
MAPSYM = mapsym $(APP_name)
!ELSE
# Non-Debugging build
APP_compile = -c -W3 -AM -G2s -Zpe -Os
APP_link = /NOD /NOL /M /AL:16
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
gettrace.obj: gettrace.c
getsym.obj: getsym.c getsym.h

# Update the resource if necessary
$(APP_name).res: $*.rc $(APP_name).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 $(APP_name).res
   link $(APP_link) $(OBJS),,,$(APP_LIBS), $(APP_name).def
   mapsym $*
   rc -30 $*.res $*.exe

