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


!INCLUDE ..\makefile.inc

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

W16LIBS = ..\lib\sdllcew.lib

DEFINES = $(DEFINES) $(DBCS_FLAGS)


!if !$(FREEBUILD)
AOBJ    = $(AOBJ) -Zd
!endif

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

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


.c.obj:
    $(CL) -c -nologo $(CW16) $*.c

.c.lst:
    $(CL) -c -nologo $(CW16) -Fonul -Fc$*.lst $*.c


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

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

.rc{$(DEST)}.res:
    @set include=$(ENVINCS);$(INCLUDE)
    $(RC) -r -fo $@ $(*F).rc $(DEST)\$*


all: $(DEST)\system.drv $(DEST)\system.sym
    -binplace -o $(ALT_PROJECT_TARGET) $(DEST)\system.drv $(DEST)\system.map $(DEST)\system.sym


clean: cleanup all

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


$(DEST)\system.lrf: makefile.sub
    echo $(DEST)\system.obj $(DEST)\timer.obj >$(DEST)\system.lrf
    echo $(DEST)\system.exe/align:16>>$(DEST)\system.lrf
    echo $(DEST)\system $(LINKOPTS)>>$(DEST)\system.lrf
    echo ..\lib\$(ALT_PROJECT)\libw.lib /nod>>$(DEST)\system.lrf
    echo $(ALT_PROJECT)\system;>>$(DEST)\system.lrf

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

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

$(DEST)\system.res: system.rc ..\inc\common.ver
$(DEST)\system.drv: $(DEST)\system.obj $(DEST)\timer.obj $(DEST)\system.lrf $(DEST)\system.res
    $(LINK) @$(DEST)\system.lrf;
    $(RC) -t $(DEST)\system.res $(DEST)\system.exe
    if exist $(DEST)\*.drv del $(DEST)\*.drv
    ren $(DEST)\system.exe system.drv

$(DEST)\system.sym: $(DEST)\system.map


