#**********************************************************************#
#*                                                                    *#
#* Copyright (c) 2001 by Sun Microsystems, Inc.                       *#
#* All rights reserved.                                               *#
#*                                                                    *#
#**********************************************************************#


#* $Date:   06 Apr 2004 09:34:58  $
#* $Modtime:   06 Apr 2004 09:14:08  $

# ***********************************************
# $Workfile:   usermake.src  $ $Revision:   1.3  $
# ***********************************************
#
# This makefile should be used to generate all user modifiable
# executable modules.
#
# The makefile may be invoked in the following manner:
#
# make all - Create all user modifiable objects and executables.
#
# make kixmakecnv
#
# make nlsmsg
#
# make rtsvsam
#
# make sock00
#
# make sortx
#
# make unikixrcv
#
# make unikixtran - a COBOL or non-COBOL based transaction processor
#		    will be built. Use 'kixinstall' to generate the
#		    proper makefile.
#
# make unikixvsam
#
# make	line.in	Individual files
#	line.out
#	mfrcd.in
#	mfrcd.out
#	record.in
#	record.out
#	recordv.in
#	recordv.out
#	mfrcdin
#	mfrcdout
#
# The following executables can be rebuilt if SECURITYOBJECTS changes.  They
# will not be built by a "make all"
#
# make dfhusdup
#
# make kixfile
#
# make unikixbld
#
# make unikixcemt
#
# make unikixfms
#
# make unikixred
#
# make unikixstrt
#
# If cobol is present, the following executables can be built.  They will
# not be built by "make all".
#
# make CSSNCESN
#
# make kxalt008
#
# make kxalt016
#
# make kxalt032
#
# make kxalt064
#
# make kxalt128
#
# make kxalt256
#
# make kxalt516
#
# make clean - Remove all user modifiable objects.
# 
# make clobber - Remove all user modifiable objects and executables.
# 
# for transaction processor with database set the following
# variables prior to make
#
#----------- RDBMSFLAG = -DORACLE, -DINFORMIX, -DSYBASE or -DDBTWO -----------
#-----------             -DDATACOM -DINGRES                        -----------
RDBMSFLAG=
#------ Set include path for SQLCA ---------------------------
# oracle (pro*cobol 1.3)             INCDIR = $(ORACLE_HOME)/cobol/lib
# oracle (pro*cobol 1.4 and upwards) INCDIR = $(ORACLE_HOME)/procob/lib
# sybase                             INCDIR = $(SYBASE)/include
INCDIR=
#-------------- for oracle database -----------------------
PCC=
PCCFLAGS=
ORACLELIB=
#
#-------------- for informix database -----------------------
INFORMIXLIB=
#
#-------------- for sybase database -----------------------
SYBCC=
SYBFLAGS=
SYBASELIB=
#
#-------------- for datacom database -----------------------
DCOM=
DFLAGS=
#-------------- for ingres database -----------------------
ESQLCBL=
INGFLAGS=

#
#-------------- for MQSeries ------------------------------
MQSERIESLIB=

#
#-------------- for EBM Runtime System ------------------------------
EBM_MF_INX=n
EBM_MF_REL=n

# ***********************************************
# rules
# ***********************************************


.SUFFIXES:	.c .int .o .cbl .cl2 .pc .pco .eco .cop .pgm .dco .scb .clt .ppl .sqc .sqb .cp .pli .so

.clt.cbl: makefile
	( cd `dirname $<` ; \
	   rm -f $*.err ; \
	   rm -f $*.cbl ; \
	   kixclt $*.clt )
.cl2.cbl: makefile
	( cd `dirname $<` ; \
	   rm -f $*.err ; \
	   rm -f $*.cbl ; \
	   kixclt $*.cl2 )
#
# for .cbl->.int
# cd to dirname $< since we are issuing make from src
# directory and the source and objects files are in another
# directory; e.g. src/record
#
.cbl.int: makefile
	( cd `dirname $<` ; \
		rm -f $*.int $*.o ; \
		$(COBOL) $(COBFLAGS) -C $(COBOPT) $< )
#
# for .c->.o
# cd to dirname $< since we are issuing make from src
# directory and the source and objects files are in another
# directory; e.g. src/convert. Also, need to specify the 
# .o name so it gets put in the right directory.
#
.c.o:
	(cd `dirname $<` ; \
		rm -f $*.o ; \
		$(CC) $(CFLAGS)	$(RDBMSFLAG) -o $*.o -c $< )

#
# for all database compiles, must do similar to above and cd
# to the appropriate directory before doing the compiles
#
.pc.o: makefile
	( cd `dirname $<` ; \
	   $(PCC) $(PCCFLAGS) iname=$*.pc oname=$*.cx include=$(INCDIR) \
	       ireclen=132 mode=ansi release_cursor=yes hold_cursor=no ; \
	   	mv $*.cx $*.c ; \
		$(CC) $(CFLAGS) $(RDBMSFLAG) -o $*.o -c $*.c ;\
	   	mv $*.c $*.cx )
.pco.o: makefile
	( cd `dirname $<` ; \
	   $(PCC) $(PCCFLAGS) iname=$*.pco oname=$*.cob include=$(INCDIR) \
	       ireclen=132 mode=ansi release_cursor=yes hold_cursor=no ; \
	   $(COBOL) -x -c -C $(COBOPT) $*.cob )
.ppl.o: makefile
	( cd `dirname $<` ; \
	   $(PP)  $(PPFLAGS) $< -o temp.ppl ; \
	   $(PPL) iname=temp.ppl oname=tempplt include=$(INCDIR) ireclen=256 \
		maxliteral=160 mode=ansi ; \
	   $(PLT) $(PLTFLAGS) -i tempplt    -o $*.temppli ; \
	   $(PLI) $(PLIFLAGS) $*.temppli -o $*.o ; \
	   rm -f temp.lis temp.ppl *.temppli tempplt )

.pli.so: makefile
	( cd `dirname $<` ; \
	   $(PP)  $(PPFLAGS)  $< -o $*.temppli ; \
	   $(PLI) $(PLIFLAGS) $*.temppli ; \
	   $(LD) -G -o $*.so $*.o; \
	   rm -f $*.temppli $*.o)

