###################
#
# Deletions from the template are marked by ## at the start of the line
# Additions are marked #Start and #End
#
###################




#******************************************************************************
#  Makefile for the XGA 32 bit Display Driver
#
#       SCCSID = src/xga32/32bit/makefile, xga32, r205, 6421 92/07/16
#
#       IBM/Microsoft Confidential
#
#       Copyright (c) IBM Corporation 1987, 1989
#       Copyright (c) Microsoft Corporation 1987, 1989
#
#       All Rights Reserved
#
#
#    Change History:
#
#    06/04/93 - DCRTURBO (GAM/KJE) Added TurboStretching function to
#               improve image stretch performance.
#
#******************************************************************************

#******************************************************************************
#                       M R I   I N F O R M A T I O N
#******************************************************************************
#
# This makefile contains a template for creating a makefile with the
# MRI versions generation a part of it.
#
# It is our contention to eliminate having a makefile for both the source
# tree and one for each of the MRI trees. This makefile will show how to
# combine the two together and create a single makefile that will handle
# both the source and MRI parts.  If it is necessary to have a separate
# makefile for the MRI trees then it should reside in the parent source
# tree directory.
#
#****************************************************************************
#           E N D     O F     M R I     I N F O R M A T I O N
#****************************************************************************

# This is a makefile template to be used for an OS/2 Component makefile.
# The purpose of this template is to outline all the areas and items
# that need to be covered. The following are some of those items
#
#     Handle Non Specific Machine Layouts - This will make the makefile
#     -----------------------------------   more generic and portable
#                                           regardless of the development
#                                           tree. Macros should have
#                                           relative paths to information
#                                           in order for the makefiles to be
#                                           more portable.
#
#
#     National Language Support          -  The makefile will have to
#     -------------------------             support all national language
#                                           versions.  This applies to all
#                                           modules that will contain trans-
#                                           lations even if that translation
#                                           is not the result of specific MRI
#                                           which is part of the component.
#
#     Environment Setup                   - The makefile will setup the
#     -----------------                     environment (ie. paths to tools,
#                                           etc). This will insure that
#                                           people involved can use the
#                                           makefile without worrying
#                                           about their local environment.
#
#     Use of Inline Response Files        - The makefile will dynamically
#     ----------------------------          generate linker response files,
#                                           def files etc. to support NLS,
#                                           MMIO and other build variations.
#
# The following is a list of the order in which the makefile should be written.
#
#     Dot Directives - ie.
#        .SUFFIXES:
#        .SILENT:
#        .IGNORE:
#        .PRECIOUS:
#
#     Environment Setup
#        Conditional setup and user defined macros
#        Compiler Location w/ includes, libs and tools etc.
#        Compiler/tools Macros
#        Compiler/tools Options
#        Additional user defined macros
#
#      Rules for Compiling and assembling
#        .c.obj
#        .asm.obj
#        .exe.com
#
#      Common target information "common.mak" for dependency generation and
#      nls processing
#
#      User Target Information
#         all
#         debug
#
#      Specific Description Blocks
#
#      Description block for dynamic dependencies generation "depend.mak"
#
#      Indirect Dependencies for SOURCE "depend.mak"
#         .obj:   .c .h .inc
#
# It is very important to have the makefile in the above order to make both
# the developers job and the build departments job that much easier.
#
# ******  NOTE  ******
#
#   Please make sure that the MAKEFILE is documented. There have been many
#   occasions that someone other then people working on your component have
#   had a chance to inquire about what the dependencies are and what files
#   are created as a result.
#
#   The makefile should be a document in itself. It will discribe how to
#   to create the component. It is VERY inportant that any special
#   consideration be documented. The following is an example of a problem
#   and its documentation.
#
#        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.
#

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

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

#
# Conditional Setup Area and User Defined Macros
#

#
#   Define macro for language. If the language macro is not defined, the
#   default language is US.
#

!ifndef LANG
LANG=us
!endif

#start
#
#   Define the XGA specific bits
#

# this is the name of the current subdirectory (where this makefile is)
CURRENT=32bit

# Allow for builds of varoius versions (currently debug, retail, dekko)
# OBJ     is the directory below this one where the object files will go
# BUILD   is the build specific options for the masm / c compile lines
# XTRAOBJ is a list of extra files above those used in the retail build
#  Lines REPx are used by rep when building the .def file
#        \s is used by rep to signify a space character
# REP1    is the Module Versioning ID which is placed in the description field
# REP2    is an extra segment definition
# REP3    is an extra export definition
# REP4    is the type of build (debug | dekko | retail)

# Normally OBJ holds one of debug, retail or dekko.
# However before we envoke nmake recursively OBJ is undefined, so $(OBJ)\<file>
# is interpretted as \<file>, which breaks the include line at the end of
# this makefile.
# Thus we give OBJ a default value of the current directory.
OBJ=.

!ifdef DEBUG
OBJ=debug
BUILD=-DFIREWALLS -DDCAF -DXGA
#@IBMJ XTRAOBJ=
XTRAOBJ=$(OBJ)\32CALLBK.OBJ
REP2=\s
REP3=\s
REP4=DEBUG
DEFILE=XGA32.DEF
DRIVERNAME=IBMXGA32
INCL_DCAF =\s
!endif

