# TOOLHELP.DLL for WOW makefile
#
# Copyright (c) 1992, Microsoft Corporation
#
# History:
#   4-Nov-1992 Dave Hart (davehart)
#   Created.
#

!INCLUDE ..\makefile.inc

#
# Macros for build utilities
#


#
# Command line options common to C compiler and assembler
#

INCLUDES = $(INCS) -I..\kernel31

.SUFFIXES: .asm

#
# C, MASM, Link16, and RC16 options
#


!if !$(FREEBUILD)
ADEBUG  = -Zd
CDEBUG  = /Od /Oi /Zd
LDEBUG  = /LI
!endif

!if "$(ALT_PROJECT)" == "NEC_98"
DEFINES=$(DEFINES) -DNEC_98
!endif

CFLAGS = -c -ASw -G2s -Oas -W3 -Zpe $(DEFINES) $(CDEBUG)
AFLAGS = -DmemS=1 -w2 $(DEFINES) $(INCLUDES) $(ADEBUG)
LFLAGS = /ALIGN:16 $(LDEBUG)
RFLAGS = $(INCLUDES)

#
# Libraries to link with.
#

W16LIBS = ..\lib\sdllcew.LIB ..\lib\$(ALT_PROJECT)\LIBW.LIB

#
# Target objects (keep in sync with dependencies below)
#

OBJS = $(DEST)\toolhelp.obj $(DEST)\dllentry.obj $(DEST)\global.obj $(DEST)\krnlpeek.obj \
       $(DEST)\walk386.obj $(DEST)\local.obj $(DEST)\module.obj $(DEST)\task1.obj $(DEST)\task2.obj $(DEST)\stack1.obj \
       $(DEST)\stack2.obj $(DEST)\usergdi1.obj $(DEST)\usergdi2.obj $(DEST)\memman.obj $(DEST)\helper.obj \
       $(DEST)\walk286.obj $(DEST)\notify1.obj $(DEST)\notify2.obj $(DEST)\int1.obj $(DEST)\int2.obj $(DEST)\terminat.obj \
       $(DEST)\signal.obj $(DEST)\memory.obj $(DEST)\timer.obj $(DEST)\ththunks.obj


#
# Common build pseudotargets:
#   all      builds everything - must be be first target in file
#   cleanup  deletes everything
#   clean    deletes & then builds everything
#

all: $(DEST)\toolhelp.dll $(DEST)\toolhelp.sym $(DEST)\toolhelp.map $(DEST)\toolhelp.lib
    -binplace -o $(ALT_PROJECT_TARGET) $(DEST)\toolhelp.dll
    -binplace -o $(ALT_PROJECT_TARGET) $(DEST)\toolhelp.map
    -binplace -o $(ALT_PROJECT_TARGET) $(DEST)\toolhelp.sym


clean: cleanup all

cleanup:
    if exist $(DEST)\*.obj del $(DEST)\*.obj
    if exist $(DEST)\*.dll del $(DEST)\*.dll
    if exist $(DEST)\*.map del $(DEST)\*.map
    if exist $(DEST)\*.sym del $(DEST)\*.sym
    if exist $(DEST)\*.res del $(DEST)\*.res
    if exist $(DEST)\*.lib del $(DEST)\*.lib
    if exist $(DEST)\stripped.def del $(DEST)\stripped.def

#
# Default build rules.
#

.c{$(DEST)}.obj:
    @set include=$(ENVINCS);$(INCLUDE);..\kernel31
    $(CL) $(CFLAGS) /Fo$* $(*F).c

.asm{$(DEST)}.obj:
    $(ASM) $(AFLAGS) $(@B).asm, $*.obj;

.asm{$(DEST)}.lst:
    $(ASM) $(AFLAGS) -l $(@B).asm,nul,$*.lst;

.rc{$(DEST)}.res:
    $(RC) $(RFLAGS) -r -fo $*.res $(*F).rc

.def{$(DEST)}.lib:
    $(IMPLIB) $@ $**

#
# Dependencies that use default build rules.
#

