#******************************************************************************
#  Makefile for the VKBD directory
#
#       SCCSID = @(#)makefile	6.8 91/07/17
#
#       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
#


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

DEF     = ..\..\..\lib\vkbd.def

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

OBJS  = vkbd.obj vkbdint.obj vkbdbuf.obj vkbdio.obj vkbdreq.obj vpol.obj
OBDS  = vkbd.obd vkbdint.obd vkbdbuf.obd vkbdio.obd vkbdreq.obd vpol.obd
STUBS = vkbd.stb vkbdint.obj vkbdbuf.stb vkbdio.stb vkbdreq.obj vpol.obj


#****************************************************************************
#   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

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

sys:    vkbdd.sys vkbd.sys vkbdstub.sys

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 *.sin del *.sin
        if exist *.map del *.map
        if exist *.cvk del *.cvk
        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 *.stb del *.stb


#*****************************************************************************
#   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.
#

vkbd.sys: $(OBJS) $(LIBS) $(DEF) makefile
        $(LINK) $(LFLAGS) @<<$(@B).lnk
$(OBJS)
$@
$*.map
$(LIBS)
$(DEF)
<<keep
        $(MAPSYM) $*.map

vkbdd.sys: $(OBDS) $(LIBS) $(DEF) makefile
        $(LINK) $(LFLAGS) @<<$(@B).lnk
$(OBDS)
$@
$*.map /co
$(LIBS)
$(DEF)
<<keep
        $(MAPSYM) $*.map
        debstrip -o $*.cvk $*.sys

vkbdstub.sys: $(STUBS) $(LIBS) $(DEF) makefile
        $(LINK) $(LFLAGS) @<<$(@B).lnk
$(STUBS)
$@
$*.map
$(LIBS)
$(DEF)
<<keep
        $(MAPSYM) $*.map



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

kbd.hpl kbd.hp2 kbd.ppr kbd.ppx kbd.txt: $(DRV6)/src/equate.sci kbd.doc \
        kbdexk.sin kbdlok.sin \
        kbdext.sin kbdlot.sin \
        kbdexp.sin kbdimp.sin kbdlop.sin \
        kbdisu.isu kbdhis.sci

kbd2.doc: kbd.doc
        sed -e "s;:h3;:h1;" -e "s;:h4;:h3;" -e "s;:h5;:h4;" kbd.doc >kbd2.doc

kbd2.hpl kbd2.hp2 kbd2.ppr kbd2.ppx kbd2.txt: $(DRV6)/src/equate.sci kbd2.doc \
        kbdexk.sin kbdlok.sin \
        kbdext.sin kbdlot.sin \
        kbdexp.sin kbdimp.sin kbdlop.sin \
        kbdisu.isu kbdhis.sci

vpol.txt vpol.hpl vpol.hp2 vpol.ppr: vpol.doc  \
        ..\..\equate.sci ..\..\macros.sci


#       Document .sin dependencies

kbdexk.sin: $(DRV6)\h\vkbdpdd.h
        echo .fo off > kbd.tmp
        echo .gml off >> kbd.tmp
        echo $$include $(DRV6)\h\vkbdpdd.h, EK >> kbd.tmp
        echo .gml on >> kbd.tmp
        echo .fo on >> kbd.tmp
        sinc kbd.tmp > kbdexk.sin
        -del kbd.tmp

kbdlok.sin: vkbdp.h
        echo .fo off > kbd.tmp
        echo .gml off >> kbd.tmp
        echo $$include vkbdp.h, LK >> kbd.tmp
        echo .gml on >> kbd.tmp
        echo .fo on >> kbd.tmp
        sinc kbd.tmp > kbdlok.sin
        -del kbd.tmp

kbdext.sin: $(DRV6)\h\vkbdpdd.h
        echo .fo off > kbd.tmp
        echo .gml off >> kbd.tmp
        echo $$include $(DRV6)\h\vkbdpdd.h, ET >> kbd.tmp
        echo .gml on >> kbd.tmp
        echo .fo on >> kbd.tmp
        sinc kbd.tmp > kbdext.sin
        -del kbd.tmp

kbdlot.sin: vkbdp.h
        echo .fo off > kbd.tmp
        echo .gml off >> kbd.tmp
        echo $$include vkbdp.h, LT >> kbd.tmp
        echo .gml on >> kbd.tmp
        echo .fo on >> kbd.tmp
        sinc kbd.tmp > kbdlot.sin
        -del kbd.tmp

kbdexp.sin: vkbd.c vkbdint.c vkbdbuf.c vkbdio.c vkbdreq.c vpol.c
        echo .fo off > kbd.tmp
        echo .gml off >> kbd.tmp
        echo $$include vkbd.c, EP >> kbd.tmp
        echo $$include vkbdint.c, EP >> kbd.tmp
        echo $$include vkbdbuf.c, EP >> kbd.tmp
        echo $$include vkbdio.c, EP >> kbd.tmp
        echo $$include vkbdreq.c, EP >> kbd.tmp
        echo $$include vpol.c, EP >> kbd.tmp
        echo .gml on >> kbd.tmp
        echo .fo on >> kbd.tmp
        sinc kbd.tmp > kbdexp.sin
        -del kbd.tmp

kbdimp.sin: vkbd.c vkbdint.c vkbdbuf.c vkbdio.c vkbdreq.c
        echo :ul > kbdimp.sin
        qgrep -X "VDH[A-Za-z]*(" vkbd.c vkbdint.c vkbdio.c vkbdreq.c >1.tmp
        sed -e "s/.*\(VDH[A-Za-z]*(\).*/:li.\1)/" <1.tmp >2.tmp
        sort                                      <2.tmp >3.tmp
        uniq                                      <3.tmp >>kbdimp.sin
        echo :eul >> kbdimp.sin
        -del 1.tmp 2.tmp 3.tmp

kbdlop.sin: vkbd.c vkbdint.c vkbdbuf.c vkbdio.c vkbdreq.c vpol.c
        echo .fo off > kbd.tmp
        echo .gml off >> kbd.tmp
        echo $$include vkbd.c, LP >> kbd.tmp
        echo $$include vkbdint.c, LP >> kbd.tmp
        echo $$include vkbdbuf.c, LP >> kbd.tmp
        echo $$include vkbdio.c, LP >> kbd.tmp
        echo $$include vkbdreq.c, LP >> kbd.tmp
        echo $$include vpol.c, LP >> kbd.tmp
        echo .gml on >> kbd.tmp
        echo .fo on >> kbd.tmp
        sinc kbd.tmp > kbdlop.sin
        -del kbd.tmp

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