#******************************************************************************
#
#  Makefile for the svdh directory
#
#       IBM Confidential
#
#       Copyright (c) IBM Corporation 1991
#
#       All Rights Reserved
#
#  MODIFICATIONS:
#
#  09/10/94  @V2.2TSU00  96178   Add module versioning-ID to base v executables
#  10/25/94  @V2.2TSU01 103322   Traps in loading
#  02/01/95  @V2.2TSU02 111227   ThinkPad ID mechanism doesn't work
#
#******************************************************************************

#******************************************************************************
#  Dot directive definition area (usually just suffixes)
#******************************************************************************

.SUFFIXES:
.SUFFIXES: .c .asm .obj .lst .def .lnk .exe .h .inc

#******************************************************************************
#  Environment Setup for the component(s).
#******************************************************************************

#
# Conditional Setup Area and User Defines Macros
#

!ifndef LANG
LANG=us
!endif

#
# Compiler Location w/ includes, libs and tools
#

DEBUG=0                 # DEBUG=1 => debug on; DEBUG=0 => debug off


H=..\..\h
INC=..\..\inc
LIB=..\..\lib
TOOLSPATH=..\..\tools

CINC    = -I$(H) -I.
AINC    = -I$(INC) -I.
LIB286  = $(LIB)\os2286.lib
#LIBP    = $(LIB)\os2286p.lib    @V2.2TSU01
LIBS    = $(LIB286) #$(LIBP)     @V2.2TSU01
VGADIR = ..\..\src\vdh
OBJS    = bvhmain.obj bvhmode.obj bvhsubs.obj bvhdata.obj bvhfont.obj\
          bvhinfo.obj bvhaccs.obj bvhiopl.obj
#
# buffer update
#
#VGAOBJS = xgabufup.obj xgaread.obj xgascrol.obj xgawrite.obj

#
# Since the compiler/linker and other tools use environment
# variables ( INCLUDE, LIB, etc ) in order to get the location of files,
# the following line will check the environment for the LIFE of the
# makefile and will be specific to this set of instructions. All MAKEFILES
# are requested to use this format to insure that they are using the correct
# level of files and tools.
#

!if [set INCLUDE=$(H);$(INC)] || [set LIB=$(LIB)] || [set PATH=$(TOOLSPATH)]
!endif
#

#
# Compiler/tools Macros
#

LOCAL = -DDEBUG=$(DEBUG)
CC=     cl
ASM=    masm
LINK=   link386

#
# Compiler and Linker Options
#

CFLAGS= -nologo -Zpl -Ot -Gs2 -W3 -Alfu -NT R2CSEG $(LOCAL)
AFLAGS= -Mx -t -Z -W2 $(LOCAL)
LFLAGS= /exepack /align:16 /map /noe /noignorecase /nodef

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


#******************************************************************************
#   Setup the inference rules for compiling and assembling source code to
#   object code.
#******************************************************************************

.asm.obj:
        $(ASM) $(AFLAGS) $(AINC) $*.asm;
.asm.lst:
        $(ASM) -l -n $(AFLAGS) $(AINC) $*.asm;
.c.obj:
        $(CC) $(CFLAGS) -Fo$*.obj -dos $(CINC) -c $*.c
.c.cod:
        $(CC) $(CFLAGS) -Fc$*.cod -Fo$*.obj -dos $(CINC) -c $*.c

#.h.inc:
#        tabify -d $*.h | sed -f $(TOOLSPATH)\h2inc32.sed | tabify >$*.inc


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

!include      "$(H)\version.mak"   #@V2.2TSU00

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

#all: bvhpmi.d$(LANG)
all: bvhsvga.d$(LANG)

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

#------------------------------------------------------------------------
# Build device independent BVH Filter for chaining
#------------------------------------------------------------------------

#
# buffer update
#bvhpmi.d$(LANG): $(OBJS) $(LIBS) bvhpmi.l$(LANG) bvhpmi.def $(VGAOBJS)
bvhsvga.d$(LANG): $(OBJS) $(LIBS) bvhsvga.l$(LANG) bvhsvga.def
                  $(LINK) @bvhsvga.l$(LANG);
                  mapsym $*

#
# The following create the linker list files, *.LNK, and the *.DEF files
# for the associated DLL dynamically when the MAKEFILE changes.
#

bvhsvga.l$(LANG): makefile
       @ECHO  >$@ $(OBJS) $(VGAOBJS)
       @ECHO >>$@ $*.d$(LANG)
       @ECHO >>$@ $*.map $(LFLAGS)
       @ECHO >>$@ $(LIBS)
       @ECHO >>$@ $*.def
       @ECHO >>$@ ; $@ end of generated file (see makefile)

bvhsvga.def: makefile
        @ECHO  >$@ LIBRARY $*   INITINSTANCE
        @ECHO >>$@ PROTMODE
        @ECHO >>$@ DESCRIPTION '$(FILEVER)  Super VGA Base Video Handler' ;@V2.2TSU00
        @ECHO >>$@ CODE LOADONCALL
        @ECHO >>$@ DATA LOADONCALL
        @ECHO >>$@ SEGMENTS
        @ECHO >>$@      R2SEG  CLASS 'CODE' PURE IOPL             ; Hardware I/O at ring 2
        @ECHO >>$@      R2CSEG CLASS 'CODE' PURE CONFORMING       ; Ring 3 or ring 2
        @ECHO >>$@      IMPORTS
        @ECHO >>$@          DOSSMGETMEM = OS2CHAR.1  ;@V2.2TSU01
        @ECHO >>$@          DOSSMFREEMEM = OS2CHAR.2 ;@V2.2TSU01
        @ECHO >>$@ EXPORTS
        @ECHO >>$@      DEVENABLE
        @ECHO >>$@      SETDIAMONDCLK     3 ;
        @ECHO >>$@      SETNUMBER9CLK     1 ;
        @ECHO >>$@      _WDPanelOn        0 ;   @V2.2TSU02
        @ECHO >>$@      _WDSetPanelClk    0 ;   @V2.2TSU02
        @ECHO >>$@      _ThinkPadHighestRes 0 ; @V2.2TSU02
        @ECHO >>$@      HWINPBYTE         1 ;
        @ECHO >>$@      HWINPWORD         1 ;
        @ECHO >>$@      HWOUTPBYTE        2 ;
        @ECHO >>$@      HWOUTPWORD        2 ;
        if "$(DEBUG)" == "1" @ECHO >>$@ DPRINTF 2 ;
        @ECHO >>$@ ; $@ end of generated file (see makefile)



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