#******************************************************************************
#  Makefile for the DSPINSTL directory
#
#       SCCSID = @(#)makefile   6.4 91/11/15
#
#       IBM/Microsoft Confidential
#
#       Copyright (c) IBM Corporation 1987, 1992
#
#       All Rights Reserved
#
#******************************************************************************

#******************************************************************************
#                       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.
#
#****************************************************************************
#  Suffix Definition Area
#****************************************************************************

.SUFFIXES:
.SUFFIXES: .asm .c .def .dlg .dll .exe .lib .lst .obj .rc .res .ipf .hlp .bas .obr

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

#
# Conditional Setup Area and User Defined Macros
#


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

ROOT=..\..\..
MRI=mri

#       Location of driver root for changing to/from MRI directory

MAKEDIR=$(ROOT)\src\cmd\svgainst

INSTPATH=..\..\INSTALL
IBMCPATH=$(ROOT)\ibmc\cbin
TOOLSPATH=$(ROOT)\tools;
IBMCDPATH=$(ROOT)\ibmc\cbin;$(ROOT)\ibmc\chelp
IDFPATH=..\..\IDF
INSTH=$(INSTPATH)\h
H=$(ROOT)\ibmc\cinclude;$(ROOT)\ibmh;$(INSTH);$(MAKEDIR);
IBMCINC=$(ROOT)\ibmc\cinclude;$(ROOT)\ibmh;
IBMCLIB=$(ROOT)\ibmc\clib
OS2LIB=$(ROOT)\lib
INSTLIB32=$(INSTPATH)\lib32
MRIPATH=$(ROOT)\$(MRI)\cmd\svgainst
ICONPATH=$(ROOT)\$(MRI)\icons

CINC = -I$(IBMCINC) -I$(H)
AINC = -I. -I$(ROOT)\inc -I$(ROOT)\src\vdh

APPNAME=plinst

#
# Define macros for language.
#

!ifndef LANG
LANG=us
!endif

!if [set INCLUDE=$(IBMCINC);$(H)] || [set LIB=$(IBMCLIB);$(OS2LIB)] \
    || [set PATH=$(IBMCPATH);$(TOOLSPATH)] || [set IPFC=$(TOOLSPATH)] \
    || [set DPATH=$(IBMCDPATH)]
!endif

#
# Compiler/tools Macros
#

CC=icc
MASM=masm
LINK386=link386
RC=rc
MAPSYM=mapsym
IPF=ipfc

# COMPILER AND LINKER OPTIONS

#debug
#CFLAGS    = /c /Gd- /Se /Re /ss /Ms /Gm+ /O- /D__MIG_LIB__ /Ti+
#non-debug
CFLAGS    = /c /Gd- /Se /Re /ss /Ms /Gm+ /O- /D__MIG_LIB__

#debug
#CDLLFLAGS = /c /Gd- /Se /ss /Ms /Ge- /Rn /D__MIG_LIB__ /Ti+
#non-debug
CDLLFLAGS = /c /Gd- /Se /ss /Ms /Ge- /Rn /D__MIG_LIB__

AFLAGS= -Mx -t -Z -L

#debug
#LFLAGS  = /NOE /NOD /ALIGN:16  /COD /M /EXEPACK
#non-debug
LFLAGS  = /NOE /NOD /ALIGN:16 /M /EXEPACK

RC_FLAGS= -r

#
#       Definitions of Libraries used in linking
#

INST32LIBS = $(INSTLIB32)\SHAPI32.LIB $(INSTLIB32)\INSCFG32.LIB
LIBS       = $(INST32LIBS) $(IBMCLIB)\DDE4MBS.LIB $(OS2LIB)\OS2386.LIB \
             $(OS2LIB)\OS2386P.LIB $(OS2LIB)\OS2286.LIB

STLIBS     = $(IBMCLIB)\DDE4SBS.LIB $(OS2LIB)\OS2386.LIB $(OS2LIB)\OS2386P.LIB
MTLIBS     = $(IBMCLIB)\DDE4MBS.LIB $(OS2LIB)\os2386.LIB \
             $(OS2LIB)\OS2386P.LIB

DLLLIBS = $(OS2LIB)\os2386.LIB $(OS2LIB)\OS2386P.LIB $(IBMCLIB)\DDE4MBS.LIB

#
#       Definition of object files needed to link
#

OBJ1 = dispmain.obj dispinit.obj dispdlg.obj dispwork.obj displog.obj dispprgs.obj
OBJ2 = dispdsp.obj dispmem.obj dbcs.obj specify.obj disphack.obj
OBJ3 = dispini.obj dispfile.obj dispcfg.obj dispinst.obj dispdcfg.obj
OBJ4 = dispdata.obj dispmisc.obj dispact.obj dispwini.obj disprun.obj
OBJ5 = dispgre.obj vdhiopl.obj  service.obj wrtplin.obj   autoexec.obj
MAINOBJS1 = $(OBJ1) $(OBJ2) $(OBJ3)
MAINOBJS2 = $(OBJ4) $(OBJ5)
RSPOBJ1   = disprsp.obr  dispinit.obr displog.obr  dispwork.obr dispmem.obr dbcs.obr
RSPOBJ2   = dispdcfg.obr dispdsp.obr dispfile.obr dispcfg.obr
RSPOBJ5   = dispini.obr  dispinst.obr dispvio.obr disphack.obr
RSPOBJ6   = dispdata.obr dispmisc.obr dispact.obr dispwini.obr disprun.obr
RSPOBJ7   = dispgre.obr  vdhiopl.obj  service.obr wrtplin.obr   autoexec.obr