.cop.o: makefile
	( cd `dirname $<` ; \
	   $(SYBCC) $(SYBFLAGS) -O$*.cob $*.cop ; \
	   $(COBOL) -x -c -C $(COBOPT) $*.cob )
.cp.o: makefile
	( cd `dirname $<` ; \
	   $(SYBCC) $(SYBFLAGS) -O$*.c $*.cp ; \
	   $(CC) -c -I$(INCDIR) $*.c ; \
	   rm -f $*.c )
.eco.o: makefile
	( cd `dirname $<` ; \
	   esqlcobol -e $*.eco ; \
	   $(COBOL) -x -c -C $(COBOPT) $*.cob )
.pgm.o: makefile
	( cd `dirname $<` ; \
	   rm -f $*.int ; \
	   $(COBOL) -x -c -C $(COBOPT) -k $*.pgm )
.sqb.o: makefile
	( cd `dirname $<` ; \
		rm -f $*.o $*.cbl ; \
		db2 connect to $(DB2DBDFT); \
		db2 prep $< bindfile target mfcob; \
		db2 bind $*.bnd ; \
		db2 connect reset ; \
		db2 terminate ; \
		COBCPY=$(INSTHOME)/sqllib/include/cobol_mf ;\
		export COBCPY ;\
		$(COBOL) -x -c  -C $(COBOPT) -k $*.cbl )
.sqc.o: makefile
	( cd `dirname $<` ; \
	   rm -f $*.o $*.c ; \
	   db2 connect to $(DB2DBDFT); \
	   db2 prep $< ; \
	   db2 terminate ; \
	   cc -c $*.c -I $(INSTHOME)/sqllib/include )
.dco.o: makefile
	( cd `dirname $<` ; \
	   rm -f $*.cob *.lis SQL*.LIB ; \
	   $(DCOM) $(DFLAGS) -g KXDATACOM $*.dco ; \
	   $(COBOL) -x -c -C $(COBOPT) $*.cob ; \
	   rm -f *.lis )
.scb.o: makefile
	( cd `dirname $<` ; \
	   $(ESQLCBL) $(INGFLAGS) -f$*.cob $*.scb ; \
	   $(COBOL) -x -c -C $(COBOPT) $*.cob )

# ***********************************************
# variables to rules
# ***********************************************

#
# Default machine type to SUN
#

MACHINE=SOL

#
# Default C compiler location
#

CC=cc

#
# Default C flag settings (optimize).
#

CFLAGS=-fast -xarch=v8plus -mt -D_LFS64_LARGEFILE=1 -DSOL=28 -DTERMINFO -DCOBOL_HAS_LONGJMP  -DSVR4 -DSUNOS5

#
# Invoke Linker command.
#

LD=ld

#
# Default Linker flag settings (none).
#

LDFLAGS=

#
# Default Linker flag settings RS600(only) shared object export.
#

RS6_SHR_CB=
RS6_SHR_NC=

#
# Default Linker flag settings for PLI (none).
#

PLILDFLAGS=

#
# Invoke copy command.
#

CP=cp

#
# Invoke Cobol command.
#

COBOL=cob

#
# Default Cobol flag settings 
#
COBFLAGS=-I CICS

#
# Default Cobol compile options
#
COBOPT="ibmcomp noalter ans85 notrunc defaultbyte=0"

#
# Default Cobol compile options for CICS transactions
#
COBOPT1="cics ibmcomp noalter ans85 notrunc defaultbyte=0"

#
# Default cobol module is kxcobol.o
# Will be changed by kixinstall to kxnocobol.o
# if Shared Library makefile environment is chosen
#
COBOL_MOD=kxcobol.o

#
# By default unikixtran is built without PLI, using kixnopli.so 
# if PLI is chosen during install then kixpli.so is used
# which sets PLI language
#          
           
PLI_MOD=kixnopli

#
TRAN_LIBS=-l${PLI_MOD}
#

#
# Default cobol extension for transaction proc is 'cob'.
# Will be changed by kixinstall to 'nocob' if Shared
# Library makefile environment is chosen
#
COBOL_EXT=cob

#
# The kxnoranim.o module contains stubs for remote animation
# for users who do not have cobol or who do not have Server
# Express v2.0.11 SP1 or greater. Erased by kixinstall if user
# has the above version.
#
RANIMSTUB=$(USERTRANS)/kxnoranim.o

#
# variables for Liant PL/I compiler
# and PL/I oracle support variables
#

PLI=${LPI_PRODUCT_DIR}/bin/lpipl1
PLT=${UNIKIX}/bin/kixplt
PLX=${LPI_PRODUCT_DIR}/bin/lpiplx
PP=${LPI_PRODUCT_DIR}/bin/lpipp
PPL=${LPI_PRODUCT_DIR}/bin/propli

INCPATH=${LPI_PRODUCT_DIR}/include
PPFLAGS=-isuffix .inc -margins 1,256 -ipath ${INCPATH}
PLIFLAGS=-zp1 -opt 3 -pic -ipath ${INCPATH}
PLTFLAGS=

# ***********************************************
# standard variables
# ***********************************************

#
# The following variables assume the external setting of the
# following environment variables.
#
# UNIKIX - base directory of the product
#
# Declare variable for the location of "user" bin directory.
# The default value is the local/bin directory, as defined in
# the Sun Mainframe Transaction Processing Software Administrator's Guide.
#
# This directory is the target for the user executable files.
#

BINDIR=${UNIKIX}/local/bin

#
# Declare variable for the location of the lib directory.
#
# This directory is the target for the user and system library
# modules.
#

LIBDIR=${UNIKIX}/lib

#
#  link library directory for libraries like PL/I
#

LINKLIBDIR=

#
# Declare variable for the location of the src directory
# This directory is the target for the user modifiable source and
# object files.
#

USERSRCDIR=${UNIKIX}/src

USERCONVERT=$(USERSRCDIR)/convert

