#******************************************************************************
#  Makefile for the VMOUSE directory
#
#       SCCSID = @(#)makefile	6.10 92/02/28
#
#       IBM/Microsoft Confidential
#
#       Copyright (c) IBM Corporation 1987, 1989
#       Copyright (c) Microsoft Corporation 1987, 1989
#
#       All Rights Reserved
#
#******************************************************************************

#
# ******  NOTE  ******
#
#
#        If you are using a SED command with TAB characters, many editors
#        will expand tabs causing unpredictable results in other programs.
#
#        Documentation:
#
#        Using SED command with TABS. Besure to invoke set tab save option
#        on your editor. If you don't, the program 'xyz' will not work
#        correctly.
#

!include ..\vdevsub.mak

#
# Conditional Setup Area and User Defined Macros
#

!ifdef DMAKE
MAKE=DMAKE
!endif


#
# Compiler and Linker Option changes from ..\VDEVSUB.MAK
#

#****************************************************************************
# Set up Macros that will contain all the different dependencies for the
# executables and dlls etc. that are generated.
#****************************************************************************

OBJ1=vmdata.obj vminit.obj vmuser.obj vmhook.obj vmdevrq.obj vmsysrq.obj
OBJ2=vmreset.obj vmptr.obj vmpos.obj vmbound.obj vmrate.obj
OBJ3=vmlpen.obj vmstate.obj vmmisc.obj vmevent.obj vmint15.obj vmio.obj

OBJSTUB=vmint330.obj

OBD1=vmdata.obd vminit.obd vmuser.obd vmhook.obd vmdevrq.obd vmsysrq.obd
OBD2=vmreset.obd vmptr.obd vmpos.obd vmbound.obd vmrate.obd
OBD3=vmlpen.obd vmstate.obd vmmisc.obd vmevent.obd vmint15.obd vmio.obd

OBJS= $(OBJSTUB) $(OBJ1) $(OBJ2) $(OBJ3)
OBDS= $(OBJSTUB) $(OBD1) $(OBD2) $(OBD3)

MRI=MRI
MRIPATH=..\..\..\$(MRI)

#****************************************************************************
#   Target Information
#****************************************************************************
#
# This is a very important step. The following small amount of code MUST
# NOT be removed from the program. The following directive will do
# dependency checking every time this component is built UNLESS the
# following is performed:
#                    A specific tag is used -- ie. all
#
# This allows the developer as well as the B & I group to perform incremental
# build with a degree of accuracy that has not been used before.
# There are some instances where certain types of INCLUDE files must be
# created first. This type of format will allow the developer to require
# that file to be created first. In order to achive that, all that has to
# be done is to make the DEPEND.MAK tag have your required target. Below is
# an example:
#
#    depend.mak:   { your file(s) } dephold
#
# Please DON'T remove the following line
#


#
# Should be the default tag for all general processing
#

all:    sys

inc:
        cd ..\..\..\inc
        $(MAKE) -c
        cd ..\src\vdev\vmouse

lib:
        cd ..\..\..\lib
        $(MAKE) -c vdh.lib
        cd ..\src\vdev\vmouse

sys:    mouse.c$(LANG) vmouse.sys  vmoused.sys

vdmp.inc:       vdmp.h
        tabify -d vdmp.h | sed -f $(TPATH)\h2inc32.sed | tabify >vdmp.inc

# Two-pass method to get VMINT33.OBJ  Pass 1 compiles the assembly code
# proper; pass two converts the output into another .ASM file which
# is compiled again, so that the stuff gets the right segment attributes.

vmint330.asm: vmint33.asm
              $(AS) $(AFLAGS) $(AINC) vmint33.asm,vmint33.obj,vmint33.lst;
              code2dat vmint33.lst vmint330.asm

vmint330.obj: vmint330.asm vmint33.h
        $(AS) $(AFLAGS) $(AINC) vmint330.asm,vmint330.obj;

mouse.i$(LANG): $(MRIPATH)\txt\oso001.msg vmint33.asm makefile
   msgprof vmint33.asm oso001.msg /asm /dos /txt /P$(MRIPATH)\txt /I..\..\..\inc
   msgextrt vmint33.pro
   mkmsgf vmint33.txt mouse.i$(LANG) /asm /I..\..\..\inc
   del vmint33.pro
   del vmint33.txt

mouse.c$(LANG): vmint33.asm mouse.i$(LANG)
          copy mouse.i$(LANG) mouse.inc
          $(AS) -DMOUSECOM $(AFLAGS) $(AINC) vmint33.asm,mouse.obj;
          $(LINK16) $(L16FLAGS) mouse,mouse;
          reloc mouse.exe mouse.com
          copy mouse.com mouse.c$(LANG)

