#******************************************************************************
#
#  Makefile for the svgapmi directory
#
#       IBM Confidential
#
#       Copyright (c) IBM Corporation 1991
#
#       All Rights Reserved
#
#  09/10/94  @V2.2TSU00  96178   Add module versioning-ID to base v executables
#  09/23/94  @V3.0YEE01          new S3 files for 864ICD and Lacuna
#******************************************************************************

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

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

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

H=..\..\h
H386=..\..\h386
IBMH=..\..\ibmh
INC=..\..\inc
LIB=..\..\lib
TOOLSPATH=..\..\tools

LOCALE  =..\..\ibmc\clocale
IBMCINC =..\..\ibmc\cinclude
IBMCLIB =..\..\ibmc\clib
IBMCBIN =..\..\ibmc\cbin
IBMCHELP=..\..\ibmc\chelp

CINC    = -I$(IBMH) -I$(H386) -I$(H) -I.
AINC    = -I. -I$(INC)
LIB386  = $(LIB)\os2386.lib
LIBP    = $(LIB)\os2386p.lib
LIBDDE  = $(IBMCLIB)\dde4mbs.lib $(IBMCLIB)\dde4mbso.lib
LIBS    = $(LIBDDE) $(LIB386) $(LIBP)

DPATH   = $(LOCALE);$(IBMCHELP);

!ifdef SVGADEBUG
OBJEXT  = obd
!else
OBJEXT  = obj
!endif

OBJPMI  = ipmidata.$(OBJEXT) ipmimain.$(OBJEXT) ipmimisc.$(OBJEXT)
OBJATI  = atimain.$(OBJEXT) #atidata.$(OBJEXT)
OBJS3   = s3864icd.$(OBJEXT) s3lacuna.$(OBJEXT) #s3main.$(OBJEXT) #s3data.$(OBJEXT)
OBJCIR  = cirmain.$(OBJEXT) cirdata.$(OBJEXT)
OBJS    = $(OBJPMI) $(OBJATI) $(OBJS3) #(OBJCIR)

#
# 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 HELP=$(IBMCHELP)] || \
    [SET LIB=$(IBMCLIB);$(LIB);.] || \
    [SET PATH=$(IBMCBIN);$(TOOLSPATH)] || \
    [SET INCLUDE=$(IBMCINC);$(IBMH);$(H386);$(H);$(INC);..]
!endif
#

#
# Compiler/tools Macros
#

CC=     icc
ASM=    masm
LINK=   link386

#
# Compiler and Linker Options
#

#CFLAGS= -nologo -c -W3 -Ox -G3sc -Asn -X $(CINC)
CFLAGS= /C+ /Ge- /Gm+ /Fm+ /Sp1 /Ss+ /O- /Gd- /Ms /Sr- /Se
AFLAGS= -Ml -t -Z -W1
LFLAGS= /noi /noe /map /nol /nod /exepack /packcode /packdata /nofar /align:32
TFLAGS= -y

#******************************************************************************
# 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.obd:
        $(ASM) $(AFLAGS) $(AINC) -DSVGADEBUG $*.asm,$@;

.asm.lst:
        $(ASM) -l -n $(AFLAGS) $(AINC) $*.asm,nul,$@;

.thk.asm:
        $(THUNK) $(TFLAGS) $*.thk $*.asm

.c.obj:
        $(CC) $(CFLAGS) -Fo$@ $*.c

.c.obd:
        $(CC) $(CFLAGS) -Fo$@ -DSVGADEBUG $*.c

.c.cod:
        $(CC) $(CFLAGS) -Fo$*.obj -Fc$@ $*.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
#******************************************************************************

debug:
    $(MAKE) all SVGADEBUG= LANG=db

all: ibmgpmi.d$(LANG) $(DDLIBS)

#******************************************************************************
#   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 dependant PMI handler
#------------------------------------------------------------------------

ibmgpmi.d$(LANG): $(OBJS) $(LIBS) $(DDLIBS) ibmgpmi.l$(LANG) ibmgpmi.def
                  $(LINK) $(LFLAGS) @ibmgpmi.l$(LANG);
                  mapsym $*

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

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

ibmgpmi.def: makefile
    @ECHO  >$@ LIBRARY $* INITGLOBAL
    @ECHO >>$@ PROTMODE
    @ECHO >>$@ DESCRIPTION '$(FILEVER) Generic Chip PMI-Handler'   ;@V2.2TSU00
    @ECHO >>$@ CODE LOADONCALL
    @ECHO >>$@ DATA LOADONCALL
    @ECHO >>$@ SEGMENTS
    @ECHO >>$@      CODE32 CLASS 'CODE' IOPL CONFORMING NONDISCARDABLE
    @ECHO >>$@ EXPORTS
    @ECHO >>$@      pfnPMIIdentifyAdapter       ;
    @ECHO >>$@      pfnPMISetMonitorTimings     ;
    @ECHO >>$@      pfnPMIFixupClock     ;
    @ECHO >>$@      pfnPMISetMode               ;
    @ECHO >>$@ ; $@ end of generated file (see makefile)


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