USERINSTALL=$(USERSRCDIR)/install

USERISC=$(USERSRCDIR)/isc

USERRECORD=$(USERSRCDIR)/record

USERRECOVERY=$(USERSRCDIR)/recovery

USERSECURITY=$(USERSRCDIR)/security

USERSOCKET=$(USERSRCDIR)/socket

USERTERMINAL=$(USERSRCDIR)/terminal

USERTRANS=$(USERSRCDIR)/trans

USERXA=$(USERSRCDIR)/XA

#
# Declare variable for the source modules within the
# user source directory.
#

USERSOURCES=

#
# Declare variable for the user specific object modules within the
# user source directory.
#

USERSPECOBJECTS=

#
# Declare variable for the user specific compiler/linker options
#

USERSPECOPTIONS=

#
# Declare objects specific to online (unikixtran).
# By default USERSPECOBJECTS will be added to this
#

TRANSPECOBJECTS=

#
# Declare objects specific to batch (unikixvsam or rtsvsam).
# By default USERSPECOBJECTS will be added to this
#

VSAMSPECOBJECTS=

#
# Declare variable for the object modules within the
# user source directory.
#

USEROBJECTS=

#
# Define variables containing the names of all object modules and libraries
# required for CECI - the Command Interpreter transaction.
#
# Note that by default unikixtran is built without any support for CECI.
# cintstub.o is linked into unikixtran in order to satisfy references to
# CECI's entry point.
#
# To build unikixtran to include CECI support, comment out the following 
# line referencing cintstub.o, and uncomment the subsequent 2 lines 
# which reference libcint.o and libceci.a respectively.
#

NOCECI_OBJ=`if  [ $(MACHINE) = SOL ] || \
		[ $(MACHINE) = HP ]  || \
		[ $(MACHINE) = RS6 ] || \
		[ $(MACHINE) = ALPHA ] ; \
	  then \
		echo '  ' ; \
	  else \
		echo '$(LIBDIR)/cintstub.o' ; \
	  fi`

#CINTOBJECTS=$(LIBDIR)/libcint.o

#CINTLIBS=$(LIBDIR)/libceci.a -ll -ly

#
# variables providing machine-specific required options
#    KXTABLES_LIB is for building most executables
#    BASE_UNIX_LIBS is for building executables like unikixstrt
#    TRAN_UNIX_LIBS is for building unikixtran
#    VSAM_UNIX_LIBS is for building unikixvsam
#    RTSVSAM_UNIX_LIBS is for building rtsvsam
#    SORTX_UNIX_LIBS is for building sortx
#    TRANCOB_OPTS is for unikixtran
#    VSAMCOB_OPTS is for unikixvsam

KXTABLES_LIB=-lkxtables

BASE_UNIX_LIBS=-lsocket -lnsl -lcurses -lgen -ldl -lthread

TRAN_UNIX_LIBS=-lthread -lcrypt -lcurses -lsocket -lnsl -lm -lelf -lintl -ldl -lkxtables -lkxtm -lkxrm

VSAM_UNIX_LIBS=-lcrypt -lcurses -lsocket -lnsl -lm -lthread

RTSVSAM_UNIX_LIBS=-lm -lsocket -lnsl -lthread

SORTX_UNIX_LIBS=-ll -lsocket -lthread

TRAN_COB_OPTS=-x -L /usr/ccs/lib

VSAM_COB_OPTS=-x -L /usr/ccs/lib

#
# LIBBASAP will currently only have a value for RS6/AIX machines. The
# value should be the path, ${UNIKIX}/lib/libbasap.a
#
LIBBASAP=

#
# Declare variable for the Oracle archives and objects.
#
# Note that ORACLELIB must be set prior to executing the
# make for Oracle.
#

ORACLEOBJECTS=

ORACLE_LINKS=

#
# Declare variable for the Informix archives and objects.
#
# Note that INFORMIXLIB must be set prior to executing the
# make for Informix.
#

INFORMIXOBJECTS=

INFORMIX_LINKS=

#
# Declare variable for the Sybase archives and objects.
#
# Note that INCDIR, SYBASELIB must be set prior to executing the
# make for Sybase/Sun MTP transaction processor.

SYBASEOBJECTS=

SYBASE_LINKS=

#
# Declare variable for the DB2 archives and objects.
#
# make for DB26000/Sun MTP transaction processor.

DB2OBJECTS=

DB2_LINKS=

#
# Declare variable for the DATACOM archives and objects.
#

DATACOMOBJECTS=

DATACOM_LINKS=

#
# Declare variable for the INGRES archives and objects.
#

INGRESOBJECTS=

INGRES_LINKS=

#
# Declare variable for the PL/I archives and objects.
#

PLIOBJECTS=

PLI_LINKS=

#
# Declare variable for the EHLLAPI archives and objects.
#
# Note that EHLLAPILIB must be set prior to executing the
# make for the EHLLAPI server.
#

# EHLLAPIOBJECTS = \
#	${EHLLAPILIB}/ehllapi.o

EHLLAPIOBJECTS=

#
# Declare XA Resource Manager table objects
#

RMSOBJECTS= \
	$(USERXA)/kxglobalrmtable.o \
	$(BINDIR)/libkxrm.so
	
#
# Declare variable for external security archives
#
# Note that UNICENTER_HOME must be set prior to executing the make, whenever
# CA-Unicenter has been selected to be installed with the kixinstall
#  shell script.
#
# no external security, by default

SECURITYOBJECTS= \
	$(USERSECURITY)/kxsec_exits.o

#
# Declare variable for null external security "stub" for batch executables
#
BATCHSECURITYOBJECTS= \
	$(USERSECURITY)/kxsec_exitsNULL.o

#
# Declare variable for the MQSeries libraries and objects.
#

MQSERIESOBJECTS=

MQSERIES_LINKS=


#
# Declare variable for system COBOL object module storage.
#

COBOBJECTS= \
	$(USERTRANS)/kxcallkix.o \
	$(USERTRANS)/kxloadcob.o

#
# Declare variable for all source modules plus "system" source
# modules, such as this makefile.
#

