DCDBBUILDPATH ?= /tmp/dcdb/build/ DCDBDEPLOYPATH ?= $(DCDBBUILDPATH)/deploy/ CXXFLAGS = -O0 -g -Wall -fmessage-length=0 -I$(DCDBDEPLOYPATH)/include/ OBJS = CollectAgent.o cassandra/Cassandra.o cassandra/cassandra_constants.o cassandra/cassandra_types.o LIBS = -L$(DCDBDEPLOYPATH)/lib/ -lthrift -lmosquitto -lssl -lcrypto -lpthread TARGET = CollectAgent SUBTARGETS = cassandra-lib P = $(shell cd $(DCDBDEPLOYPATH)/lib/ && pwd) U = $(shell uname) $(TARGET): $(SUBTARGETS) $(OBJS) $(CXX) -o $(TARGET) $(OBJS) $(LIBS) all: $(TARGET) check-thrift-env: @if [ "$U" = "Darwin" ]; then \ R=`echo $$DYLD_LIBRARY_PATH | grep $P`; \ if [ "$$R" = "" ]; then \ echo "******************************************"; echo "Please type the following line before running: "; echo ' export DYLD_LIBRARY_PATH=$$DYLD_LIBRARY_PATH:$P'; echo "******************************************"; \ fi; \ fi @if [ "$U" = "Linux" ]; then \ R=`echo $$LD_LIBRARY_PATH | grep $P`; \ if [ "$$R" = "" ]; then \ echo "******************************************"; echo "Please type the following line before running: "; echo ' export LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$P'; echo "******************************************"; \ fi; \ fi cassandra-lib: cassandra @if [ "$U" = "Linux" ]; then \ echo -n "Fixing Thrift includes... "; \ sed -i '1i#include ' cassandra/cassandra_types.h; \ sed -i '1i#include ' cassandra/Cassandra.h; \ echo "Done."; \ fi cassandra: @if [ ! -e cassandra ]; then \ printf "Building Thrift interface headers... "; \ $(DCDBDEPLOYPATH)/bin/thrift --gen cpp $(DCDBBUILDPATH)/apache-cassandra-1.2.3/interface/cassandra.thrift; \ mv gen-cpp cassandra; \ echo "Done."; \ fi clean: clean-cassandra-headers rm -f $(OBJS) $(TARGET) clean-cassandra-headers: rm -rf cassandra install: $(TARGET) check-thrift-env install $(TARGET) $(DCDBDEPLOYPATH)/bin/