!ifdef DEKKO
OBJ=dekko
BUILD=-DDEKKO -DDCAF -DXGA
#@IBMJ XTRAOBJ=$(OBJ)\dekko32.obj
XTRAOBJ=$(OBJ)\dekko32.obj $(OBJ)\32CALLBK.OBJ
REP2=_DEKKODATA\s\s\s\s\sCLASS\s'DATA'\sPRELOAD\sNONSHARED
REP3=\s
REP4=DEKKO
DEFILE=XGA32.DEF
DRIVERNAME=IBMXGA32
INCL_DCAF =\s
!endif

!ifdef RETAIL
OBJ=retail
BUILD=-DRETAIL -DDCAF -DXGA
#@IBMJ XTRAOBJ=
XTRAOBJ=$(OBJ)\32CALLBK.OBJ
REP2=\s
REP3=\s
REP4=RETAIL
DEFILE=XGA32.DEF
DRIVERNAME=IBMXGA32
INCL_DCAF =\s
!endif

!ifdef 8514R
OBJ=8514R
BUILD=-DRETAIL -D_8514
XTRAOBJ=$(OBJ)\32CALLBK.OBJ $(OBJ)\CACHEMAN.OBJ
REP2=\s
REP3=\s
REP4=RETAIL
DEFILE=8514_32.DEF
DRIVERNAME=8514_32
8514TAG =\s
!endif

!ifdef 8514D
OBJ=8514D
BUILD=-DFIREWALLS -D_8514
BUILD1=-D_8514
XTRAOBJ=$(OBJ)\32CALLBK.OBJ $(OBJ)\CACHEMAN.OBJ
REP2=\s
REP3=\s
REP4=DEBUG
DEFILE=8514_32.DEF
DRIVERNAME=8514_32
8514TAG =\s
!endif

!ifdef S3
OBJ=S3RETAIL
BUILD=-DRETAIL -D_8514 -DS3 -DBPP24 -DDCAF
XTRAOBJ=$(OBJ)\32CALLBK.OBJ $(OBJ)\MODEINFO.OBJ $(OBJ)\S3QESC.OBJ $(OBJ)\S3HWCRSC.OBJ $(OBJ)\CACHEMAN.OBJ
REP2=\s
REP3=\s
REP4=RETAIL
DEFILE=8514_32.DEF
DRIVERNAME=IBMS332
8514TAG =\s
INCL_DCAF =\s
!endif


# define the warning levels we want
CWARNINGS=-W3
#ASMWARNINGS=-W2
ASMWARNINGS=-W1

# LIBRARIES=os2386.lib + os2386p.lib + slibcep.lib                  #@IBMJ
LIBRARIES=os2386.lib + os2386p.lib + slibcep.lib + thunkrt.lib      #@IBMJ

Src=.
Res=32res
ObjToSrc=..
SrcToObj=$(OBJ)
SrcToRes=..\$(Res)
ResToSrc=..\$(CURRENT)
ResToLanguage=..\$(CURRENT)\$(OBJ)\$(LANG)
SrcToLanguage=$(OBJ)\$(LANG)
SrcToBVH=..\xgabvh20
BVHToSrc=..\$(CURRENT)
SrcToRing0=..\xgasys20
Ring0ToSrc=..\$(CURRENT)
LanguageToSrc=..\..
LanguageToRes=$(LanguageToSrc)\$(SrcToRes)
SrcToRoot=..\..\..
ObjToRoot=$(ObjToSrc)\$(SrcToRoot)
LanguageToRoot=$(LanguageToSrc)\$(SrcToRoot)

Hpath=$(SrcToRoot)\h
DRF6HGRE=$(SrcToRoot)\hgre
DRF6H=$(SrcToRoot)\h
DRF6H_DBCS=$(SrcToRoot)\h_dbcs

# this is a list of the .inc files which are made from corresponding .h files
H2INCFILES=cursor.inc eddconse.inc cacheman.inc

#end

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

H=$(DRF6HGRE);$(DRF6H_DBCS);$(DRF6H)
# INC=$(SrcToRoot)\incgre;$(SrcToRoot)\inc              #@IBMJ
INC=$(SrcToRoot)\incgre;$(SrcToRoot)\inc_dbcs;$(SrcToRoot)\inc;..\dbcslib     #@IBMJ
LIB=$(SrcToRoot)\libgre;$(SrcToRoot)\lib
# TOOLSPATH=$(SrcToRoot)\tools;$(ObjToRoot)\tools;$(LanguageToRoot)\tools                           #@IBMJ
TOOLSPATH=$(SrcToRoot)\..\tools;$(ObjToRoot)\..\tools;$(LanguageToRoot)\..\tools;$(SrcToRoot)\..\masm60\binp    #@IBMJ

##MRI=MRI
##MRIPATH=..\..\$(MRI)\{component name}
### Set the dpath to point to the translated oso0001.msg file first
##DPATH=..\..\$(MRI)\txt;$(DPATH)

#
# 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=$(INC);$(H)] || [set LIB=$(LIB)] || [set PATH=$(TOOLSPATH)] || \
    [set IPFC=$(TOOLSPATH)]
!endif


#
# Compiler/tools Macros
#

COMPILER=cl386
ASSEMBLER=masm
LINKER=link386
MAKE=nmake
ASM6=ml         #@IBMJ

#
# Compiler and Linker Options
#

AINC   = -I$(H) -I$(INC) -I$(MAKEDIR)
CINC   = -I$(H) -I$(INC) -I$(MAKEDIR)

