# SCCSID = @(#)makefile 6.5 91/08/15
#******************************************************************************
#  Makefile for the didd directory
#
#       SCCSID = @(#)makefile   6.5 91/08/15
#
#       IBM/Microsoft Confidential
#
#       Copyright (c) IBM Corporation 1987, 1989
#       Copyright (c) Microsoft Corporation 1987, 1989
#
#       All Rights Reserved
#
#******************************************************************************

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


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


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

!IFNDEF MRI
MRI     = mri
!ENDIF

#DEBUG   = 1             # define to enable debugging
OS_VER  = 20            # o/s version
FIXED_T = FIXED_TEXT
MOVE1_T = MOVE1_TEXT
INIT_T  = INIT_TEXT
INIT_D  = INIT
CINC    = ..\touchh
AINC    = ..\touchinc
CDEP    = $(CINC)\toudefs.h $(CINC)\touasm.h $(CINC)\devhlp.h \
          $(CINC)\reqblk.h  $(CINC)\toutypes.h
ADEP    =
MRIPATH = ..\..\..\..\$(MRI)\TOUCH
MSG     = TDI           # message file name
MSGH    = TDIH          # message help file name
LIBS    = os2286 llibcdll
C_MODEL = -Alfw
C_OPT   = $(C_MODEL) -W3 -G2s -Zlp -Oid -FPa -I. -I$(CINC) -nologo -c \
                -DMT -DOS_VER=$(OS_VER) -DINCL_16
C_D_OPT = -Zi -DDEBUG
A_OPT   = /Mx /Ml /S /W2 /T
A_D_OPT = /ZI /DDEBUG
L_OPT   = /map /noi /nol /nod   # NB. Do not use /non or seg order broken
L_D_OPT = /co

H=..\..\..\..\h
INC=..\..\..\..\inc
LIB=..\..\..\..\lib
TOOLSPATH=..\..\..\..\tools
cc=cl
CC=CL

#
# Conditional Setup Area and User Defines Macros
#

!IFDEF  DEBUG
CFLAGS_DEBUG    = $(C_D_OPT)
AFLAGS          = $(A_OPT) $(A_D_OPT)
LFLAGS          = $(L_OPT) $(L_D_OPT)
!ELSE
CFLAGS_DEBUG    =
AFLAGS          = $(A_OPT)
LFLAGS          = $(L_OPT)
!ENDIF


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

#
# Compiler/tools Macros
#


#
# Compiler and Linker Options
#

CFLAGS_FIXED    = $(C_OPT) -NT$(FIXED_T)
CFLAGS_MOVE1    = $(C_OPT) -NT$(MOVE1_T)
CFLAGS_INIT_DATA = $(C_OPT) -NT$(INIT_T) -ND$(INIT_D)
CFLAGS_INIT_CODE = $(C_OPT) -NT$(INIT_T)


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

COBJS   = tdidata.obj tdifixed.obj touasm.obj devhlp.obj tdimove.obj\
                tdicinit.obj tdidinit.obj
AOBJS   = segdef.obj



#******************************************************************************
#   Setup the inference rules for compiling and assembling source code to
#   object code.
#******************************************************************************
#******************************************************************************
#   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
#


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


ALL:    touch.sys $(MSG).msg $(MSGH).msg

touch.sys: $(AOBJS) $(COBJS) makefile
        link $(LFLAGS) $(AOBJS:.obj=) $(COBJS:.obj=),$@,,$(LIBS),<<$(*).def ;
;
; $(*).DEF - Touch link definition file
;

LIBRARY $(*)

DESCRIPTION 'Touch Display Device Independant Driver Vers - 2.00'

PROTMODE

; Mark permanent segments with IOPL. (i.e. Keep after init done)
; All others will be discarded
; Make default for all segments

DATA    PRELOAD
CODE    PRELOAD

; These segment definitions must match those in SEGDEF.ASM & the 'C' compiler

SEGMENTS

; Main data segment in DGROUP (Always resides below 1M)
        _DATA           CLASS 'DATA'
        CONST           CLASS 'CONST'
        _BSS            CLASS 'BSS'
        c_common        CLASS 'BSS'
        FAR_BSS         CLASS 'FAR_BSS'
        LAST_DATA       CLASS 'LAST_DATA'

; Main code segment in CGROUP (Always resides below 1M)
        _TEXT           CLASS 'CODE'
        $(FIXED_T)      CLASS 'CODE'
        LAST_CODE       CLASS 'CODE'

; Movable segments in M1GROUP
        $(MOVE1_T)      CLASS 'CODE'            IOPL

; Specify init segments to get preload, position in exectable does not matter
; Use default definition, above, instead!
;       $(INIT_T)       CLASS 'CODE'
;       $(INIT_D)       CLASS 'FAR_DATA'
;       $(INIT_D)_CONST CLASS 'FAR_DATA'
;       $(INIT_D)_BSS   CLASS 'FAR_DATA'
;end
<<KEEP

        mapsym $(*) >nul

!IFDEF DEBUG
!IFDEF DS
        debstrip -o $(*).cvk $(*).sys
!ENDIF
!ENDIF

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


tdi.msg: $(MRIPATH)\$$(@B).txt
        mkmsgf $(MRIPATH)\$*.txt $*.msg
        copy $*.msg $(MRIPATH)\. > nul
        -erase $*.msg

tdih.msg: $(MRIPATH)\$$(@B).txt
        mkmsgf $(MRIPATH)\$*.txt $*.msg
        copy $*.msg $(MRIPATH)\. > nul
        -erase $*.msg

tdidata.obj:    $(CDEP) tdidata.c
        $(CC) $(CFLAGS_FIXED) $(CFLAGS_DEBUG) -Fo$@ tdidata.c

tdifixed.obj:   $(CDEP) tdifixed.c
        $(CC) $(CFLAGS_FIXED) $(CFLAGS_DEBUG) -Fo$@ tdifixed.c

tdimove.obj:    $(CDEP) tdimove.c
        $(CC) $(CFLAGS_MOVE1) $(CFLAGS_DEBUG) -Fo$@ tdimove.c

tdicinit.obj: $(CDEP) $(CINC)\tdierr.h tdicinit.c
        $(CC) $(CFLAGS_INIT_CODE) $(CFLAGS_DEBUG) -Fo$@ tdicinit.c

tdidinit.obj: $(CDEP) tdidinit.c
        $(CC) $(CFLAGS_INIT_DATA) $(CFLAGS_DEBUG) -Fo$@ tdidinit.c

touasm.obj:     $(CDEP) $$(@B).c
        $(CC) $(CFLAGS_FIXED) $(CFLAGS_DEBUG) $*.c

devhlp.obj:     $(INC)\devhlp.inc devhlp.asm
#devhlp.obj:     $(AINC)\devhlp.inc devhlp.asm
        $(AS)   $(AFLAGS) /I$(AINC) $*.asm;

segdef.obj:     segdef.asm
        $(AS)   $(AFLAGS) /I$(AINC) $*.asm;


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