SOURCES= \
	makefile \
	$(USERTRANS)/kxusrexit.c \
	$(USERCONVERT)/kxusrxlt.c \
	$(USERCONVERT)/kxcvtxlt.c \
	$(USERISC)/kxdynrte.c \
	$(USERTERMINAL)/kxtnfxit.c \
	$(USERSOCKET)/kxsktxit.c \
	$(USERCONVERT)/cvlwrupr.c \
	$(USERCONVERT)/kxcnvtbl.c \
	$(USERCONVERT)/kxsyscnvtbl.c \
	$(USERSECURITY)/kxsec_exits.c \
	$(USERRECOVERY)/kxesdsxlt.c \
	$(USERRECORD)/kxread.c \
	$(USERRECORD)/kxwrite.c \
	$(USERRECORD)/linein.c \
	$(USERRECORD)/lineout.c \
	$(USERRECORD)/recordin.c \
	$(USERRECORD)/recordout.c \
	$(USERRECORD)/recordvin.c \
	$(USERRECORD)/recordvout.c \
	$(USERRECORD)/mfrcdin.cbl \
	$(USERRECORD)/mfrcdout.cbl \
	$(USERRECORD)/kxalt008.cbl \
	$(USERRECORD)/kxalt016.cbl \
	$(USERRECORD)/kxalt032.cbl \
	$(USERRECORD)/kxalt064.cbl \
	$(USERRECORD)/kxalt128.cbl \
	$(USERRECORD)/kxalt256.cbl \
	$(USERRECORD)/kxalt516.cbl \
	$(USERSOURCES)

#
# Declare variable for user object module storage.
# Note CLEAN does not clean User Specific Objects
#

OBJECTS= \
	$(USERTRANS)/kxusrexit.o \
	$(USERCONVERT)/kxusrxlt.o \
	$(USERCONVERT)/kxcvtxlt.o \
	$(USERISC)/kxdrrtns.o \
	$(USERISC)/kxdynrte.o \
	$(USERTERMINAL)/kxtnfxit.o \
	$(USERSOCKET)/kxsktxit.o \
	$(USERCONVERT)/cvlwrupr.o \
	$(USERCONVERT)/kxcnvtbl.o \
	$(USERCONVERT)/kxsyscnvtbl.o \
	$(USEROBJECTS)

EBMKXUSEROBJ= \
	$(USERTRANS)/kxusrexit.o \
	$(USERCONVERT)/cvlwrupr.o \
	$(USERCONVERT)/kxusrxlt.o \
	$(USERCONVERT)/kxcvtxlt.o \
	$(USERCONVERT)/kxcnvtbl.o \
	$(USERCONVERT)/kxsyscnvtbl.o \
	$(USEROBJECTS)

#
# Define variable containing the names of all object modules
# to be used in the lu62 build process.
#

APPCOBJECTS= 

BLDOBJECTS= \
	$(USERCONVERT)/kixmakecnv.o \
	$(USERRECORD)/kxread.o \
	$(USERRECORD)/kxwrite.o \
	$(USERRECORD)/linein.o \
	$(USERRECORD)/lineout.o \
	$(USERRECORD)/recordin.o \
	$(USERRECORD)/recordout.o \
	$(USERRECORD)/recordvin.o \
	$(USERRECORD)/recordvout.o \
	$(USERRECORD)/mfrcdin.i* \
	$(USERRECORD)/mfrcdin.o \
	$(USERRECORD)/mfrcdout.i* \
	$(USERRECORD)/mfrcdout.o \
	$(USERRECORD)/kxalt*.i* \
	$(USERRECORD)/kxalt*.o

# ***********************************************************
# Define objects for building kixfile
# ***********************************************************

KIXFILE_OBJECTS= \
	$(LIBDIR)/kixfile.o \
	$(BATCHSECURITYOBJECTS)

# ***********************************************************
# Define objects for building dfhusdup
# ***********************************************************

DFHUSDUP_OBJECTS= \
	$(LIBDIR)/dfhusdup.o \
	$(BATCHSECURITYOBJECTS)

# ***********************************************************
# Define objects for building kixmakecnv
# ***********************************************************

KIXMAKECNV_OBJECTS= \
	$(USERCONVERT)/kixmakecnv.o \
	$(USERCONVERT)/kxcnvtbl.o \
	$(USERCONVERT)/kxsyscnvtbl.o

# ***********************************************************
# Define objects for building mfrcdin and mfrcdout
# ***********************************************************

MFRCDIN_OBJECTS= \
	$(USERRECORD)/mfrcdin.int \
	$(USERRECORD)/kxwrite.o \
	$(USERRECORD)/kxread.o

MFRCDOUT_OBJECTS= \
	$(USERRECORD)/mfrcdout.int \
	$(USERRECORD)/kxread.o

# ***********************************************************
# Define objects for building sortx
# ***********************************************************

SORTX_OBJECTS= \
	$(LIBDIR)/kixsortx.o \
	$(BATCHSECURITYOBJECTS)

# ***********************************************************
# Define objects for building unikixbld
# ***********************************************************

UNIKIXBLD_OBJECTS= \
	$(LIBDIR)/unikixbld.o \
	$(BATCHSECURITYOBJECTS)

# ***********************************************************
# Define objects for building unikixCEMT
# ***********************************************************

UNIKIXCEMT_OBJECTS= \
	$(LIBDIR)/unikixcemt.o \
	$(SECURITYOBJECTS)

# ***********************************************************
# Define objects for building unikixFMS
# ***********************************************************

UNIKIXFMS_OBJECTS= \
	$(LIBDIR)/unikixfms.o \
	$(SECURITYOBJECTS)

# ***********************************************************
# Define objects for building unikixRED
# ***********************************************************

UNIKIXRED_OBJECTS= \
	$(LIBDIR)/unikixred.o \
	$(SECURITYOBJECTS)

# ***********************************************************
# Define objects for building unikixrcv
# ***********************************************************

UNIKIXRCV_SOURCES= \
	$(USERRECOVERY)/kxesdsxlt.c

