#----------------------------------------------------------------------------
# MAKEFILE for the BANDVIEW client
#
# SCCSID: src/osdd/omni/bandview/makefile nextbuild 97/10/14
#
# COMPONENT_NAME: OMNI
#
# FUNCTIONS: BANDVIEW CLIENT
#
# ORIGINS: Linked to os2
#
# (C) COPYRIGHT International Business Machines Corp. 1996
# All Rights Reserved
# Licensed Materials - Property of IBM
#
# US Government Users Restricted Rights - Use, duplication or
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
#----------------------------------------------------------------------------
# SUBSYS is a macro to define the name of the subsystem that this makefile is a
# part of.   It is the name of the subdirectory that is above all of the
# individual components.
#
# SUBSYS_RELATIVE is a macro to define the name of this component.
# SRC_RELATIVE is the full path for the current directory from the
# ROOT.
#
# This uses the substitution feature which takes the current directory of
# this makefile (MAKEDIR) and removes the relative part of the directory to
# get the TOP level directory.
#
# The other macros are used to build directories in other levels of the tree.
#------------------------------------------------------------------------------

DRIVER   = omni
CLIENT   = bandview
MAKEFILE = makefile
GPLNAME  = genplib
ECHO     = echo
DEL      = del
COPY     = copy
EA       = $(ROOT)\src\$(SUBSYS)\common\tools\rxea.cmd

#------------------------------------------------------------------------------
# Modified by:
# Description:  Makefile for BANDVIEW CLIENT
# Date       :  Oct 14, 1997
#------------------------------------------------------------------------------
# By default use the ibm visual age compiler.

!if "$(USE_IBMCPP)" == ""
!ifndef VACPP_VER
VACPP_VER       = v308
#VACPP_VER       = v36
!endif
COMP_VER_FLAG   = "VACPP_VER=$(VACPP_VER)"
!else
!undef VACPP_VER
COMP_VER_FLAG   = "USE_IBMCPP=1"
!endif

# This will adjust for either the older genplib name, or the
# Visual Age genplib name(genplibv).

!if "$(VACPP_VER)" != ""
GPLNAME_LIB     = genplibv
!else
GPLNAME_LIB     = genplib
!endif

SUBSYS          = osdd
SUBSYS_RELATIVE = $(DRIVER)\$(CLIENT)
SRC_RELATIVE    = src\$(SUBSYS)\$(SUBSYS_RELATIVE)
SRC_NL_RELATIVE = mri\$(NLV)\$(SUBSYS)\$(SUBSYS_RELATIVE)

USE_IBMC_LIB = 1

#------------------------------------------------------------------------------
#  Use built in macro "MAKEDIR" to establish "ROOT".  Due to case sensitivity
#  of nmake macro substitution, try all lowercase then all uppercase.  Fail if
#  current working directory path is mixed case.  This is a current nmake
#  limitation on macro substitutions but should not be a problem for most
#  people.  We are searching for a fix to this problem.
#------------------------------------------------------------------------------

ROOT            = $(MAKEDIR:\src\osdd\omni\bandview=)
!if "$(ROOT)" == "$(MAKEDIR)"
ROOT            = $(MAKEDIR:\SRC\OSDD\OMNI\BANDVIEW=)
!endif
!if "$(ROOT)" == "$(MAKEDIR)"
!error Problem setting "ROOT"! Make sure current working directory is either all\
       uppercase or all lowercase!
!endif

#-----------------------------------------------------------------
# Set up component/subsystem specific macros for use in header.mak
# This allows you establish a search order for header and lib paths.  A
# prefix would be a path that you would like to add to the beginning of
# the standard path which is set in header.mak.  A suffix tags onto the
# end of the standard path.
#-----------------------------------------------------------------

#CMP_HDR_PREFIX = <specify non-default path(s) for front of INCLUDE path>
CMP_HDR_PREFIX  = $(TOOLS2)\tcp\v30\include
#CMP_HDR_SUFFIX = <specify non-default path(s) for back INCLUDE path>
CMP_HDR_SUFFIX  = $(ROOT)\SRC\OSDD\$(GPLNAME);$(ROOT)\SRC\OSDD\CONTROLS;$(ROOT)\$(SRC_RELATIVE)
#CMP_LIB_PREFIX = <specify non-default path(s) for front of LIB path>
CMP_LIB_PREFIX  = $(TOOLS2)\tcp\v30\lib
#CMP_LIB_SUFFIX = <specify non-default path(s) for back LIB path>
CMP_LIB_SUFFIX  =