#start

CFLAGS=-c -Zp -Zl -J -Owit -Gd -Gs -I$(Src) $(CWARNINGS) $(BUILD)
AFLAGS=-ml -D?SMALL32 -D?PLM=0 $(ASMWARNINGS) $(BUILD)
AFLAGSHARD=-DHARD_DRAW $(AFLAGS)
AFLAGSSOFT=-DSOFT_DRAW $(AFLAGS)
AFLAGSSOFT1=-ml -DSOFT_DRAW -D?SMALL32 -D?PLM=0 $(ASMWARNINGS) $(BUILD1)
LFLAGS=/nod /noe /map /exepack /align:4 /far
RCFLAGS=-x -p
# /Sa /Fl                                       #@IBMJ
# ASM6FLAGS= /Sa /Fl /c /Cp /Zi /Sg /DINCL_32   #@IBMJ
ASM6FLAGS= /c /Cp /Zi /Sg /DINCL_32             #@IBMJ
AFLAGS16=-ml -DDOS5 $(ASMWARNINGS) $(BUILD)     #@IBMJ

# All 32 bit code has been moved together in TEXT
CompileTEXT=/NT _TEXT $(CFLAGS) -DINCL_32

# setmode.c is 32 bit code, but it makes calls to the 16 bit VIO libraries.
# Thus it needs to be build with different options.
# Does NOT want to pick up the 32 bit headers in \DRF6\HGRE so override
# the PATH environment by specifying to look in \DRF6\H explicitly here.
Compile16=$(H16) /NT _TEXT $(CFLAGS) -I$(DRF6H_DBCS) -I$(DRF6H) -Gc -DINCL_16

#end

INCLUDESPARMS=-e -l -I. -I$(DRV6HGRE) -I$(DRV6H)  -I$(SrcToRoot)\incgre \
              -I$(SrcToRoot)\inc_dbcs -I$(SrcToRoot)\inc  -I..\dbcslib -P$$(H)=$(H) -P$$(H)=$(H)

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

#start
# these lines define all the objects which need linking
# note dyna32 must come first