RESPOBJS1  = $(RSPOBJ1) $(RSPOBJ2)
RESPOBJS2  = $(RSPOBJ5) $(RSPOBJ6) $(RSPOBJ7)

#CFGOBJS = cfgenvr.obj cfgupdt.obj cfgutil.obj

SVGAOBJS = svgainst.obj
S3SVGAOBJS = svga.obj
WINPRFOBJS = dispdcfg.obj dispwini.obj dispmem.obj winprf.obj

IPFS = $(MRIPATH)\dspinstl.ipf

RCS = $(MRIPATH)\dispmain.rc $(MRIPATH)\dispstrg.rc $(MRIPATH)\disphelp.rc \
      $(MRIPATH)\dispmain.dlg dispres.h $(ICONPATH)\install.ico \
      $(ICONPATH)\display.ico $(ICONPATH)\35.ico

RCS2 = $(MRIPATH)\svgainst.rc

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

.c.lst:
     $(CC) $(CDLLFLAGS) -Fc$*.lst -Fo$*.obj $(CINC) $*.c

.c.obj:
    $(CC) $(CDLLFLAGS) $(CINC) -Fo$*.obj $*.c

.c.obr:
    $(CC) $(CDLLFLAGS) $(CINC) -DRESPONSE_FILE -Fo$*.obr $*.c

.asm.obj:
    $(MASM) $(AFLAGS) $(AINC) -DVDHINIT=1 $*.asm;

.rc.res:
        $(RC) $(RC_FLAGS) $*.rc


.ipf.h$(LANG):
        $(IPF) $(MRIPATH)\*.ipf /l=$(L) /codepage=$(P) /country=$(C)

#
# 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 one of the
# following is performed:
#                         1. A specific tag is used -- ie. all
#                         2. That a file exists called dephold
#
# 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.
#
# Please DON'T remove the following lines
#



#
# Include a makefile with all the information about MRI Language (L=...),
# Codepage (P=...) and Country (C=...) for the ipfc compiler.
#

!include "$(ROOT)\h\preipfc.mak"

#****************************************************************************
#   Target Information
#****************************************************************************


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

all: svgainst.d$(LANG) svga.d$(LANG)

#
# Specific MRI Targets Section
#

#
# Creation procedure for DSPINSTL.HLP
#

dspinstl.h$(LANG): $(IPFS)
        cd $(MRIPATH)
        $(IPF) dspinstl.ipf /l=$(L) /codepage=$(P) /country=$(C)
        copy dspinstl.hlp $(MAKEDIR)\dspinstl.h$(LANG)
        cd $(MAKEDIR)

$(MRIPATH)\dispmain.res: $(RCS)
        cd $(MRIPATH)
        copy $(ICONPATH)\install.ico dspinstl.ico
        copy $(ICONPATH)\display.ico display.ico
        copy $(ICONPATH)\35.ico 35.ico
        $(RC) $(RFLAGS) -r dispmain.rc $(@F)
        cd $(MAKEDIR)


$(MRIPATH)\svgainst.res: $(RCS2)
        cd $(MRIPATH)
        $(RC) $(RFLAGS) -r svgainst.rc $(@F)
        cd $(MAKEDIR)

#
# Specific Process Tag
#

svgainst.d$(LANG): $(SVGAOBJS) $(DLLLIBS) $(MRIPATH)\svgainst.res makefile
#    $(CC) $(CDLLFLAGS) $(CINC) -Fo$*.obj $*.c
        rem Create DEF file -- <<$(@B).def
LIBRARY $(@B) INITINSTANCE TERMINSTANCE
DESCRIPTION 'OS/2 2.1 SVGA Display Driver Installation DLL'
EXPORTS
    Default_Primary
    Default_Secondary
    Selected_Primary
    Selected_Secondary
<<
        $(LINK386) $(LFLAGS) @<<$(@B).l$(LANG)
$(SVGAOBJS)
$@
$*.m$(LANG)
$(DLLLIBS)
$*.def
<<keep
        if "$(LANG)" == "us" $(MAPSYM) $*.mus
        $(RC) $(MRIPATH)\svgainst.res $@

#
#Build action dll for S3
#
svga.d$(LANG): $(S3SVGAOBJS) $(DLLLIBS) $(MRIPATH)\svgainst.res makefile
#    $(CC) $(CDLLFLAGS) $(CINC) -Fo$*.obj $*.c
        rem Create DEF file -- <<$(@B).def
LIBRARY $(@B) INITINSTANCE TERMINSTANCE
DESCRIPTION 'OS/2 2.1 S3 SVGA Display Driver Installation DLL'
EXPORTS
    Default_Primary
    Default_Secondary
    Selected_Primary
    Selected_Secondary
<<
        $(LINK386) $(LFLAGS) @<<$(@B).l$(LANG)
$(S3SVGAOBJS)
$@
$*.m$(LANG)
$(DLLLIBS)
$*.def
<<keep
        if "$(LANG)" == "us" $(MAPSYM) $*.mus
        $(RC) $(MRIPATH)\svgainst.res $@


#****************************************************************************
#  Clean up all built files
#****************************************************************************

clean:
        -del *.e$(LANG) *.obj *.m$(LANG) *.def *.l$(LANG) *.sym
        -del $(MRIPATH)\*.res *.h$(LANG) *.obr

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