clean:
        if exist *.obj del *.obj
        if exist *.obd del *.obd
        if exist *.stb del *.stb
        if exist *.lnk del *.lnk
        if exist *.sys del *.sys
        if exist *.sym del *.sym
        if exist *.exe del *.exe
        if exist *.com del *.com
        if exist *.lst del *.lst
        if exist *.lsd del *.lsd
        if exist *.ltb del *.ltb
        if exist *.cvk del *.cvk
        if exist *.sin del *.sin
        if exist *.map del *.map
        if exist *.old del *.old
        if exist *.hpl del *.hpl
        if exist *.hp2 del *.hp2
        if exist *.ppr del *.ppr
        if exist *.ppx del *.ppx
        if exist *.txt del *.txt
        if exist vmdp.inc del vmdp.inc


#*****************************************************************************
#   Specific Description Block Information
#*****************************************************************************

# This section would only be for specific direction as to how to create
# unique elements that are necessary to the build process. This could
# be compiling or assembling, creation of DEF files and other unique
# files.
# If all compiler and assembly rules are the same, use an inference rule to
# perform the compilation.
#

vmouse.sys: $(OBJS) $(LIBS) $(DEF) makefile
        $(LINK) $(LFLAGS) @<<$(@B).lnk
$(OBJSTUB) +
$(OBJ1) +
$(OBJ2) +
$(OBJ3)
$@
$*.map
$(LIBS)
$(DEF)
<<keep
        $(MAPSYM) $*.map

vmoused.sys: $(OBDS) $(LIBS) $(DEF) makefile
        $(LINK) $(LFLAGS) @<<$(@B).lnk
$(OBJSTUB) +
$(OBD1) +
$(OBD2) +
$(OBD3)
$@
$*.map /co
$(LIBS)
$(DEF)
<<keep
        $(MAPSYM) $*.map
        debstrip -o $*.cvk $@



#*****************************************************************************
#       List of documentation source files
#*****************************************************************************

mouse.hpl mouse.hp2 mouse.ppr mouse.ppx mouse.txt: ../../equate.sci mouse.doc \
        mseexk.sin mselok.sin \
        mseext.sin mselot.sin \
        mseexp.sin mseimp.sin mselop.sin \
        mouseisu.isu mousehis.sci

mouse2.doc: mouse.doc
        sed -e "s;:h3;:h1;" -e "s;:h4;:h3;" -e "s;:h5;:h4;" mouse.doc >mouse2.doc

mouse2.hpl mouse2.hp2 mouse2.ppr mouse2.ppx mouse2.txt: ../../equate.sci mouse2.doc \
        mseexk.sin mselok.sin \
        mseext.sin mselot.sin \
        mseexp.sin mseimp.sin mselop.sin \
        mouseisu.isu mousehis.sci

#       Document .sin dependencies

mseexk.sin:
        echo .fo off > vmdp.tmp
        echo .gml off >> vmdp.tmp
#       echo $$include ..\..\inc\vmdpmd.h, EK >> vmdp.tmp
        echo .gml on >> vmdp.tmp
        echo .fo on >> vmdp.tmp
        sinc vmdp.tmp > mseexk.sin
        -del vmdp.tmp

mselok.sin:
        echo .fo off > vmdp.tmp
        echo .gml off >> vmdp.tmp
#       echo $$include vmdp.h, LK >> vmdp.tmp
        echo .gml on >> vmdp.tmp
        echo .fo on >> vmdp.tmp
        sinc vmdp.tmp > mselok.sin
        -del vmdp.tmp

mseext.sin:
        echo .fo off > vmdp.tmp
        echo .gml off >> vmdp.tmp
#       echo $$include ..\..\inc\vmdpmd.h, ET >> vmdp.tmp
        echo .gml on >> vmdp.tmp
        echo .fo on >> vmdp.tmp
        sinc vmdp.tmp > mseext.sin
        -del vmdp.tmp

mselot.sin:
        echo .fo off > vmdp.tmp
        echo .gml off >> vmdp.tmp
#       echo $$include vmdp.h, LT >> vmdp.tmp
        echo .gml on >> vmdp.tmp
        echo .fo on >> vmdp.tmp
        sinc vmdp.tmp > mselot.sin
        -del vmdp.tmp

mseexp.sin:
        echo .fo off > vmdp.tmp
        echo .gml off >> vmdp.tmp
#       echo $$include vminit.c, EP >> vmdp.tmp
#       echo $$include vmuser.c, EP >> vmdp.tmp
        echo .gml on >> vmdp.tmp
        echo .fo on >> vmdp.tmp
        sinc vmdp.tmp > mseexp.sin
        -del vmdp.tmp

mseimp.sin:
        echo .fo off > vmdp.tmp
        echo .gml off >> vmdp.tmp
#       echo $$include ..\..\inc\vmdpmd.h, EP >> vmdp.tmp
        echo .gml on >> vmdp.tmp
        echo .fo on >> vmdp.tmp
        sinc vmdp.tmp > mseimp.sin
        -del vmdp.tmp

mselop.sin:
        echo .fo off > vmdp.tmp
        echo .gml off >> vmdp.tmp
#       echo $$include vminit.c, LP >> vmdp.tmp
#       echo $$include vmuser.c, LP >> vmdp.tmp
        echo .gml on >> vmdp.tmp
        echo .fo on >> vmdp.tmp
        sinc vmdp.tmp > mselop.sin
        -del vmdp.tmp


#****************************************************************************