OBJ0 =$(OBJ)\dyna32.obj   $(OBJ)\bitmaps.obj  $(OBJ)\errors.obj   $(OBJ)\convfuns.obj
OBJ1 =$(OBJ)\convext.obj  $(OBJ)\convint.obj  $(OBJ)\palette.obj  $(OBJ)\palman.obj
OBJ2 =$(OBJ)\drawbits.obj $(OBJ)\convert.obj  $(OBJ)\eddaatts.obj $(OBJ)\eddaclip.obj
OBJ3 =$(OBJ)\eddagetb.obj $(OBJ)\eddakern.obj $(OBJ)\eddapage.obj $(OBJ)\eddaptmk.obj
OBJ4 =$(OBJ)\eddarfnt.obj $(OBJ)\eddasetb.obj $(OBJ)\eddasetg.obj $(OBJ)\eddbcrea.obj
OBJ5 =$(OBJ)\eddbdelt.obj $(OBJ)\eddbgetb.obj $(OBJ)\eddbgetp.obj $(OBJ)\eddbimag.obj
OBJ6 =$(OBJ)\eddbsetp.obj $(OBJ)\eddbsubr.obj $(OBJ)\eddcctab.obj $(OBJ)\eddcdata.obj
OBJ7 =$(OBJ)\eddcqery.obj $(OBJ)\eddcqtab.obj $(OBJ)\eddcsubr.obj $(OBJ)\eddcursr.obj
OBJ8 =$(OBJ)\edddebug.obj $(OBJ)\edddtab.obj  $(OBJ)\eddeddc.obj  $(OBJ)\eddeedc.obj
OBJ9 =$(OBJ)\eddefpdb.obj $(OBJ)\eddenabl.obj $(OBJ)\edderset.obj $(OBJ)\edderstr.obj
OBJ10=$(OBJ)\eddesubr.obj $(OBJ)\eddeterm.obj $(OBJ)\eddevram.obj $(OBJ)\eddfbblt.obj
OBJ11=$(OBJ)\eddffast.obj $(OBJ)\eddfgchs.obj $(OBJ)\eddfimag.obj $(OBJ)\eddfline.obj
OBJ12=$(OBJ)\eddfscan.obj $(OBJ)\eddfshrt.obj $(OBJ)\eddgaccb.obj $(OBJ)\eddgaddb.obj
OBJ13=$(OBJ)\eddgcorr.obj $(OBJ)\eddgpick.obj $(OBJ)\eddgproc.obj $(OBJ)\eddhavio.obj
OBJ14=$(OBJ)\eddhdata.obj $(OBJ)\eddhgchs.obj $(OBJ)\eddhimag.obj $(OBJ)\eddhline.obj
OBJ15=$(OBJ)\eddhshrt.obj $(OBJ)\eddints.obj  $(OBJ)\eddldraw.obj $(OBJ)\eddlgetc.obj
OBJ16=$(OBJ)\eddlgrat.obj $(OBJ)\eddlpoly.obj $(OBJ)\eddlsetc.obj $(OBJ)\eddlseto.obj
OBJ17=$(OBJ)\eddmbits.obj $(OBJ)\eddmccrs.obj $(OBJ)\eddmcurs.obj $(OBJ)\eddmdead.obj
OBJ18=$(OBJ)\eddmlock.obj $(OBJ)\eddmres.obj  $(OBJ)\eddmtran.obj $(OBJ)\eddnaatx.obj
OBJ19=$(OBJ)\eddncach.obj $(OBJ)\eddndraw.obj $(OBJ)\eddneras.obj $(OBJ)\eddngchs.obj
OBJ20=$(OBJ)\eddphunk.obj $(OBJ)\eddqesc.obj  $(OBJ)\eddqqery.obj $(OBJ)\eddscan.obj
OBJ21=$(OBJ)\eddspoly.obj $(OBJ)\eddtesub.obj $(OBJ)\eddtpsub.obj
OBJ22=$(OBJ)\eddvcrec.obj $(OBJ)\eddvcstr.obj $(OBJ)\eddvsetf.obj $(OBJ)\eddvsrec.obj
OBJ23=$(OBJ)\eddvupdc.obj $(OBJ)\eddztrac.obj $(OBJ)\ffbltd.obj   $(OBJ)\ffbltpd.obj
OBJ24=$(OBJ)\ffbltsd.obj  $(OBJ)\ffbltset.obj $(OBJ)\fflines.obj  $(OBJ)\fontxfrm.obj
OBJ25=$(OBJ)\memman.obj   $(OBJ)\pixblt.obj   $(OBJ)\setmode.obj
OBJ26=$(OBJ)\update.obj   $(OBJ)\convbitm.obj $(OBJ)\eddadc.obj   $(OBJ)\eddaqery.obj $(OBJ)\eddbdata.obj
OBJ27=$(OBJ)\eddscnlr.obj $(OBJ)\eddvsubr.obj $(OBJ)\ffbltpx.obj
OBJ28=$(OBJ)\eddbphnk.obj $(OBJ)\eddbsele.obj $(OBJ)\eddcdith.obj $(OBJ)\edddata.obj
OBJ29=$(OBJ)\eddefldb.obj $(OBJ)\eddesave.obj $(OBJ)\eddfdata.obj $(OBJ)\eddfmess.obj
OBJ30=$(OBJ)\eddgconv.obj $(OBJ)\eddhbblt.obj $(OBJ)\eddhscan.obj $(OBJ)\eddlgeto.obj
OBJ31=$(OBJ)\eddlshrt.obj $(OBJ)\eddnbblt.obj $(OBJ)\eddnmark.obj
OBJ32=$(OBJ)\hwaccess.obj $(OBJ)\eddesres.obj $(OBJ)\eddqsres.obj $(OBJ)\init.obj
OBJ33=$(OBJ)\instance.obj $(OBJ)\flat2sel.obj $(OBJ)\seamthnk.obj $(OBJ)\seamless.obj
!ifdef  INCL_DCAF
OBJ34=$(OBJ)\scbounds.obj $(OBJ)\getscr.obj   $(OBJ)\setscr.obj   $(OBJ)\scrarea.obj
OBJ35=$(OBJ)\compress.obj $(OBJ)\expand.obj   $(OBJ)\dcafcnv.obj  $(OBJ)\dcafcnvt.obj
!else
OBJ34=
OBJ35=
!endif
#**********************************************************************/
## <DCRTURBO>  Add new module STRETCH.C                               */
#**********************************************************************/
#OBJ36=$(OBJ)\fudgepal.obj $(OBJ)\signatur.obj
OBJ36=$(OBJ)\fudgepal.obj $(OBJ)\signatur.obj $(OBJ)\stretch.obj
#!ifdef DBCS
OBJD1=$(OBJ)\eddjasub.obj $(OBJ)\eddjcach.obj $(OBJ)\eddjcp.obj   $(OBJ)\eddjfont.obj
OBJD2=$(OBJ)\eddjinit.obj $(OBJ)\eddjprof.obj $(OBJ)\eddjsub.obj  $(OBJ)\eddtqery.obj
OBJD3=$(OBJ)\dbcsfont.obj $(OBJ)\dbcsthnk.obj
OBJD4=$(OBJ)\viocga.obj   $(OBJ)\viomfi.obj   $(OBJ)\viodbcs.obj  $(OBJ)\vioepcl.obj $(OBJ)\vioepmn.obj
OBJD5=$(OBJ)\eddhsubr.obj $(OBJ)\mythunk.obj  $(OBJ)\viosubr.obj
OBJD6=$(OBJ)\viourcga.obj $(OBJ)\viourmfi.obj $(OBJ)\viourdbc.obj $(OBJ)\viourepo.obj
#!endif DBCS

# combine them into a single dependancy list

OBJS  = $(OBJ0)  $(OBJ1)  $(OBJ2)  $(OBJ3)  $(OBJ4)  $(OBJ5)  $(OBJ6)  \
        $(OBJ7)  $(OBJ8)  $(OBJ9)  $(OBJ10) $(OBJ11) $(OBJ12) $(OBJ13) \
        $(OBJ14) $(OBJ15) $(OBJ16) $(OBJ17) $(OBJ18) $(OBJ19) $(OBJ20) \
        $(OBJ21) $(OBJ22) $(OBJ23) $(OBJ24) $(OBJ25) $(OBJ26) $(OBJ27) \
        $(OBJ28) $(OBJ29) $(OBJ30) $(OBJ31) $(OBJ32) $(OBJ33) $(OBJ34) \
        $(OBJ35) $(OBJ36) \
        $(OBJD1) $(OBJD2) $(OBJD3) $(OBJD4) $(OBJD5) $(OBJD6) \
        $(XTRAOBJ)

