# SCCSID = @(#)makefile 13.14 91/10/18
#******************************************************************************
#  Makefile for the Plotter directory
#
#       SCCSID = @(#)makefile   13.14 91/10/18
#
#       IBM/Microsoft Confidential
#
#       Copyright (c) IBM Corporation 1987, 1989
#       Copyright (c) Microsoft Corporation 1987, 1989
#
#       All Rights Reserved
#
#******************************************************************************
# example invocations of this makefile:
#    NMAKE debug=1       // builds debug version
#    NMAKE               // builds retail version
#    NMAKE perf=1        // builds performance version (page tuning)
#      NOTE: Prior to building, delete all OBJ files to ensure a clean build.
#****************************************************************************
#  Suffix Definition Area
#****************************************************************************

.SUFFIXES: .asm .c .def .dlg .dll .exe .lib .lst .obj .rc .res

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

#
# Conditional Setup Area and User Defined Macros
#

# PAGE_TUNE
# Page tuning is based on the retail version.  Remove the debug
# definition to ensure this.
!ifdef perf
!undef debug
!endif


#
# Compiler Location w/ includes, libs and headers
#
# NOTE: Because we want the next line line to end in a '\' we need to have the
# comment character '#' after the '\' character.  If '\' was the last character
# in the line then nmake would take that to mean line continuation!

ROOT          = $(MAKEDIR)\..\#            We want ROOT macro to end in '\'
H             = $(ROOT)h
VERH          = $(ROOT)src\h
H386          = $(ROOT)..\..\ibmc\cinclude
HIBM          = $(ROOT)ibmh
GENPLIBH      = $(ROOT)genplib
INC           = $(ROOT)inc
AINC          = $(ROOT)inc
HINC          = $(ROOT)inc
DEF           = plotters.def

!ifdef debug
LIB           = $(ROOT)\lib;$(ROOT)..\..\ibmcpp\lib;$(ROOT)genplib\debug\genplib;
!else
LIB           = $(ROOT)\lib;$(ROOT)..\..\ibmcpp\lib;$(ROOT)genplib\retail\genplib;
!endif

LIB386        = $(ROOT)..\..\ibmc\clib
DPATH         = $(ROOT)..\..\ibmc\chelp;$(DPATH)
#
# TOOLS
#
#TOOLSPATH    = $(ROOT)drf6\tools
TOOLSPATH     = $(ROOT)..\..\tools;$(ROOT)..\..\ibmc\cbin;

# PAGE_TUNE
TUNERBASE = $(ROOT)src\tuner

#
# MRI STUFF
#
MRI           = MRI
MRIPATH       = ..\..\..\$(MRI)\prntdd\plot32
COMMONMRIPATH = ..\..\..\$(MRI)\prntdd\drvmri


#
# Define macros for language. If the macro is NOT defined, the default
# value will be the US.
#

!ifndef LANG
LANG=us
!endif

#
# Since many the compiler/linker and related 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 instruction. All MAKEFILES
# are requested to use this format in insure that they are using the correct
# level of files and tools.
#

!if [set INCLUDE=$(HIBM);$(H);$(H386);$(INC);$(GENPLIBH);$(MAKEDIR)] || [set LIB=$(LIB386);$(LIB)] || [set PATH=$(TOOLSPATH)] \
    || [set IPFC=$(TOOLSPATH)] || [set DPATH=$(DPATH)]
!endif

#
# Compiler Macros
#

IMPLIB=implib
MAPSYM=mapsym
IPF=ipfc
LIBUTIL=lib
#
#

# CSet/2 Conversion
#Big=-B1 c1l.exe


#Original stuff xxxxxxxxxxxxxxxxxx
#===================================================================
#
#  Definitions and Constants
#
#===================================================================
#
RESNAM=pltus
RFLAGS= -r
RC=rc
#===================================================================
#
#       debug macros
#
#===================================================================
!ifdef debug
DBDEBUG=-DDEBUG=1  -DDEBUGK=1
!else
DBDEBUG=
!endif

