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

################################################################################
######################## Sample Makefile for MQSeries ##########################
################################################################################


#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# The MQDIR variable below should be set to reference the installation
# directory of MQSeries on your machine.
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------

.SUFFIXES: .o .cl2 .cbl .gnt

.cl2.gnt:
	@echo "COBCPY=$(COBCPY)" ;
	rm -f $*.cbl ;
	rm -f $*.gnt ;
	rm -f $*.int ;
	kixclt $*.cl2 ;
	COBOPT=$(COBOPT) cob -u $*.cbl ;

.c.o:
	echo "Compile module $<" ; \
	rm -f $*.o ; \
	cc $(CFLAGS) -c $< ;

#
# Platform specific definitions
# Uncomment the correct ones for your platform
#

# HP-UX
#MQDIR=/opt/mqm
#CFLAGS=-Ae -I$(MQDIR)/inc
#LFLAGS=-L$(MQDIR)/lib -lmqic

# Solaris
#MQDIR=/opt/mqm
#CFLAGS=-I$(MQDIR)/inc
#LFLAGS=-L$(MQDIR)/lib -lmqic -lmqmcs

# AIX
#MQDIR=/usr/lpp/mqm
#CFLAGS=-I$(MQDIR)/inc
#LFLAGS=-L$(MQDIR)/lib -lmqic_r

COBOPT="kx_cobopt"

CSOURCES=\
	kixmqtst.c \
	kixmqerr.c

OBJECTS=\
	kixmqtst.o \
	kixmqerr.o

CLEANOBJECTS=\
	$(OBJECTS) \
	$(EXECUTABLES) \
	KIXMQ01.gnt \
	KIXMQ01.int \
	KIXMQ01.cbl

EXECUTABLES=\
	kixmqtst

all:
	@-if [ "$(MQDIR)" = "" ] ; \
	then \
	    echo Uncomment platform specific MQDIR first ; \
	else \
	    make programs transactions ; \
	fi

transactions: KIXMQ01.gnt

programs: kixmqtst

kixmqtst: $(OBJECTS)
	cc -o $@ $(LFLAGS) $(OBJECTS)

clean:
	rm -f $(CLEANOBJECTS)

kixmqtst.o: kixmqerr.h
kixmqerr.o: kixmqerr.h