# these lines add a plus continuation character for use by the linker

XTRAOBJP=$(XTRAOBJ) +

OBJ0P=$(OBJ0) +
OBJ1P=$(OBJ1) +
OBJ2P=$(OBJ2) +
OBJ3P=$(OBJ3) +
OBJ4P=$(OBJ4) +
OBJ5P=$(OBJ5) +
OBJ6P=$(OBJ6) +
OBJ7P=$(OBJ7) +
OBJ8P=$(OBJ8) +
OBJ9P=$(OBJ9) +
OBJ10P=$(OBJ10) +
OBJ11P=$(OBJ11) +
OBJ12P=$(OBJ12) +
OBJ13P=$(OBJ13) +
OBJ14P=$(OBJ14) +
OBJ15P=$(OBJ15) +
OBJ16P=$(OBJ16) +
OBJ17P=$(OBJ17) +
OBJ18P=$(OBJ18) +
OBJ19P=$(OBJ19) +
OBJ20P=$(OBJ20) +
OBJ21P=$(OBJ21) +
OBJ22P=$(OBJ22) +
OBJ23P=$(OBJ23) +
OBJ24P=$(OBJ24) +
OBJ25P=$(OBJ25) +
OBJ26P=$(OBJ26) +
OBJ27P=$(OBJ27) +
OBJ28P=$(OBJ28) +
OBJ29P=$(OBJ29) +
OBJ30P=$(OBJ30) +
OBJ31P=$(OBJ31) +
OBJ32P=$(OBJ32) +
OBJ33P=$(OBJ33) +
OBJ34P=$(OBJ34) +
OBJ35P=$(OBJ35) +
OBJD1P=$(OBJD1) +
OBJD2P=$(OBJD2) +
OBJD3P=$(OBJD3) +
OBJD4P=$(OBJD4) +
OBJD5P=$(OBJD5) +
OBJD6P=$(OBJD6) +
# the last one of these must NOT have a '+' at the end
OBJ36P=$(OBJ36)

#end

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

.asm{$(OBJ)}.obj:
        $(ASSEMBLER) $(AFLAGSHARD) $(@B).asm,$(@R).obj;

.c{$(OBJ)}.obj:
        $(COMPILER) $(CompileTEXT) -Fo$(OBJ)\$(@B).obj $(@B).c

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

#****************************************************************************
#   Module Versioning ID
#****************************************************************************
REP1=$(FILEVER)

#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
# NOTE: The above line will include a common makefile which will look like
# the following lines. This will allow the dependency checking to be
# global for all makefiles.  It will also set up the default targets which
# will allow for incremental as well as NLS builds.
#
# !if [ if exist depchk del depchk dephold depend.mak ] || \
#   [ if not exist depend.mak touch depend.mak & $(MAKE) -a depend.mak ]
# !endif
#
# Dependency Target Section
#
#
# dep:    depend.mak
#         -del dephold
#         $(MAKE) -$(MAKEFLAGS) all $(MAKEOPTS)
#
#
# Information about makefile and different areas of important information
#
#
# info:
#         cls
#         more < .\readme
#
#
# Perform General NLS Support Tags
#
#
# nls:    dk fr gr it nl no po sp su sv
#
#
# Specific NLS Country Tags
#
#
# dk fr gr it nl no po sp su sv:
#         -del dephold
#         $(MAKE) -$(MAKEFLAGS) LANG=$@ MRI=$@ all $(MAKEOPTS)
#
# This is just for template purposes.
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#
# Include a makefile with all the information about MRI Codepage, Language,
# and Country for IPFC.
#

!include "..\..\..\H\preipfc.mak"

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

default: all

#
# 'all' target is set to produce a RETAIL version of XGA (requires BVH and
# RING0) first so that BUILD group can begin cutting the RETAIL diskettes
# while the rest is still building
#

all: bvh ring0 retail 8514R S3
# @IBMJ all: bvh ring0 retail debug dekko 8514R 8514D S3
#all: retail 8514R S3    Defect 75458 Added all drivers back in for merge (line above)

# this allows for deleting all the built files, and building from sctatch
# the - at the start of each line means that these statements failing do no
# halt the build
clean:
    -del $(H2INCFILES)
    -del debug\*.obj
    -del debug\*.lnk
    -del debug\*.def
    -del debug\*.in
    -del debug\$(DRIVERNAME).*
    -del retail\*.obj
    -del retail\*.lnk
    -del retail\*.def
    -del retail\*.in
    -del retail\$(DRIVERNAME).*
    -del dekko\*.obj
    -del dekko\*.lnk
    -del dekko\*.def
    -del dekko\*.in
    -del dekko\$(DRIVERNAME).*
    -del 8514R\*.obj
    -del 8514R\*.lnk
    -del 8514R\*.def
    -del 8514R\*.in
    -del 8514R\*.sym
    -del 8514R\us\8514_32.*
    -del 8514D\*.obj
    -del 8514D\*.lnk
    -del 8514D\*.def
    -del 8514D\*.in
    -del 8514D\*.sym
    -del 8514D\us\8514_32.*
    -del $(SrcToRes)\xga32.res
    -del $(SrcToBVH)\*.obj
    -del $(SrcToRing0)\*.obj
    -del depend.mak
    $(MAKE) -F makefile all -$(MAKEFLAGS)

