#
# MAKEFILE
# StatStrip Version 1.00, March 1993
#
# Copyright (c)1993 Microsoft Corporation, All Rights Reserved
#
# Kraig Brockschmidt, Software Design Engineer
# Microsoft Systems Developer Relations
#
# Internet  :  kraigb@microsoft.com
# Compuserve:  >INTERNET:kraigb@microsoft.com
#

#Add '#' to the next line for "noisy" operation
!CMDSWITCHES +s

#
#Compiler and assembler flags
#Use "SET RETAIL=1" from MS-DOS to compile non-debug version.
#
!ifndef RETAIL
CFLAGS  = -c -Od -AS -Zipe -G2s -W3 -GD -GEa
LINK    = /al:16/ONERROR:NOEXE/CO
DEFS    = -DSTRICT -DDEBUG
LIBS    = libw sdllcew
!else
CFLAGS  = -c -Oat -AS -Zpe -G2s -W3 -GD -GEa
LINK    = /al:16/ONERROR:NOEXE
DEFS    = -DSTRICT
LIBS    = libw sdllcew
!endif

TARGET=stastrip


.SUFFIXES: .h .c .obj .exe .cpp .res .rc

goal:  $(TARGET).lib

INCLS    = $(TARGET).h statint.h

OBJS1    = $(TARGET).obj init.obj
OBJS2    =
OBJS     = $(OBJS1) $(OBJS2)


RCFILES1 = $(TARGET).rcv
RCFILES2 =
RCFILES  = $(RCFILES1) $(RCFILES2)


#
# Tool Directives
#


.c.obj:
    echo +++++++++
    echo COMPILING $*.c
    cl $(CFLAGS) $(DEFS) $*.c


.rc.res:
    echo +++++++++
    echo Compiling Resources
    rc -r $(DEFS) $*.rc


clean:
    rm *.obj
    rm *.res
    rm *.dll
    rm *.lib



#This rule builds a linker response file on the fly depending on debug flags
$(TARGET).dll : $(OBJS) $(TARGET).res $(TARGET).def
    echo ++++++++++
    echo Linking $@
    echo libentry.obj +                          > $(TARGET).lrf
    echo $(OBJS)                                >> $(TARGET).lrf

    echo $(TARGET).dll $(LINK)                  >> $(TARGET).lrf
    echo nul/li                                 >> $(TARGET).lrf
    echo $(LIBS)/NOD/NOE                        >> $(TARGET).lrf
    echo $(TARGET).def                          >> $(TARGET).lrf

    link @$(TARGET).lrf
    rc -v $(TARGET).res $(TARGET).dll
    del $(TARGET).lrf


$(TARGET).lib: $(TARGET).dll
    implib $(TARGET).lib $(TARGET).def

##### Dependencies #####
$(TARGET).obj  : $(TARGET).c    $(INCLS)
init.obj       : init.c         $(INCLS)
$(TARGET).res  : $(TARGET).rc   $(INCLS) $(RCFILES)