#-----------------------------------------------------------------------------
# PUBLIC can be one of "ibmmk", "cps","os2".  Please define the below macros
# if you want to include the public files in a different order.  These macros
# would be used if you have a preference as to which directory gets searched
# first.  For example, you would like to search the OS2 header or include
# files before you search the ibmmk header or include files.  In this case,
# you would specify PUBLIC1 = OS2 and PUBLIC2= IBMMK and PUBLIC3 = CPS.
# These macros are then used in header.mak to set the path order.
#------------------------------------------------------------------------------

PUBLIC1 = os2
#PUBLIC2 = ibmmk
#PUBLIC3 = ibmmk\pns_runtime
#PUBLIC4 = cps

#------------------------------------------------------------------------------
# HOST_PROC and HOST_OS will be set in the environment by the build lab.
# Set them in your private builds.
# Please don't set these variables in the public build.
# HOST_PROC=386
# HOST_OS=OS2
#-----------------------------------------------------------------------------

!ifndef HOST_PROC
HOST_PROC=386
HOST_OS=os2
!endif

#------------------------------------------------------------------------------
# header.mak is the public makefile that sets up all paths and options.  It
# should not be altered.  Additions or changes to header.mak for a component
# can be overwritten in this makefile.  Additions or changes to header.mak
# for an entire subsystem can be overwritten in subsys.mak
#-----------------------------------------------------------------------------

!include $(ROOT)\header.mak

!include $(ROOT)\src\$(SUBSYS)\common\version.mak

#-------------------------------------------------------------------------
# subsys.mak is used as a way for each subsystem to override any settings
# that were set in header.mak.  It is owned by development.
#-------------------------------------------------------------------------
!include $(ROOT)\src\$(SUBSYS)\common\subsys.mak

PRIV_HDR  = $(ROOT)\$(SRC_RELATIVE)

#-------------------------------------------------------------------------
# Insert any paths or macros that weren't defined in header.mak or
# subsys.mak here.
#--------------------------------------------------------------------------

MRIPATH = $(ROOT)\$(SRC_NL_RELATIVE)
OUTDIR  = $(DRIVERS_NLV)\$(DRIVER)
TOOLDIR = $(ROOT)\src\$(SUBSYS)\common\tools

!if "$(TARGET_PROC)"=="ppc"
GENPLIB = $(O)\..\..\$(GPLNAME)\$(NLV)\libgenp.a
!else
GENPLIB = $(O)\..\..\$(GPLNAME)\$(NLV)\$(GPLNAME_LIB).lib
!endif

#----------------------------------------------------------------
# Set up the list of suffixes, if the suffixes in header.mak are not
# sufficient.  Be sure to include the entire list.
#-----------------------------------------------------------------

.SUFFIXES:
.SUFFIXES: .c .cpp .asm .h .inc .obj .def .dll .lib .o .res .rc .drv .map .sym

#------------------------------------------------------------------------
# Please define all compiler, assembler, and linker flags here.
# Use if statement to define the flags for each type of builds.
# See $(ROOT)\src\$(SUBSYS)\common\subsys.mak for defines.
#------------------------------------------------------------------------

# PPC pragma defintions are:
#   88 - Expression has no side-effects.
#  257 - '=' encountered where '==' may have been intended.
#  290 - Static function is not referenced.
#  587 - Linkage pragma not supported yet.
#  652 - Variable is never used.

!if "$(TARGET_PROC)"=="ppc"
!    if "$(BLD_TYPE)"=="retail"
DBG_CFLAGS=
!    else
DBG_CFLAGS= -g
!    endif

CFLAGS = -c $(SYSTEM_CFLAGS) $(MW_IBMC_DEFS) $(DBG_CFLAGS) -o $@ -D_OS2 -DMACH \
         -DSWITCH -DINCL_32 -DWPOS_BLD -DIBMC -DPPC -DUNIX_BUILD -D__GNUASM \
         -DPOWERPC -DMETAWARE -DMACH_IPC_TYPED=0 $(CDEFINEFOREIGN) $(DDKBLD) \
         -Hpragma=Offwarn(88,257,290,587,652) -pic -Hon=Char_default_unsigned \
         -Hpragma=os_id(4) -HL -Hinlsize=300 -Hon=Char_is_rep
CFLAGSEXE = $(CFLAGS)
!else

!if "$(VACPP_VER)" != ""
WARN_CFLAGS    = /W3 /Wgen+ /Wext- /Wrea+ /Wuse+ /Wcnd+
!if (  ("$(VACPP_VER)" == "v304") \
    || ("$(VACPP_VER)" == "v306") \
    || ("$(VACPP_VER)" == "v308") \
    )
VACPP_CDEFINES = /D_V3_CRT_=1
!else
# cpprns36 does not have a run time library to init
VACPP_CDEFINES =
!endif
!else
WARN_CFLAGS    = /W3 /Kb+
VACPP_CDEFINES =
!endif