makeall: $(H2INCFILES) $(OBJ)\$(DRIVERNAME).tmp $(SrcToLanguage)\$(DRIVERNAME).dll

debug: resource
    if not exist debug md debug > nul 2>&1
    -del debug\signatur.obj > nul 2>&1
    $(MAKE) -F makefile LANG=$(LANG) DEBUG= makeall -$(MAKEFLAGS)

dekko: resource
    if not exist dekko md dekko > nul 2>&1
    -del dekko\signatur.obj > nul 2>&1
    $(MAKE) -F makefile LANG=$(LANG) DEKKO= makeall -$(MAKEFLAGS)

retail: resource
    if not exist retail md retail > nul 2>&1
    -del retail\signatur.obj > nul 2>&1
    $(MAKE) -F makefile LANG=$(LANG) RETAIL= makeall -$(MAKEFLAGS)

8514: 8514R 8514D

8514R: resource
    if not exist 8514R md 8514R > nul 2>&1
    -del 8514R\signatur.obj > nul 2>&1
    $(MAKE) -F makefile LANG=$(LANG) 8514R= makeall -$(MAKEFLAGS)

8514D: resource
    if not exist 8514D md 8514D > nul 2>&1
    -del 8514D\signatur.obj > nul 2>&1
    $(MAKE) -F makefile LANG=$(LANG) 8514D= makeall -$(MAKEFLAGS)

S3: resource
    if not exist S3RETAIL md S3RETAIL > nul 2>&1
    -del s3retail\signatur.obj > nul 2>&1
    $(MAKE) -F makefile LANG=$(LANG) S3= makeall -$(MAKEFLAGS)

########################################################################
#                                                                      #
#   This label allows us to easily count the lines of code             #
#                                                                      #
########################################################################
loc:
        echo *.c        >  loc.in
        echo *.h        >> loc.in
        echo *.asm      >> loc.in
        echo *.inc      >> loc.in
        echo DONE       >> loc.in
        echo XGA 32 bit driver Lines of Code Summary    >  loc.rpt
        echo Total:                                     >> loc.rpt
        echo +*.*                                       >> loc.rpt
        echo C code:                                    >> loc.rpt
        echo +*.h                                       >> loc.rpt
        echo +*.c                                       >> loc.rpt
        echo Assembler code:                            >> loc.rpt
        echo +*.asm                                     >> loc.rpt
        echo +*.inc                                     >> loc.rpt
        slocc loc.rpt -o report.loc < loc.in
        del loc.rpt
        del loc.in

#
# Specific Process Targets
#

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

########################################################################
#                                                                      #
# NOTE:                                                                #
#                                                                      #
#     These specific rules do not have full dependency information     #
#     associated with them.  However nmake is smart enough to combine  #
#     these rules with the full dependency information provided in the #
#     depend.mak file which is included later by this makefile.        #
#                                                                      #
########################################################################



########################################################################
#                                                                      #
#   This dependency allows .inc files to be generated from their       #
#   corresponding .h files.                                            #
#                                                                      #
########################################################################

cursor.inc: cursor.h banner.inc
  copy banner.inc cursor.inc
  h2inc -t -s $(Hpath)\os2def.h cursor.h >> cursor.inc

eddconse.inc: eddconse.h banner.inc
  copy banner.inc eddconse.inc
  h2inc -t -s $(Hpath)\os2def.h eddconse.h >> eddconse.inc

cacheman.inc: cacheman.h banner.inc
  copy banner.inc cacheman.inc
  h2inc -t -s $(Hpath)\os2def.h cacheman.h >> cacheman.inc

########################################################################
#                                                                      #
#   Assembler files using non default rules.                           #
#                                                                      #
########################################################################

$(OBJ)\palette.obj: palette.asm
  $(ASSEMBLER) $(AFLAGSHARD) -DWAIT_FLYBACK $(@B), $@;

#-------------------------------------------------------
# software drawing versions with hardware equivalents
#-------------------------------------------------------

$(OBJ)\eddfline.obj: eddhline.asm
  $(ASSEMBLER) $(AFLAGSSOFT) eddhline.asm, $@;

$(OBJ)\eddfimag.obj: eddhimag.asm
  $(ASSEMBLER) $(AFLAGSSOFT) eddhimag.asm, $@;

$(OBJ)\eddfbblt.obj: eddhbblt.asm
  $(ASSEMBLER) $(AFLAGSSOFT) eddhbblt.asm, $@;

$(OBJ)\eddfgchs.obj: eddhgchs.asm
  $(ASSEMBLER) $(AFLAGSSOFT) eddhgchs.asm, $@;

$(OBJ)\eddfaatx.obj: eddhaatx.asm
  $(ASSEMBLER) $(AFLAGSSOFT) eddhaatx.asm, $@;

$(OBJ)\eddfshrt.obj: eddhshrt.asm
  $(ASSEMBLER) $(AFLAGSSOFT) eddhshrt.asm, $@;

$(OBJ)\eddfscan.obj: eddhscan.asm
  $(ASSEMBLER) $(AFLAGSSOFT) eddhscan.asm, $@;

#-------------------------------------------------------
# software drawing versions with no hardware equivalents
#-------------------------------------------------------

