#
# MAKEFILE
# GizmoBar Version 1.00, March 1993
#
# Copyright (c)1992 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 next line for "noisy" operation
!CMDSWITCHES +s


#
#Compiler and assembler flags
#Use "SET RETAIL=1" from MS-DOS to compile non-debug version.
#
#-GD -GEa

!ifndef RETAIL
CFLAGS  = -c -Od -AS -Zipe -G2sw -W3
LINK    = /al:16/ONERROR:NOEXE/CO
DEFS    = -DDEBUG
LIBS    = libw sdllcew bttncur
!else
CFLAGS  = -c -Oat -AS -Zpe -G2sw -W3
LINK    = /al:16/ONERROR:NOEXE
DEFS    =
LIBS    = libw sdllcew bttncur
!endif

TARGET=gizmobar


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

goal:  $(TARGET).lib

INCLS    = $(TARGET).h gizmoint.h gizmo.h

OBJS1    = $(TARGET).obj init.obj
OBJS2    = api.obj paint.obj gizmo.obj
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 *.dll
    rm *.res
    rm *.lib
    rm err


#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)
paint.obj      : paint.c        $(INCLS)
init.obj       : init.c         $(INCLS)
api.obj        : api.c          $(INCLS)
gizmo.obj      : gizmo.c        $(INCLS)


$(TARGET).res  : $(TARGET).rc   $(INCLS) $(RCFILES)