UNIKIXRCV_OBJECTS= \
	$(LIBDIR)/unikixrcv.o \
	$(USERRECOVERY)/kxesdsxlt.o

# ***********************************************************
# Define objects for building unikixstrt
# ***********************************************************

UNIKIXSTRT_OBJECTS= \
	$(LIBDIR)/unikixstrt.o \
	$(SECURITYOBJECTS)

# ***********************************************************
# Define objects for building unikixtran
# ***********************************************************

UNIKIXTRAN_OBJECTS= \
	$(LIBDIR)/unikixtran.o \
	$(USERTRANS)/$(COBOL_MOD) \
	$(OBJECTS) \
	$(TRANSPECOBJECTS) \
	$(COBOBJECTS) \
	$(APPCOBJECTS) \
	$(CINTOBJECTS) \
	$(SECURITYOBJECTS) \
	$(ORACLEOBJECTS) \
	$(INFORMIXOBJECTS) \
	$(SYBASEOBJECTS) \
	$(DB2OBJECTS) \
	$(DATACOMOBJECTS) \
	$(INGRESOBJECTS) \
	$(MQSERIESOBJECTS) \
	$(PLIOBJECTS) \
        $(RANIMSTUB) \
	$(LIBBASAP)

# ***********************************************************
# Define objects for building unikixvsam
# ***********************************************************

UNIKIXVSAM_OBJECTS= \
	$(LIBDIR)/unikixvsam.o \
	$(OBJECTS) \
	$(VSAMSPECOBJECTS) \
	$(APPCOBJECTS) \
	$(BATCHSECURITYOBJECTS) \
	$(ORACLEOBJECTS) \
	$(INFORMIXOBJECTS) \
	$(SYBASEOBJECTS) \
	$(DB2OBJECTS) \
	$(DATACOMOBJECTS) \
	$(INGRESOBJECTS) \
	$(MQSERIESOBJECTS)

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

EBMRTSOBJECTS= \
	$(EBMKXUSEROBJ) \
	$(VSAMSPECOBJECTS) \
	$(ORACLEOBJECTS) \
	$(INFORMIXOBJECTS) \
	$(SYBASEOBJECTS) \
	$(DB2OBJECTS) \
	$(DATACOMOBJECTS) \
	$(INGRESOBJECTS) \
	$(BATCHSECURITYOBJECTS) \
	$(MQSERIESOBJECTS)

#
# Define link libraries for the various databases.  To be used in
# the process for building unikixtran and unikixvsam
#

DBLINKS=	\
	$(ORACLE_LINKS) \
	$(INFORMIX_LINKS) \
	$(SYBASE_LINKS) \
	$(DB2_LINKS) \
	$(DATACOM_LINKS) \
	$(INGRES_LINKS) \
	$(PLI_LINKS) \
	$(MQSERIES_LINKS)


# ****************************************************************
# Define standard Sun MTP and user executables that can be rebuilt
# ****************************************************************

INSTMAPS= \
	$(USERTRANS)/CSIGNMP.map

EXECUTABLES= \
	$(BINDIR)/sortx \
	$(BINDIR)/nlsmsg \
	$(BINDIR)/unikixtran \
	$(BINDIR)/unikixvsam \
	$(USEREXECUTABLES)

SECEXECUTABLES= \
	$(BINDIR)/kixfile \
	$(BINDIR)/unikixbld \
	$(BINDIR)/unikixCEMT \
	$(BINDIR)/unikixFMS \
	$(BINDIR)/unikixRED \
	$(BINDIR)/unikixstrt \
	$(BINDIR)/dfhusdup

#
# define some miscellaneous executables that may be 
# created. Used only for the CLOBBER macro
#
MISC_EXECUTABLES= \
	$(BINDIR)/rtsvsam* \
	$(BINDIR)/RUNB \
	$(BINDIR)/unikixvsam_dummy \
	$(BINDIR)/mfrcdout_dummy \
	$(BINDIR)/mfrcdin_dummy \
	$(BINDIR)/mfrcdout \
	$(BINDIR)/mfrcdin \
	$(BINDIR)/kxalt*

USEREXECUTABLES= \
	$(BINDIR)/kixmakecnv \
	$(BINDIR)/line.in \
	$(BINDIR)/line.out \
	$(BINDIR)/mfrcd.in \
	$(BINDIR)/mfrcd.out \
	$(BINDIR)/record.in \
	$(BINDIR)/record.out \
	$(BINDIR)/recordv.in \
	$(BINDIR)/recordv.out \
	$(BINDIR)/mfrcdin_$(COBOL_EXT) \
	$(BINDIR)/mfrcdout_$(COBOL_EXT) \
	$(BINDIR)/libkxrm.so \
	$(USERSOCKET)/sock00

# ****************************************************************
# CLEAN will only remove various object files. It will not
# remove user specific objects, USERSPECOBJECTS
# ****************************************************************

CLEAN= \
	$(USERCONVERT)/kxusrxlt.o \
	$(USERCONVERT)/kxcvtxlt.o \
	$(USERCONVERT)/cvlwrupr.o \
	$(USERCONVERT)/kxcnvtbl.o \
	$(USERCONVERT)/kxsyscnvtbl.o \
	$(USERISC)/kxdynrte.o \
	$(USERRECOVERY)/kxesdsxlt.o \
	$(USERSOCKET)/kxsktxit.o \
	$(USERSOCKET)/sock00.o \
	$(USERTERMINAL)/kxtnfxit.o \
	$(USERTRANS)/kxusrexit.o \
	$(USERTRANS)/kxcallkix.o \
	$(USERTRANS)/kxcallkix.i* \
	$(USERTRANS)/kxloadcob.o \
	$(USERTRANS)/kxloadcob.i* \
	$(USERTRANS)/CSIGNMP \
	$(USERTRANS)/CSSNCESN.cbl \
	$(USERTRANS)/CSSNCESN.int \
	$(BLDOBJECTS) \
	$(RMSOBJECTS) \
	$(USEROBJECTS)

# ****************************************************************
# CLOBBER will remove object files AND all the executables
# ****************************************************************