$(OBJ)\eddffast.obj: eddffast.asm
  $(ASSEMBLER) $(AFLAGSSOFT) $(@B).asm, $@;

$(OBJ)\fflines.obj: fflines.asm
  $(ASSEMBLER) $(AFLAGSSOFT) $(@B).asm, $@;

$(OBJ)\ffbltsd.obj: ffbltsd.asm
  $(ASSEMBLER) $(AFLAGSSOFT) $(@B).asm, $@;

$(OBJ)\ffbltd.obj: ffbltd.asm
  $(ASSEMBLER) $(AFLAGSSOFT) $(@B).asm, $@;

$(OBJ)\ffbltpx.obj: ffbltpx.asm
  $(ASSEMBLER) $(AFLAGSSOFT) $(@B).asm, $@;

$(OBJ)\ffbltpd.obj: ffbltpd.asm
  $(ASSEMBLER) $(AFLAGSSOFT) $(@B).asm, $@;

$(OBJ)\ffbltset.obj: ffbltset.asm
  $(ASSEMBLER) $(AFLAGSSOFT) $(@B).asm, $@;

$(OBJ)\convert.obj: convert.asm
  $(ASSEMBLER) $(AFLAGSSOFT) $(@B).asm, $@;


#-------------------------------------------------------
# AVIO functions
#-------------------------------------------------------

$(OBJ)\viocga.obj: ..\dbcslib\viotext.asm
        $(ASSEMBLER) -DAVIO_CGA_TEXT $(AFLAGSHARD) ..\dbcslib\viotext.asm, $@;

$(OBJ)\viomfi.obj: ..\dbcslib\viotext.asm
        $(ASSEMBLER) -DAVIO_MFI_TEXT $(AFLAGSHARD) ..\dbcslib\viotext.asm, $@;

$(OBJ)\viodbcs.obj: ..\dbcslib\viotext.asm
        $(ASSEMBLER) -DAVIO_DBCS_TEXT $(AFLAGSHARD) ..\dbcslib\viotext.asm, $@;

$(OBJ)\vioepmn.obj: ..\dbcslib\viotext.asm
        $(ASSEMBLER) -DAVIO_EPOCH_MONO_TEXT $(AFLAGSHARD) ..\dbcslib\viotext.asm, $@;

$(OBJ)\vioepcl.obj: ..\dbcslib\viotext.asm
        $(ASSEMBLER) -DAVIO_EPOCH_COLOR_TEXT $(AFLAGSHARD) ..\dbcslib\viotext.asm, $@;


$(OBJ)\viourcga.obj: ..\dbcslib\viourect.asm
        $(ASSEMBLER) -DAVIO_CGA_TEXT $(AFLAGSHARD) ..\dbcslib\viourect.asm, $@;

$(OBJ)\viourmfi.obj: ..\dbcslib\viourect.asm
        $(ASSEMBLER) -DAVIO_MFI_TEXT $(AFLAGSHARD) ..\dbcslib\viourect.asm, $@;

$(OBJ)\viourdbc.obj: ..\dbcslib\viourect.asm
        $(ASSEMBLER) -DAVIO_DBCS_TEXT $(AFLAGSHARD) ..\dbcslib\viourect.asm, $@;

$(OBJ)\viourepo.obj: ..\dbcslib\viourect.asm
        $(ASSEMBLER) -DAVIO_EPOCH_TEXT $(AFLAGSHARD) ..\dbcslib\viourect.asm, $@;

$(OBJ)\viosubr.obj: ..\dbcslib\viosubr.asm
        $(ASSEMBLER) $(AFLAGSHARD) ..\dbcslib\viosubr.asm, $@;


$(OBJ)\dbcsfont.obj: ..\dbcslib\dbcsfont.asm
  $(ASM6) $(ASM6FLAGS) /Fo $@ ..\dbcslib\$(@B).asm

$(OBJ)\dbcsthnk.obj: ..\dbcslib\dbcsthnk.asm
  $(ASM6) $(ASM6FLAGS) /Fo $@ ..\dbcslib\$(@B).asm

#$(OBJ)\eddvsr16.obj: eddvsr16.asm
#  $(ASSEMBLER) $(AFLAGS16) $(@B).asm, $@;

$(OBJ)\mythunk.obj: ..\dbcslib\mythunk.asm
  $(ASM6) $(ASM6FLAGS) /Fo $@ ..\dbcslib\$(@B).asm

########################################################################
#                                                                      #
#   C files using non default rules.                                   #
#     (if you add a file here simply for debugging, then remember to   #
#      delete it when you are finished)                                #
#                                                                      #
########################################################################

!ifdef RETAIL
$(OBJ)\setmode.obj: setmode.c
  $(COMPILER) $(Compile16) -Fo$*.obj $(@B).c
!endif

!ifdef DEBUG
$(OBJ)\setmode.obj: setmode.c
  $(COMPILER) $(Compile16) -Fo$*.obj $(@B).c
!endif

!ifdef DEKKO
$(OBJ)\setmode.obj: setmode.c
  $(COMPILER) $(Compile16) -Fo$*.obj $(@B).c
!endif

# This leads to Alias errors reported by the linker
#  so remove this until I have more time to investigate! (MEB)
#$(OBJ)\instance.obj: instance.c
#  $(COMPILER) $(CompileTEXT) -ND _INSTANCE -Fo$(OBJ)\$(@B).obj $(@B).c