!ifdef private
DPRIVATE=-DPRIVATE=1
!else
DPRIVATE=
!endif

#FDEBUG= -DFONTDEBUG=1
FDEBUG=
#CDEBUG= -DCOLORDEBUG=1
CDEBUG=

DEFS= $(MODE) -DHELP=1 -DIBM=1 -DHP=1 $(DBDEBUG) $(CDEBUG) $(FDEBUG) $(DPRIVATE)
# PAGE_TUNE
CINC= /I$(H386) /I$(HIBM) /i$(GENPLIBH) /I$(MAKEDIR) $(TUNERINC)


#CCD =-W3 -G2s -Zi -Od -Fc $(DEFS)
# added /Gh for profile stuff to debug
#CCD = /W3 /Ss+ /Gs+ /Ge- /Ti+ /O+ /Ms /Rn /Gd- /Gn+
#CCD = /W3 /Ss+ /Gs+ /Ge- /Ti+ /O+ /Ms /Fa$*.cod /Rn /Gd- /Gn+ /Gh+ $(DEFS)
#CCR =-W2 /Gs -Ox $(DEFS)
#CSet2 Conversion: do not use /O+ for now wait until we have debugged
#                  We have Ti+ in here for now to get all debug info
#CCR =/W2 /Ss+ /Gs+ /Ge- /O+ /Ms /Rn /Gd- /Gn+

# PAGE_TUNE
!ifdef perf
TUNERLIB  = $(TUNERBASE)\retail\tuner
TUNERINC  = /I$(TUNERBASE)
TUNEROPT  = /Gh+ /DPAGE_TUNE=1
TUNERLOPT = /PACKCODE
TUNERGPL  = perf
!else
TUNERGPL  = retail
!endif

!ifdef debug
CCFLAGS =/W3 /Ss+ /Gs+ /Ge- /Ti+ /O+ /Ms /Fa$*.cod /Rn /Gd- /Gn+ /Gh+ $(DEFS)
!else
CCFLAGS = /W2 /Ss+ /Gs+ /Ge- /O+ /Ms /Rn /Gd- /Gn+ $(DPRIVATE)
!endif

!ifdef debug
# Debug Link flags
# PAGE_TUNE
LFLAGS= /DE /Co /nod /map /noe /EXEPACK
!else
# Retail link flags
LFLAGS= /nod /map /noe /EXEPACK $(TUNERLOPT)
!endif

!ifdef debug
# Debug
LIBS= $(ROOT)lib\os2386 $(ROOT)lib\os2386p $(ROOT)..\..\ibmc\clib\dde4nbs \
      $(ROOT)genplib\debug\genplib
!else
# Retail
LIBS= $(TUNERLIB) $(ROOT)lib\os2386 $(ROOT)lib\os2386p \
      $(ROOT)..\..\ibmc\clib\dde4nbs $(ROOT)genplib\retail\genplib
!endif

LINK=link386
# PAGE_TUNE
CC=icc  $(TUNEROPT) /Q+ /C $(DEFS)
AINC= -I$(INC) -I$(MAKEDIR)
MASM=masm $(AINC) -DINCL_32
#MASM2=masm -D?LARGE -D?QUIET -DDOS5
#MASM3=masm -D?LARGE
#end original stuff

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

OBJ1= attribs.obj bitmap.obj bounds.obj \
      box.obj compress.obj chargen.obj \
      clip.obj color.obj devmode.obj \
      dispatch.obj band.obj

OBJ2= dosio.obj enable.obj escquery.obj \
      font.obj glib.obj init.obj \
      marker.obj outparc.obj outpline.obj

OBJ3= output.obj paths.obj plotters.obj \
      profile.obj textout.obj utils.obj \
      xforms.obj prdmath.obj  new.obj

# PAGE_TUNE
OBJ4= initterm.obj lockddc.obj forms.obj ptune.obj

OBJS= $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4)

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

# implicit build rules: to get a listing file of driver.c enter: nmake driver.lst
# implicit build rules: to get a preprocesses outfile enter: nmake driver.i