CLOBBER= \
	$(CLEAN) \
	$(EXECUTABLES) \
	$(SECEXECUTABLES) \
	$(INSTMAPS) \
	$(MISC_EXECUTABLES)

# ***********************************************
# standard targets
# ***********************************************

# ********************
#  all target
# ********************

all:	$(EXECUTABLES)

# ********************
#  clean target
# ********************

clean:
	rm -f $(CLEAN) 

# ********************
#  clobber target
# ********************

clobber:
	rm -f $(CLOBBER)

# ********************
#  kixmakecnv target
# ********************

kixmakecnv:	$(BINDIR)/kixmakecnv
	@echo ""

$(BINDIR)/kixmakecnv:	$(KIXMAKECNV_OBJECTS) makefile
	rm -f $@
	$(CC) -o $@ $(KIXMAKECNV_OBJECTS)

# ********************
#  RM table target
# ********************

RMS:	$(BINDIR)/libkxrm.so
	@echo ""
	
$(BINDIR)/libkxrm.so:	$(USERXA)/RM
	rm -f $@ ; \
	( cd $(USERXA) ; \
		rmutil -f RM -g; \
		make -f rms.mk )
	cp $(USERXA)/libkxrm.so $@
		
# ********************
#  sock00 target
# ********************

sock00:	$(USERSOCKET)/sock00
	@echo ""

$(USERSOCKET)/sock00:		$(USERSOCKET)/sock00.o makefile
	rm -f $@ ; \
	$(CC) -o $@ $(USERSOCKET)/sock00.o $(BASE_UNIX_LIBS)

# ********************
#  mfrcdin targets; cobol and non-cobol
#  cd to $(USERRECORD) required to get all the
#  object files in the right directory
# ********************

mfrcdin:	$(BINDIR)/mfrcdin_$(COBOL_EXT) makefile
	@echo ""

$(BINDIR)/mfrcdin_cob:	$(MFRCDIN_OBJECTS) makefile
	rm -f $(BINDIR)/mfrcdin
	( cd $(USERRECORD) ; \
		$(COBOL) -x -o $(BINDIR)/mfrcdin $(MFRCDIN_OBJECTS) )
	
$(BINDIR)/mfrcdin_nocob:	makefile
	rm -f $(BINDIR)/mfrcdin
	( cd `dirname $@` ; \
        touch mfrcdin_dummy; \
	ln -s mfrcdin_dummy mfrcdin )

# ********************
#  mfrcdout targets; cobol and non-cobol
#  cd to $(USERRECORD) required to get all the
#  object files in the right directory
# ********************

mfrcdout:	$(BINDIR)/mfrcdout_$(COBOL_EXT) makefile
	@echo ""

$(BINDIR)/mfrcdout_cob:	$(MFRCDOUT_OBJECTS) makefile
	rm -f $(BINDIR)/mfrcdout
	( cd $(USERRECORD) ; \
		$(COBOL) -x -o $(BINDIR)/mfrcdout $(MFRCDOUT_OBJECTS) )
	
$(BINDIR)/mfrcdout_nocob:	makefile
	rm -f $(BINDIR)/mfrcdout
	( cd `dirname $@` ; \
        touch mfrcdout_dummy; \
	ln -s mfrcdout_dummy mfrcdout )

# ********************
#  kxalt??? targets
# ********************
kxalt008:	$(BINDIR)/kxalt008 makefile
	@echo ""

$(BINDIR)/kxalt008:	$(USERRECORD)/kxalt008.cbl
	rm -f $(BINDIR)/kxalt008
	( cd $(USERRECORD) ; \
		$(COBOL) -x -o $(BINDIR)/kxalt008 $(USERRECORD)/kxalt008.cbl )

kxalt016:	$(BINDIR)/kxalt016 makefile
	@echo ""

$(BINDIR)/kxalt016:	$(USERRECORD)/kxalt016.cbl
	rm -f $(BINDIR)/kxalt016
	( cd $(USERRECORD) ; \
		$(COBOL) -x -o $(BINDIR)/kxalt016 $(USERRECORD)/kxalt016.cbl )

kxalt032:	$(BINDIR)/kxalt032 makefile
	@echo ""

$(BINDIR)/kxalt032:	$(USERRECORD)/kxalt032.cbl
	rm -f $(BINDIR)/kxalt032
	( cd $(USERRECORD) ; \
		$(COBOL) -x -o $(BINDIR)/kxalt032 $(USERRECORD)/kxalt032.cbl )

kxalt064:	$(BINDIR)/kxalt064 makefile
	@echo ""

$(BINDIR)/kxalt064:	$(USERRECORD)/kxalt064.cbl
	rm -f $(BINDIR)/kxalt064
	( cd $(USERRECORD) ; \
		$(COBOL) -x -o $(BINDIR)/kxalt064 $(USERRECORD)/kxalt064.cbl )

kxalt128:	$(BINDIR)/kxalt128 makefile
	@echo ""

$(BINDIR)/kxalt128:	$(USERRECORD)/kxalt128.cbl
	rm -f $(BINDIR)/kxalt128
	( cd $(USERRECORD) ; \
		$(COBOL) -x -o $(BINDIR)/kxalt128 $(USERRECORD)/kxalt128.cbl )

kxalt256:	$(BINDIR)/kxalt256 makefile
	@echo ""

$(BINDIR)/kxalt256:	$(USERRECORD)/kxalt256.cbl
	rm -f $(BINDIR)/kxalt256
	( cd $(USERRECORD) ; \
		$(COBOL) -x -o $(BINDIR)/kxalt256 $(USERRECORD)/kxalt256.cbl )

kxalt516:	$(BINDIR)/kxalt516 makefile
	@echo ""

$(BINDIR)/kxalt516:	$(USERRECORD)/kxalt516.cbl
	rm -f $(BINDIR)/kxalt516
	( cd $(USERRECORD) ; \
		$(COBOL) -x -o $(BINDIR)/kxalt516 $(USERRECORD)/kxalt516.cbl )

# ********************
#  line.in target
# ********************