!    if "$(BLD_TYPE)"=="retail"
CDEFINES=/DINCL_32=1 $(CDEFINEFOREIGN) $(VACPP_CDEFINES)
ADEFINES=/DINCL_32=1 $(ADEFINEFOREIGN)
DBG_CFLAGS=
DBG_LFLAGS=
RET_CFLAGS= /O+
RET_LFLAGS= /PACKCODE
!    else
CDEFINES=/DDEBUG=1 /DINCL_32=1 $(CDEFINEFOREIGN) $(VACPP_CDEFINES)
ADEFINES=/DDEBUG=1 /DINCL_32=1 $(ADEFINEFOREIGN)
DBG_CFLAGS= /O- /Ti+
DBG_LFLAGS= /COD
RET_CFLAGS=
RET_LFLAGS=
!    endif

CFLAGSEXE = /c /Gd- /Gm+ /Q+ $(WARN_CFLAGS) /Ge+ /Fo$*.obj /Ms $(RET_CFLAGS) $(DBG_CFLAGS)
CFLAGS    = /c /Gd- /Gm+ /Q+ $(WARN_CFLAGS) /Ge- /Fo$*.obj /Ms $(RET_CFLAGS) $(DBG_CFLAGS)

!if "$(VACPP_VER)" != ""
LFLAGS    = /nod /map /noe $(RET_LFLAGS) $(DBG_LFLAGS) /IGnorecase
!else
LFLAGS    = /nod /map /noe $(RET_LFLAGS) $(DBG_LFLAGS)
!endif

LIBOS2    = $(R_OS2_LIB)\os2386.lib
LIBOS2P   = $(R_OS2_LIB)\os2386p.lib


!if "$(VACPP_VER)" != ""
!if (  ("$(VACPP_VER)" == "v304") \
    || ("$(VACPP_VER)" == "v306") \
    || ("$(VACPP_VER)" == "v308") \
    )
CLIBSEXE  = $(COMPILER_LIB)\cppom30.lib
!else
CLIBSEXE  = $(COMPILER_LIB)\cpprns36.lib  # cpiors40 cpiorn40 cpiorm40 cpprsi36 cpprni36 cpprmi36
!endif
!else
CLIBSEXE  = $(COMPILER_LIB)\dde4mbs.lib
!endif

TCPIPDLLS = so32dll.lib tcp32dll.lib
!endif

#--------------------------------------------------------------------------
# If the Inference rules defined in header.mak are not sufficient, then
# define the inference rules necessary at this point.
# The following inference rules are just an example.
# You can delete this section if you don't need to add more inference rules.
#-------------------------------------------------------------------------

.asm{$(O)}.obj:
        $(AS) $(ADEFINES) $(@B).asm,$(O)\$(@B).obj;

.asm.cod:
        $(AS) /l $(ADEFINES) $(@B).asm,nul;

.c{$(O)}.obj:
        $(CC) $(CDEFINES) $(DBG_CFLAGS) $(CFLAGS) $(@B).c

.cpp{$(O)}.obj:
        $(CC) $(CDEFINES) $(DBG_CFLAGS) $(CFLAGS) $(@B).cpp

.c.lst:
        $(CC) /C+ $(CDEFINES) $(DBG_CFLAGS) $(CFLAGS) /Fo- /Labejs $(@B).c

.cpp.lst:
        $(CC) /C+ $(CDEFINES) $(DBG_CFLAGS) $(CFLAGS) /Fo- /Labejs $(@B).cpp

.c.i:
        $(CC) /C+ $(CDEFINES) $(DBG_CFLAGS) $(CFLAGS) /Fo- /P+ $(*B).c

.cpp.i:
        $(CC) /C+ $(CDEFINES) $(DBG_CFLAGS) $(CFLAGS) /Fo- /P+ $(*B).cpp

.c.cod:
        $(CC) /C+ $(CDEFINES) $(DBG_CFLAGS) $(CFLAGS) /Fo- /Fa$(*B).cod $(*B).c

.cpp.cod:
        $(CC) /C+ $(CDEFINES) $(DBG_CFLAGS) $(CFLAGS) /Fo- /Fa$(*B).cod $(*B).cpp

{$(O)}.map{$(OUTDIR)}.sym:
        cd $(OUTDIR)
        $(MAPSYM) $(O)\$(@B).map
        $(EA) -e .VERSION=$(_VERSION21) $(@B).sym
        cd $(ROOT)\$(SRC_RELATIVE)

#------------------------------------------------------------------------
#Component defines start here. Example of som defines are attached in
#this template
#------------------------------------------------------------------------