.c.lst:
        $(CC) $(CCFLAGS) /La+e+s+j+ $*.c

.c.i:
        $(CC) $(CCFLAGS) /P+ $*.c

.c.cod:
        $(CC) $(CCFLAGS) /Fa$*.cod $*.c

.asm.obj:
        $(MASM) $(AINC) $< ;

.c.obj:
        $(CC) $(CCFLAGS) $(CINC) $< ;

.rc.obj:
        $(RC) $(RFLAGS) $< ;

#****************************************************************************
#   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 a makefile with all the information about MRI Codepage, Language,
# and Country for IPFC.
#

!include "$(H)\preipfc.mak"

#
# Include a version
#
!include "$(H)\version.mak"

#
# Should be the default tag for all general processing
#
#       Rules for building .exe .com go here

# PAGE_TUNE
#
all:  gplperf killea  $(MRIPATH)\plotters.drv \
                      $(MRIPATH)\plotters.hlp

gplperf:
!ifdef perf
        cd $(GENPLIBH)
        nmake all perf=1
        cd $(MAKEDIR)
!endif


killea:
        if exist setea.cmd del setea.cmd

clean:
        if exist *.obj del *.obj
        if exist *.res del *.res
        if exist $(MRIPATH)*.res del $(MRIPATH)*.res
        if exist $(MRIPATH)*.drv del $(MRIPATH)*.drv
        if exist $(MRIPATH)*.sym del $(MRIPATH)*.sym
        if exist $(MRIPATH)*.hlp del $(MRIPATH)*.hlp
        if exist *.drv del *.drv
        if exist *.sym del *.sym
        if exist *.map del *.map
        if exist setea.cmd del setea.cmd

setea.cmd: ..\..\dos\task\header.inc
#   awk "/SCCS/{printf\"ea -e .VERSION=%%s plotters.drv\n\",$$5}" \
#       ..\..\dos\task\header.inc  >$@
#   awk "/SCCS/{printf\"ea -e .VERSION=%%s plotters.sym\n\",$$5}" \
#       ..\..\dos\task\header.inc  >>$@
    echo ea -e .VERSION=$(_VERSION21) PLOTTERS.drv   >setea.cmd
    echo ea -e .VERSION=$(_VERSION21) PLOTTERS.sym   >>setea.cmd
    echo ea -e VendorName=PLOTTERS                               PLOTTERS.Drv >> setea.cmd
    echo ea -e RequiredDriverFiles=PLOTTERS.DRV,PLOTTERS.HLP     PLOTTERS.Drv >> setea.cmd
    echo ea -e OptionalDriverFiles=PLOTTERS.SYM,                 PLOTTERS.Drv >> setea.cmd
    echo devnames -ePLOTTERS.Drv                                              >> setea.cmd
    echo ea                                                      PLOTTERS.Drv >> setea.cmd

#
# Specific MRI Targets Section
#

$(MRIPATH)\$(RESNAM).res: $(MRIPATH)\$(RESNAM).rc dialog.h \
                $(MRIPATH)\pltus.dlg $(MAKEDIR)\..\plotter.ico
       cd $(MRIPATH)
       copy $(MAKEDIR)\..\plotter.ico $(MRIPATH)\plotter.ico
       $(RC) $(RFLAGS) $(RESNAM).rc
       cd $(MAKEDIR)

#
# Create the Help Files
#


$(MRIPATH)\plotters.hlp: $(MRIPATH)\plotters.itl \
                $(COMMONMRIPATH)\common.itl
        cd $(MRIPATH)
        $(IPF) plotters.itl /l=$(L) /codepage=$(P) /country=$(C)
        cd $(MAKEDIR)


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

$(MRIPATH)\plotters.drv: plotters.drv

plotters.drv: makefile $(OBJS) \
  $(MRIPATH)\$(RESNAM).res plotters.def \
  setea.cmd $(MRIPATH)\plotters.hlp
  $(LINK) @<<$(@R).RSP
