# GDI16 makefile
#
# Copyright (c) 1991, Microsoft Corporation
#
# History:
#   26-Jan-1991 Jeff Parsons (jeffpar)
#   Created.
#


!INCLUDE ..\makefile.inc

DEFINES = $(DEFINES) -DBUILDDLL $(DBCS_FLAGS)

AOBJ    = -Mx -t $(DEFINES) $(INCS)

CW16    = -PLM -Asnw -G2sw $(DEFINES)
#CW16   = -AS -G2sw $(DEFINES)
CW16B   = $(CW16) -B1 c1l.exe -B2 c2l.exe -B3 c3l.exe

!if !$(FREEBUILD)
AOBJ    = $(AOBJ) -Zd
CW16    = $(CW16) /Odi /Zd
!else
CW16    = $(CW16) /Os /Zp
!endif

W16LIBS = ..\lib\snocrtd.lib ..\lib\$(ALT_PROJECT)\libw.lib


.asm.obj:
    $(ASM) $(AOBJ) $*;

.asm.lst:
    $(ASM) $(AOBJ) -l $*,nul,$*.lst;


.c.obj:
    @set include=$(ENVINCS);$(INCLUDE)
    $(CL) -c $(CW16) $*.c

.c.lst:
    @set include=$(ENVINCS);$(INCLUDE)
    $(CL) -c $(CW16) -Fonul -Fc$*.lst $*.c


.def.lib:
    implib $*.lib $*.def

.map.sym:
    cd $(DEST)
    mapsym gdi
    cd ..\..\..

.rc.res:
    @set include=$(ENVINCS);$(INCLUDE)
    $(RC) -r -fo $@ $*.rc

all: $(DEST)\gdi.exe $(DEST)\gdi.sym
    binplace -o $(ALT_PROJECT_TARGET) $(DEST)\gdi.exe
    binplace -o $(ALT_PROJECT_TARGET) $(DEST)\gdi.sym
    binplace -o $(ALT_PROJECT_TARGET) $(DEST)\gdi.map

clean: cleanup all

cleanup:
    if exist $(DEST)\*.lrf del $(DEST)\*.lrf
    if exist $(DEST)\*.obj del $(DEST)\*.obj
    if exist $(DEST)\*.exe del $(DEST)\*.exe
    if exist $(DEST)\*.map del $(DEST)\*.map
    if exist $(DEST)\*.sym del $(DEST)\*.sym
    if exist $(DEST)\*.res del $(DEST)\*.res


$(DEST)\gdi.obj: gdi.asm ..\..\inc\wow.inc ..\..\inc\wowgdi.inc
    $(ASM) $(AOBJ) gdi,$(DEST)\;

$(DEST)\sort.obj: sort.asm ..\..\inc\wow.inc ..\..\inc\wowgdi.inc
    $(ASM) $(AOBJ) sort,$(DEST)\;

$(DEST)\layer.obj: layer.asm ..\inc\layer.inc gdi.api
    $(ASM) $(AOBJ) layer,$(DEST)\;

$(DEST)\muldiv.obj: muldiv.asm
    $(ASM) $(AOBJ) muldiv,$(DEST)\;

$(DEST)\fontres.obj: fontres.c ..\..\inc\wow.h ..\..\inc\wowgdi.h
    @set include=$(ENVINCS);$(INCLUDE)
    $(CL) -c $(CW16) -Fo$(DEST)\ fontres.c


$(DEST)\gdi.lrf: makefile.sub
    echo $(DEST)\gdi.obj+$(DEST)\layer.obj+$(DEST)\muldiv.obj+$(DEST)\fontres.obj+$(DEST)\sort.obj >$(DEST)\gdi.lrf
    echo $(DEST)\gdi.exe>>$(DEST)\gdi.lrf
    echo $(DEST)\gdi $(LINKOPTS)>>$(DEST)\gdi.lrf
    echo $(W16LIBS) /nod>>$(DEST)\gdi.lrf
    echo $(ALT_PROJECT)\gdi;>>$(DEST)\gdi.lrf

$(DEST)\gdi.res: *.rc *.rcv ..\inc\common.ver
    @set include=$(ENVINCS);$(INCLUDE)
    $(RC) -r -fo $@ gdi.rc

$(DEST)\gdi.exe $(DEST)\gdi.map: $(DEST)\sort.obj $(DEST)\gdi.obj $(DEST)\gdi.lrf $(ALT_PROJECT)\gdi.def $(DEST)\layer.obj $(DEST)\muldiv.obj $(DEST)\fontres.obj $(DEST)\gdi.res
    $(LINK) @$(DEST)\gdi.lrf;
    $(RC) -t $(DEST)\gdi.res $(DEST)\gdi.exe