LIBSEXE     = $(LIBOS2) $(CLIBSEXE) $(GENPLIB) $(TCPIPDLLS)

#             .                 .                 .
OBJ01       = $(O)\bandview.obj

#--------------------------------------------------------------------------

CLIENTOBJS = $(OBJ01)

#-----------------------------------------------------------------------------
# The all target is used to specify a list of targets that need to be built
#Please don't delete "dep" from the target list.  It is used to generate the
#depend.mak file
#Please look at the example for more details.
#-----------------------------------------------------------------------------

!if "$(TARGET_PROC)"=="ppc"
all: dep $(OUTDIR)\$(CLIENT).dll
!else
all: dep $(OUTDIR)\$(CLIENT).dll $(OUTDIR)\$(CLIENT).sym
!endif

!if "$(TARGET_PROC)"=="ppc"
nodep: $(OUTDIR)\$(CLIENT).dll
!else
nodep: $(OUTDIR)\$(CLIENT).dll $(OUTDIR)\$(CLIENT).sym
!endif

clean:
    del $(O)\*.* /N
    del $(O_NLV)\*.* /N

$(OUTDIR)\$(CLIENT).sym: $(O)\$(CLIENT).map

!if "$(TARGET_PROC)"=="ppc"
$(OUTDIR)\$(CLIENT).dll: makefile \
                         $(CLIENTOBJS) \
                         $(O)\$(CLIENT).def \
                         $(GENPLIB) \
                         $(COMMONLIB)
       $(CREATE_PATH)
       $(LINK) $(DLL_LFLAGS) @<<$(O)\$(CLIENT).lnk
$(DLL_INIT)
$(CLIENTOBJS: =^
)
$(HCLIB)
-L$(O)\..\$(GPLNAME)
-lgenp
$(CRT_VER_LIB)
-los2
-los2p
$(DLL_FINI)
-o $(OUTDIR)\$(@B).dll
-i $(O)\$(@B).def
<<keep
!else
$(OUTDIR)\$(CLIENT).dll: makefile \
                         $(CLIENTOBJS) \
                         $(O)\$(CLIENT).def \
                         $(GENPLIB) \
                         $(COMMONLIB)
       $(CREATE_PATH)
       $(LINK) $(LFLAGS) @<<$(O)\$(CLIENT).RSP
$(CLIENTOBJS:.obj=.obj+
)
$(OUTDIR)\$(CLIENT).dll
$(O)\$(CLIENT).map
$(LIBSEXE) $(COMMONLIB)
$(O)\$(@B).def
<<keep
!endif

$(O)\$(CLIENT).def: makefile
!if "$(VACPP_VER)" != ""
#Intel Visual Age build
       @echo Create DEF file <<$(O)\$(CLIENT).def
LIBRARY $(@B) INITINSTANCE TERMINSTANCE
DESCRIPTION     '$(FILEVER21) $(@B) bandview client'

PROTMODE

DATA MULTIPLE READWRITE LOADONCALL

CODE LOADONCALL

SEGMENTS
  Global      CLASS  'DATA' SHARED
  PerProcess  CLASS  'DATA' NONSHARED

EXPORTS
      BandPlugInCreate   = CreateInstance
      BandPlugInSendBand = SendBand
      BandPlugInDelete   = DeleteInstance
<<keep
!else
# Intel C-Set build
       @echo Create DEF file <<$(O)\$(CLIENT).def
LIBRARY $(@B) INITINSTANCE TERMINSTANCE
DESCRIPTION     '$(FILEVER21) $(@B) bandview client'

PROTMODE

DATA SINGLE READWRITE LOADONCALL

CODE LOADONCALL

SEGMENTS
  Global      CLASS  'DATA' SHARED
  PerProcess  CLASS  'DATA' NONSHARED

EXPORTS
      BandPlugInCreate   = CreateInstance
      BandPlugInSendBand = SendBand
      BandPlugInDelete   = DeleteInstance
!endif

#--------------------------------------------------------------------------

#***************************************************************************
# Include Footer.mak at this point.
#***************************************************************************

!include $(ROOT)\footer.mak

#****************************************************************************
#  Dependency generation and Checking
#****************************************************************************

# Includes is currently commented out for test purposes.

$(O)\depend.mak:  $(O)\dephold
        -$(CREATE_PATH)
        -makepath $(OUTDIR)
        -$(TOUCH) $(O)\depchk
        -echo generate depend.mak
#         includes -e -S$$(O) -I. -I$(COMPILER_HDR) -I$(R_PUB_HDR) *.c > $@
        makedep -A -DPS -TP $(O) $(HCINC:-I=-I ) -o $@ *.cpp
        -del $(O)\depchk

$(O)\dephold:
        -$(TOUCH) $@