$(LFLAGS) +
$(OBJ1)+
$(OBJ2)+
$(OBJ3)+
$(OBJ4)
$(@)
$(*).MAP
$(LIBS)
$(*).def
<<keep
  $(RC) $(MRIPATH)\$(RESNAM).res $*.drv
  $(MAPSYM) $*.map
  setea
  copy $*.drv $(MRIPATH)
  copy $*.sym $(MRIPATH)

#===================================================================
#
#  Dependencies
#
#===================================================================

glib.obj: $*.asm

init.obj: $*.asm

#Int3.obj: $*.asm

new.obj: $*.asm
   $(MASM) $(AINC) $*.asm;

prdmath.obj: $*.asm
   $(MASM) $(AINC) $*.asm;

attribs.obj: $*.c
   $(CC) $(CCFLAGS) $(FDEBUG) $(CINC) $*.c

band.obj: $*.c
   $(CC) $(CCFLAGS)  $(CINC) $*.c

bitmap.obj: $*.c
   $(CC) $(CCFLAGS)  $(CINC) $*.c

bounds.obj: $*.c
   $(CC) $(CCFLAGS)  $(CINC) $*.c

box.obj: $*.c
   $(CC) $(CCFLAGS)  $(CINC) $*.c

chargen.obj: $*.c
   $(CC) $(CCFLAGS) $(FDEBUG)  $(CINC) $*.c

clip.obj: $*.c
   $(CC) $(CCFLAGS)  $(CINC) $*.c

color.obj: $*.c
   $(CC) $(CCFLAGS) $(CDEBUG)  $(CINC) $*.c

compress.obj: $*.c
   $(CC) $(CCFLAGS) $(FDEBUG)  $(CINC) $*.c

devmode.obj: $*.c
   $(CC) $(CCFLAGS)  $(CINC) $*.c

dispatch.obj: $*.c
   $(CC) $(CCFLAGS)  $(CINC) $*.c

dosio.obj: $*.c
   $(CC) $(CCFLAGS)  $(CINC) $*.c

enable.obj: $*.c
   $(CC) $(CCFLAGS)  $(CDEBUG)  $(CINC) $*.c

escquery.obj: $*.c
   $(CC) $(CCFLAGS) $(CINC) $*.c

font.obj: $*.c
   $(CC) $(CCFLAGS) $(FDEBUG) $(CINC) $*.c

marker.obj: $*.c
   $(CC) $(CCFLAGS) $(CINC) $*.c

outparc.obj: $*.c
   $(CC) $(CCFLAGS) $(CINC) $*.c

outpline.obj: $*.c
   $(CC) $(CCFLAGS) $(CINC) $*.c

output.obj: $*.c
   $(CC) $(CCFLAGS) $(CINC) $*.c

paths.obj: $*.c
   $(CC) $(CCFLAGS) $(CINC) $*.c

plotters.obj: $*.c
   $(CC) $(CCFLAGS) $(CINC) $*.c

profile.obj: $*.c
#  $(CC) $(CCFLAGS) -Alnu -NT_TEXT2 $(CINC) $*.c
   $(CC) $(CCFLAGS) $(CINC) $*.c

textout.obj: $*.c
   $(CC) $(CCFLAGS) $(FDEBUG) $(CINC) $*.c

utils.obj: $*.c
   $(CC) $(CCFLAGS) $(CINC) $*.c

xforms.obj: $*.c
   $(CC) $(CCFLAGS) $(CINC) $*.c

lockddc.obj: $*.c
   $(CC) $(CCFLAGS) $(DBDEBUG) $(CINC) $*.c

initterm.obj: $*.c
   $(CC) $(CCFLAGS) $(DBDEBUG) $(CINC) $*.c

forms.obj: $*.c
   $(CC) $(CCFLAGS) $(DBDEBUG) $(CINC) $*.c

# PAGE_TUNE
# Include '/Gh-' last to disable profiling or an error will occur.
ptune.obj: $*.c
   $(CC) $(CCFLAGS) $(DBDEBUG) $(CINC) /Gh- $*.c

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