line.in:	$(BINDIR)/line.in makefile
	@echo ""

$(BINDIR)/line.in:	$(USERRECORD)/linein.o
	rm -f $@
	$(CC) $(CFLAGS) -o $@ $?

# ********************
#  line.out target
# ********************

line.out:	$(BINDIR)/line.out makefile
	@echo ""

$(BINDIR)/line.out:	$(USERRECORD)/lineout.o
	rm -f $@
	$(CC) $(CFLAGS) -o $@ $?

# ********************
#  mfrcd.in target
# ********************

mfrcd.in:	$(BINDIR)/mfrcd.in makefile
	@echo ""

$(BINDIR)/mfrcd.in:	$(USERRECORD)/mfrcd.in
	rm -f $@
	$(CP) $? $@
	chmod 755 $@

# ********************
#  mfrcd.out target
# ********************

mfrcd.out:	$(BINDIR)/mfrcd.out makefile
	@echo ""

$(BINDIR)/mfrcd.out:	$(USERRECORD)/mfrcd.out
	rm -f $@
	$(CP) $? $@
	chmod 755 $@

# ********************
#  record.in target
# ********************

record.in:	$(BINDIR)/record.in makefile
	@echo ""

$(BINDIR)/record.in:	$(USERRECORD)/recordin.o
	rm -f $@
	$(CC) $(CFLAGS) -o $@ $?

# ********************
#  record.out target
# ********************

record.out:	$(BINDIR)/record.out makefile
	@echo ""

$(BINDIR)/record.out:	$(USERRECORD)/recordout.o
	rm -f $@
	$(CC) $(CFLAGS) -o $@ $?

# ********************
#  recordv.in target
# ********************

recordv.in:	$(BINDIR)/recordv.in makefile
	@echo ""

$(BINDIR)/recordv.in:	$(USERRECORD)/recordvin.o
	rm -f $@
	$(CC) $(CFLAGS) -o $@ $?

# ********************
#  recordv.out target
# ********************

recordv.out:	$(BINDIR)/recordv.out makefile
	@echo ""

$(BINDIR)/recordv.out:	$(USERRECORD)/recordvout.o
	rm -f $@
	$(CC) $(CFLAGS) -o $@ $?

# ********************
#  kixfile target
# ********************

kixfile:	$(BINDIR)/kixfile
	@echo ""

$(BINDIR)/kixfile:	$(KIXFILE_OBJECTS) makefile
	rm -f $@
	$(CC) $(LDFLAGS) -o $@ $(KIXFILE_OBJECTS) $(BASE_UNIX_LIBS) $(KXTABLES_LIB)
	chmod 755 $@

# ********************
#  dfhusdup target
# ********************

dfhusdup:	$(BINDIR)/dfhusdup
	@echo ""

$(BINDIR)/dfhusdup:	$(DFHUSDUP_OBJECTS) makefile
	rm -f $@
	$(CC) $(LDFLAGS) -o $@ $(DFHUSDUP_OBJECTS) $(BASE_UNIX_LIBS) $(KXTABLES_LIB)
	chmod 755 $@

# ********************
#  rtsvsam target
# ********************

rtsvsam:	$(BINDIR)/rtsvsam
	@echo ""

$(BINDIR)/rtsvsam:	$(BINDIR)/rtsvsam_$(COBOL_EXT)
	@echo ""

$(BINDIR)/rtsvsam_cob:	$(EBMRTSOBJECTS) makefile
	rm -f $(BINDIR)/rtsvsam_*
	rm -f $(BINDIR)/RUNB
	rm -f $(BINDIR)/rtsvsam
	(sh ${UNIKIX}/src/RTSVSAM/inst_rtsvsam "$(MACHINE)" "$(EBM_MF_REL)" \
	"$(EBM_MF_INX)" "$(BINDIR)" "$(EBMRTSOBJECTS)" \
	"$(DBLINKS) $(RTSVSAM_UNIX_LIBS) $(KXTABLES_LIB)" \
	"$(LINKLIBDIR)" )

$(BINDIR)/rtsvsam_nocob:	makefile
	rm -f $(BINDIR)/rtsvsam_*
	rm -f $(BINDIR)/RUNB
	rm -f $(BINDIR)/rtsvsam
	( cd `dirname $@` ; \
	touch rtsvsam_dummy; \
	ln -s rtsvsam_dummy rtsvsam; \
	ln -s rtsvsam_dummy RUNB )

# ********************
#  sortx target
# ********************

sortx:	$(BINDIR)/sortx
	@echo ""

$(BINDIR)/sortx:	$(SORTX_OBJECTS) makefile
	rm -f $@
	$(CC) $(LDFLAGS) -o $@ $(SORTX_OBJECTS) $(SORTX_UNIX_LIBS) $(KXTABLES_LIB)
	chmod 755 $@

nlsmsg:	$(BINDIR)/nlsmsg
	@echo ""

$(BINDIR)/nlsmsg:	$(LIBDIR)/nlsmsg.txt makefile
	rm -f $@
	gencat $@ $(LIBDIR)/nlsmsg.txt 
	chmod 755 $@

# ********************
#  unikixbld target
# ********************

unikixbld:	$(BINDIR)/unikixbld
	@echo ""

$(BINDIR)/unikixbld:	$(UNIKIXBLD_OBJECTS) makefile
	rm -f $@
	$(CC) $(LDFLAGS) -o $@ $(UNIKIXBLD_OBJECTS) $(BASE_UNIX_LIBS) $(KXTABLES_LIB)
	chmod 755 $@

# ********************
#  unikixcemt target
# ********************

unikixcemt:	$(BINDIR)/unikixCEMT
	@echo ""

$(BINDIR)/unikixCEMT:	$(UNIKIXCEMT_OBJECTS) makefile
	rm -f $@
	$(CC) $(LDFLAGS) -o $@ $(UNIKIXCEMT_OBJECTS) $(BASE_UNIX_LIBS) $(KXTABLES_LIB)
	chmod 755 $@

# ********************
# unikixfms target
# ********************

