#******************************************************************************
#  Makefile for the SRC\DEV\KBD\IBMKBD directory
#
#       SCCSID = src/dev/kbd/ibmkbd.ssc/makefile, kbd, c.basedd 98/01/19
#
#       IBM/Microsoft Confidential
#
#       Copyright (c) IBM Corporation 1987, 1997
#       Copyright (c) Microsoft Corporation 1987, 1997
#
#       All Rights Reserved
#
# Change history:
# 212727 120398 an   Change /DBCSKBT to -DDBCSKBD
#******************************************************************************

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

.SUFFIXES:
.SUFFIXES: .asm .c .obj .lst .def .lnk .sym .sys

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

#
# Conditional Setup Area and User Defines Macros
#

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

H         = ..\..\..\..\h
INC       = ..\..\..\..\inc
LIB       = ..\..\..\..\lib
DHLIB     = ..\..\dasd\devhelp
RMLIB     = ..\..\resource\rmcalls
DISKH     = ..\..\dasd\diskh
USBH      = ..\..\usb\Include
TOOLSPATH = ..\..\..\..\tools

AINC      = -I. -I$(INC)
CINC      = -I. -I$(H) -I$(DISKH) -I$(USBH)

#
# 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);$(DISKH)]           || \
    [set LIB=$(LIB);$(DHLIB);$(RMLIB)]           || \
    [set PATH=$(TOOLSPATH)]
!endif

#
# Compiler/tools Macros
#

ASM    = masm
CC     = cl
LINK   = link
MAPSYM = mapsym

#
# Compiler and Linker Options
#

#CFLAGS = /c /W3 /Asnw /G2s /Zl /Zp /Osegli /Fc /nologo /DDEBUG
CFLAGS = /c /W3 /Asnw /G2s /Zl /Zp /Osegli /nologo
AFLAGS = -Ml -t -L -N
LFLAGS = /nod /nop /map /exepack /packcode /packdata
LIBS  =  $(DHLIB)\dhcalls.lib $(RMLIB)\rmcalls.lib
WARNFILT = | sed -e /C4204/d -e /C4001/d -e /C4071/d

!if "$(NLV)" == "jp" || "$(NLV)" == "JP" || "$(NLV)" == "TW" || "$(NLV)" == "tw" 
# 212727
CFLAGS=$(CFLAGS) -DDBCSKBD
!endif

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

OBJ1 = kbdstart.obj kbdstra.obj kbdstate.obj kbdusb.obj kbdinit.obj cmdparse.obj
OBJ2 = kbddata.obj kbdrm.obj

OBJS = $(OBJ1) $(OBJ2)

LST1 = kbdstart.lst kbdstra.lst kbdstate.lst kbdusb.lst kbdinit.lst cmdparse.lst
LST2 = kbddata.lst kbdrm.lst

LSTS = $(LST1) $(LST2)

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

.asm.obj:
        $(ASM) $(AFLAGS) $(AINC) $*.asm $*.obj;

.asm.lst:
        $(ASM) -l -c $(AFLAGS) $(AINC) $*.asm $*.obj;

.c.obj:
        $(CC) $(CFLAGS) $(CINC) $*.c $(WARNFILT)

.c.lst:
        $(CC) $(CFLAGS) /Fc $(CINC) $*.c
        copy $*.cod $*.lst
        del $*.cod


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

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

all: ibmkbd.sys

clean:
        if exist *.lnk  del *.lnk
        if exist *.obj  del *.obj
        if exist *.def  del *.def
        if exist *.map  del *.map
        if exist *.lst  del *.lst
        if exist *.cod  del *.cod
        if exist *.sym  del *.sym
        if exist *.sys  del *.sys

list:   $(LSTS)

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


# ----------------------------------------------------------------------------
# IBM Keyboard Device Driver
# ----------------------------------------------------------------------------
ibmkbd.sys: $(OBJS) makefile
        rem Create DEF file <<$*.def
LIBRARY IBMKBD
DESCRIPTION "$(FILEVER) IBM Keyboard Device Driver"
PROTMODE
SEGMENTS
 DDHeader       CLASS 'DATA'
 LIBDATA        CLASS 'DATA'
 _DATA          CLASS 'DATA'
 _BSS           CLASS 'BSS'
 c_common       CLASS 'BSS'
 CONST          CLASS 'CONST'
 DATAEND        CLASS 'CONST'
 'Code'         CLASS 'CODE' IOPL
 LIBCODE        CLASS 'CODE' IOPL
 _TEXT          CLASS 'CODE' IOPL
'RMCode'        CLASS 'CODE' IOPL
'DummyCode'     CLASS 'CODE' IOPL
IMPORTS
 _DOSIODELAYCNT = DOSCALLS.427
<<keep

        rem Create LNK file <<$*.lnk
$(OBJ1)+
$(OBJ2)
$*.sys
$*.map
$(LIBS)
$*.def
<<keep

        $(LINK) $(LFLAGS) @$*.lnk
        $(MAPSYM) $*.map

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