# NOTE:  Class1.c and Class2.asm are checked in for reference but are not
# ----   built for WOW.  Instead THTHUNKS.ASM contains thunks to WOW32.
#
# class1.obj: class1.c toolpriv.h toolhelp.h
# class2.obj: class2.asm toolpriv.inc toolhelp.inc
$(DEST)\dllentry.obj: dllentry.asm
$(DEST)\global.obj: global.c toolpriv.h toolhelp.h string.h
$(DEST)\helper.obj: helper.asm toolpriv.inc toolhelp.inc
$(DEST)\int1.obj: int1.c toolpriv.h toolhelp.h string.h
$(DEST)\int2.obj: int2.asm toolpriv.inc toolhelp.inc
$(DEST)\krnlpeek.obj: krnlpeek.asm toolpriv.inc toolhelp.inc
$(DEST)\local.obj: local.c toolpriv.h toolhelp.h
$(DEST)\memman.obj: memman.asm toolpriv.inc toolhelp.inc
$(DEST)\memory.obj: memory.asm toolpriv.inc toolhelp.inc
$(DEST)\module.obj: module.c toolpriv.h toolhelp.h string.h
$(DEST)\notify1.obj: notify1.c toolpriv.h toolhelp.h string.h
$(DEST)\notify2.obj: notify2.asm toolpriv.inc toolhelp.inc
$(DEST)\signal.obj: signal.c toolpriv.h toolhelp.h string.h
$(DEST)\stack1.obj: stack1.c toolpriv.h toolhelp.h string.h
$(DEST)\stack2.obj: stack2.asm toolpriv.inc toolhelp.inc
$(DEST)\task1.obj: task1.c toolpriv.h toolhelp.h string.h
$(DEST)\task2.obj: task2.asm toolpriv.inc toolhelp.inc
$(DEST)\terminat.obj: terminat.asm toolpriv.inc toolhelp.inc
$(DEST)\ththunks.obj: ththunks.asm ..\..\inc\wow.inc ..\..\inc\wowth.inc
$(DEST)\timer.obj: timer.asm toolpriv.inc toolhelp.inc
$(DEST)\toolhelp.obj: toolhelp.c toolpriv.h toolhelp.h
$(DEST)\usergdi1.obj: usergdi1.c toolpriv.h toolhelp.h
$(DEST)\usergdi2.obj: usergdi2.asm toolpriv.inc toolhelp.inc
$(DEST)\walk286.obj: walk286.asm toolpriv.inc toolhelp.inc
$(DEST)\walk386.obj: walk386.asm toolpriv.inc toolhelp.inc

#
# Targets with specialized build rules
#

$(DEST)\toolhelp.dll: $(OBJS) toolhelp.def
    $(LINK) $(LFLAGS) @<<
        $(DEST)\toolhelp + $(DEST)\dllentry + $(DEST)\krnlpeek + $(DEST)\global + $(DEST)\walk386 +
        $(DEST)\local + $(DEST)\module + $(DEST)\task1 + $(DEST)\task2 + $(DEST)\stack1 + $(DEST)\stack2 +
        $(DEST)\usergdi1 + $(DEST)\usergdi2 + $(DEST)\memman + $(DEST)\helper + $(DEST)\walk286 +
        $(DEST)\notify1 + $(DEST)\notify2 + $(DEST)\int1 + $(DEST)\int2 + $(DEST)\terminat + $(DEST)\signal +
        $(DEST)\memory + $(DEST)\timer + $(DEST)\ththunks
        $(DEST)\toolhelp.dll
        $(DEST)\toolhelp.map/map
        $(W16LIBS) /NOE/NOD
        toolhelp.def;

<<
    $(MAPSYM) -o $*.sym $(DEST)\toolhelp.map
    cd $(DEST)
    $(RC) /I..\..\..\..\inc -t -30 -fotoolhelp.res ..\..\..\toolhelp.rcv toolhelp.dll
    cd $(MAKEDIR)

$(DEST)\toolhelp.lib: toolhelp.def
    $(MKPUB) toolhelp.def $(DEST)\stripped.def
    $(IMPLIB) $(DEST)\toolhelp.lib $(DEST)\stripped.def