#
# This Makefile is intended to work in the RHEL3 release structure.
# It is a simple example to get users up and running.
#

CXXFLAGS := -DNDEBUG -DUSE_APR -MMD -fpic

#
# Configure Boost.
#
BOOST_LOCATION := ../lib/boost-1.33.1
BOOST_CFLAGS := -I$(BOOST_LOCATION)/include/boost-1_33_1

CXXFLAGS := $(CXXFLAGS) $(BOOST_CFLAGS)

#
# Configure APR.
#
APR_LOCATION := ../lib/apr-1.2.7
APR_CFLAGS := -I$(APR_LOCATION)/include/apr-1
APR_LDFLAGS := $(shell $(APR_LOCATION)/bin/apr-1-config --libs) -L$(APR_LOCATION)/lib -lapr-1

CXXFLAGS := $(CXXFLAGS) $(APR_CFLAGS)
LDFLAGS := $(LDFLAGS) $(APR_LDFLAGS)

#
# Configure Qpid cpp client.
#

QPID_CLIENT_LDFLAGS := ../lib/libqpid_common.so.1.0 ../lib/libqpid_client.so.1.0
QPID_CLIENT_CFLAGS := -I../include

CXXFLAGS := $(CXXFLAGS) $(QPID_CLIENT_CFLAGS)
LDFLAGS := $(LDFLAGS) $(QPID_CLIENT_LDFLAGS)

CXX := g++

#
# Add rule to build examples.
#
.SUFFIX: .cpp
%: %.cpp
	$(CXX) $(CXXFLAGS) $(LDFLAGS) $< -o $@

#
# Define targets.
#

EXAMPLES := client_test topic_listener topic_publisher

.PHONY:
all: $(EXAMPLES)

.PHONY:
clean:
	-rm $(EXAMPLES)
