#   Makefile for: SERIAL
#   (c) International Business Machines Corp. 1990

#*****************************************************************************
#  Makefile for the SERIAL port driver
#
#       SCCSID = @(#)makefile   6.7 91/10/07
#
#       IBM Confidential
#
#       Copyright (c) IBM Corporation 1987, 1989
#
#       All Rights Reserved
#
#
#       SERIAL Makefile
#
#******************************************************************************

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

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

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

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

#
# Conditional Setup Area and User Defined Macros
#

#
#   Define macro for language. If the language macro is not defined, the
#   default language is US.
#

!ifndef LANG
LANG=us
!endif

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

MRI        = mri
MRIPATH    = ..\..\$(MRI)\serial
ICONPATH   = ..\..\$(MRI)\icons
H          = ..\..\h
IBMH       = ..\..\ibmh;..\..\ibmc\cinclude;..\..\h
LIBPath    = ..\..\lib
IBMLIB     = ..\..\ibmc\clib
LIB386Path = ..\..\lib386
INC        = ..\..\inc
TOOLSPATH  = ..\..\tools;..\..\ibmc\cbin
DPATH      = ..\..\$(MRI)\txt;$(DPATH)

#
# 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=$(IBMH);] || \
    [set LIB=$(LIB386Path);$(LIBPath)] || \
    [set PATH=$(TOOLSPATH)]
!endif

OBJS       = serial.obj

TARGETS    = serial.p$(LANG) $(MRIPATH)\serial.res
LIBLIST    = $(LIBPath)\os2386.lib \
             $(IBMLIB)\dde4nbs.lib

CC         = icc
ICCFLAGS   =  /Ss /Rn /Gm- /Gd- /Ge- /Ms /C+ /Fm /O+ /Yp+ .\$*.c
CINC       = -I$(MAKEDIR)
LINK       = link386
LFLAGS     = /PACKCODE /PACKDATA /EXEPACK /ALIGN:4 /M:FULL +

.c.obj:
        $(CC) $(CINC) $(DEFINES) $(ICCFLAGS) -c $<

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

#
# Include a makefile with all the information about MRI Codepage, Language,
# and Country for IPFC.
#

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

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

all: $(TARGETS)

clean:
    del *.obj *.res *.dll *.sof *.sc *.ih *.map *.sym *.lib

# Building serial.pdr

serial.p$(LANG): $(OBJS) $(LIBLIST) $(MRIPATH)\serial.res makefile
         Rem Create DEF file <<serial.def
LIBRARY SERIAL
DESCRIPTION '$(FILEVER) Serial Port Library'
PROTMODE
DATA MULTIPLE NONSHARED LOADONCALL
CODE LOADONCALL
EXPORTS
   SplPdEnumPort
   SplPdInitPort
   SplPdInstallPort
   SplPdGetPortIcon
   SplPdQueryPort
   SplPdSetPort
   SplPdRemovePort
   SplPdTermPort
<<keep
         $(LINK) $(LFLAGS) $(OBJS),$@,,$(LIBLIST),$*;
         rc $(MRIPATH)\serial.res serial.p$(LANG)
         mapsym serial

$(MRIPATH)\serial.res: $(MRIPATH)\serial.rc $(MRIPATH)\serial.dlg \
                         $(ICONPATH)\serial.ico
          copy $(ICONPATH)\serial.ico $(MAKEDIR)
          rc -r $(MRIPATH)\serial.rc $(MRIPATH)\serial.res

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