########################################################################
#                                                                      #
#   Resources                                                          #
#                                                                      #
########################################################################
resource:
  cd $(SrcToRes)
  $(MAKE)
  cd $(ResToSrc)

########################################################################
#                                                                      #
#   BVH                                                                #
#                                                                      #
########################################################################
bvh:
  cd $(SrcToBVH)
  $(MAKE)
  cd $(BVHToSrc)

########################################################################
#                                                                      #
#   Ring0                                                              #
#                                                                      #
########################################################################
ring0:
  cd $(SrcToRing0)
  $(MAKE)
  cd $(Ring0ToSrc)

########################################################################
#                                                                      #
#   Linking                                                            #
#                                                                      #
########################################################################

$(OBJ)\xga32.lnk: makefile
  cd $(SrcToObj)
  echo $(OBJ0P)                      >  xga32.lnk
  echo $(XTRAOBJP)                   >> xga32.lnk
  echo $(OBJ1P)                      >> xga32.lnk
  echo $(OBJ2P)                      >> xga32.lnk
  echo $(OBJ3P)                      >> xga32.lnk
  echo $(OBJ4P)                      >> xga32.lnk
  echo $(OBJ5P)                      >> xga32.lnk
  echo $(OBJ6P)                      >> xga32.lnk
  echo $(OBJ7P)                      >> xga32.lnk
  echo $(OBJ8P)                      >> xga32.lnk
  echo $(OBJ9P)                      >> xga32.lnk
  echo $(OBJ10P)                     >> xga32.lnk
  echo $(OBJ11P)                     >> xga32.lnk
  echo $(OBJ12P)                     >> xga32.lnk
  echo $(OBJ13P)                     >> xga32.lnk
  echo $(OBJ14P)                     >> xga32.lnk
  echo $(OBJ15P)                     >> xga32.lnk
  echo $(OBJ16P)                     >> xga32.lnk
  echo $(OBJ17P)                     >> xga32.lnk
  echo $(OBJ18P)                     >> xga32.lnk
  echo $(OBJ19P)                     >> xga32.lnk
  echo $(OBJ20P)                     >> xga32.lnk
  echo $(OBJ21P)                     >> xga32.lnk
  echo $(OBJ22P)                     >> xga32.lnk
  echo $(OBJ23P)                     >> xga32.lnk
  echo $(OBJ24P)                     >> xga32.lnk
  echo $(OBJ25P)                     >> xga32.lnk
  echo $(OBJ26P)                     >> xga32.lnk
  echo $(OBJ27P)                     >> xga32.lnk
  echo $(OBJ28P)                     >> xga32.lnk
  echo $(OBJ29P)                     >> xga32.lnk
  echo $(OBJ30P)                     >> xga32.lnk
  echo $(OBJ31P)                     >> xga32.lnk
  echo $(OBJ32P)                     >> xga32.lnk
  echo $(OBJ33P)                     >> xga32.lnk
  echo $(OBJ34P)                     >> xga32.lnk
  echo $(OBJ35P)                     >> xga32.lnk
  echo $(OBJD1P)                     >> xga32.lnk
  echo $(OBJD2P)                     >> xga32.lnk
  echo $(OBJD3P)                     >> xga32.lnk
  echo $(OBJD4P)                     >> xga32.lnk
  echo $(OBJD5P)                     >> xga32.lnk
  echo $(OBJD6P)                     >> xga32.lnk
  echo $(OBJ36P)                     >> xga32.lnk
  echo $(OBJ)\$(DRIVERNAME).tmp      >> xga32.lnk
  echo $(OBJ)\$(DRIVERNAME).map /m   >> xga32.lnk
  echo $(LIBRARIES)                  >> xga32.lnk
  echo $(OBJ)\xga32.def              >> xga32.lnk
  cd $(ObjToSrc)

$(OBJ)\xga32.def: xga32.def makefile
  cd $(SrcToObj)
  copy ..\$(DEFILE) xga32.def
  echo #1 $(REP1)  >  rep.in
  echo #2 $(REP2)  >> rep.in
  echo #3 $(REP3)  >> rep.in
  echo #4 $(REP4)  >> rep.in
  echo #5 $(DRIVERNAME)  >> rep.in
  rep -f rep.in xga32.def
  cd $(ObjToSrc)

$(OBJ)\$(DRIVERNAME).tmp: $(OBJS) $(OBJ)\xga32.def $(OBJ)\xga32.lnk
  $(LINKER) $(LFLAGS) @$(OBJ)\xga32.lnk
  cd $(SrcToObj)
  mapsym $(DRIVERNAME).map
  cd $(ObjToSrc)

$(OBJ)\$(LANG)\$(DRIVERNAME).dll: $(OBJ)\$(DRIVERNAME).tmp resource
  if not exist $(OBJ)\$(LANG) md $(OBJ)\$(LANG) > nul 2>&1
  cd $(SrcToLanguage)
  copy ..\$(DRIVERNAME).sym
  copy ..\$(DRIVERNAME).tmp $(DRIVERNAME).dll
  rc $(RCFLAGS) $(LanguageToRes)\xga32.res $(DRIVERNAME).dll
  cd $(LanguageToSrc)
  @echo $(REP1) PM Display Driver $(LANG) $(OBJ) version built

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