unikixfms:	$(BINDIR)/unikixFMS
	@echo ""

$(BINDIR)/unikixFMS:	$(UNIKIXFMS_OBJECTS) makefile
	rm -f $@
	$(CC) $(LDFLAGS) -o $@ $(UNIKIXFMS_OBJECTS) $(BASE_UNIX_LIBS) $(KXTABLES_LIB)
	chmod 755 $@

# ********************
#  unikixrcv target
# ********************

unikixrcv:      $(BINDIR)/unikixrcv makefile
	@echo ""

$(BINDIR)/unikixrcv:    $(UNIKIXRCV_OBJECTS) makefile
	rm -f $@
	$(CC) $(LDFLAGS) -o $@ $(UNIKIXRCV_OBJECTS) $(BASE_UNIX_LIBS) $(KXTABLES_LIB)
	chmod 755 $@

# ********************
#  unikixred target
# ********************

unikixred:	$(BINDIR)/unikixRED
	@echo ""

$(BINDIR)/unikixRED:	$(UNIKIXRED_OBJECTS) makefile
	rm -f $@
	$(CC) $(LDFLAGS) -o $@ $(UNIKIXRED_OBJECTS) $(BASE_UNIX_LIBS) $(KXTABLES_LIB)
	chmod 755 $@

# ********************
# unikixstrt target
# ********************

unikixstrt:	$(BINDIR)/unikixstrt
	@echo ""

$(BINDIR)/unikixstrt:	$(UNIKIXSTRT_OBJECTS) makefile
	rm -f $@
	$(CC) $(LDFLAGS) -o $@ $(UNIKIXSTRT_OBJECTS) $(BASE_UNIX_LIBS) 
	chmod 755 $@

# ********************
#  unikixtran target
# ********************
# Do the following .tbl link only when PLI is in use

unikixtran:	$(BINDIR)/unikixtran
	@echo ""

$(BINDIR)/unikixtran:	$(BINDIR)/unikixtran_$(COBOL_EXT)
	rm -f $@
	mv $? $@
	if [ $(MACHINE) = HP ] && [ -x /opt/langtools/bin/pxdb ] ; \
	then \
	        /opt/langtools/bin/pxdb -s on $@ ; \
	fi
	chmod 755 $@

$(BINDIR)/unikixtran_cob:	$(UNIKIXTRAN_OBJECTS) makefile
	rm -f $@
	$(COBOL) $(COBFLAGS) $(TRAN_COB_OPTS) $(USERSPECOPTIONS) -o $@ \
		$(LINKLIBDIR) \
		$(UNIKIXTRAN_OBJECTS) \
		$(NOCECI_OBJ) \
		$(DBLINKS) \
		$(CINTLIBS) \
		$(RS6_SHR_CB) \
		$(TRAN_UNIX_LIBS) \
		$(TRAN_LIBS)

$(BINDIR)/unikixtran_nocob:	$(UNIKIXTRAN_OBJECTS) makefile
	rm -f $@
	$(CC) $(LDFLAGS) $(PLILDFLAGS) $(USERSPECOPTIONS) -o $@ \
		$(LINKLIBDIR) \
		$(UNIKIXTRAN_OBJECTS) \
		$(NOCECI_OBJ) \
		$(DBLINKS) \
		$(CINTLIBS) \
		$(RS6_SHR_NC) \
		$(TRAN_UNIX_LIBS) \
		$(TRAN_LIBS)

$(USERTRANS)/kxcallkix.o:	$(USERTRANS)/kxcallkix.cbl
	rm -f $@ $(USERTRANS)/kxcallkix.int $(USERTRANS)/kxcallkix.idy
	( cd $(USERTRANS) ; \
	$(COBOL) -vcxo $@ $(USERTRANS)/kxcallkix.cbl )

$(USERTRANS)/kxloadcob.o:	$(USERTRANS)/kxloadcob.cbl
	rm -f $@ $(USERTRANS)/kxloadcob.int $(USERTRANS)/kxloadcob.idy
	( cd $(USERTRANS) ; \
	$(COBOL) -vcxo $@ $(USERTRANS)/kxloadcob.cbl )

# ********************
#  unikixvsam target
# ********************

unikixvsam:	$(BINDIR)/unikixvsam
	@echo ""

$(BINDIR)/unikixvsam:	$(BINDIR)/unikixvsam_$(COBOL_EXT)
	rm -f $@
	mv $? $@
	chmod 755 $@

$(BINDIR)/unikixvsam_cob:	$(UNIKIXVSAM_OBJECTS) makefile
	rm -f $@
	$(COBOL) $(COBFLAGS) $(VSAM_COB_OPTS) $(USERSPECOPTIONS) -o $@ \
		-e ""	-m ixfile=kxvsam \
			-m ixfilev=kxvsam \
			-m rlfile=kxvsam \
			-m rlfilev=kxvsam \
			$(LINKLIBDIR) \
			$(UNIKIXVSAM_OBJECTS) \
			$(DBLINKS) \
			$(VSAM_UNIX_LIBS) $(KXTABLES_LIB)

$(BINDIR)/unikixvsam_nocob: makefile
	rm -f $@
	( cd `dirname $@` ; \
        touch unikixvsam_dummy )
	ln -s $(BINDIR)/unikixvsam_dummy $@

#**********************************************************************
# ---------------------------------------------------------------------
# The following are the system supplied transactions compile options
# to recompile the system supplied transactions do the following.
# The following are not a part of the default all.
#
# make CSSNCESN
#
# ---------------------------------------------------------------------
#**********************************************************************

# 
# ----------- Pseudo conversational transactions ----------
# 

CSSNCESN: 
	COBCPY=$(USERTRANS)
	cd $(USERTRANS); kixbms -c $(USERTRANS)/CSIGNMP.bms
	cd $(USERTRANS); kixclt $(USERTRANS)/CSSNCESN.cl2
	rm -f $(USERTRANS)CSSNCESN.int
	cd $(USERTRANS); $(COBOL) -i $(COBFLAGS) -C $(COBOPT) $(USERTRANS)/CSSNCESN.cbl

