include ../config.mk CXXFLAGS = $(shell ./cxx11flags.sh $(CXX) -O0 -g -Wall -Wno-null-conversion -fmessage-length=0 -I$(DCDBDEPLOYPATH)/include/) OBJS = collectagent.o simplemqttserver.o simplemqttserverthread.o cassandra/Cassandra.o cassandra/cassandra_constants.o cassandra/cassandra_types.o SRC = $(patsubst cassandra/%,,$(OBJS:.o=.cpp)) LIBS = -L$(DCDBDEPLOYPATH)/lib/ -lthrift -lmosquitto -lssl -lcrypto -lpthread -lboost_system TARGET = collectagent SUBTARGETS = cassandra/Cassandra.h .PHONY : check-thrift-env clean clean-cassandra-headers install P = $(shell cd $(DCDBDEPLOYPATH)/lib/ && pwd) U = $(shell uname) $(TARGET): $(SRC) $(MAKE) cassandra/Cassandra.h $(MAKE) $(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 \ printf "\n******************************************\nPlease type the following line before running:\n export DYLD_LIBRARY_PATH=$$DYLD_LIBRARY_PATH:$P\n******************************************\n"; \ fi; \ fi @if [ "$U" = "Linux" ]; then \ R=`echo $$LD_LIBRARY_PATH | grep $P`; \ if [ "$$R" = "" ]; then \ printf "\n******************************************\nPlease type the following line before running:\n export LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$P\n******************************************\n"; \ fi; \ fi cassandra/Cassandra.h: @if [ ! -e cassandra ]; then \ printf "Building Thrift interface headers... "; \ $(DCDBDEPLOYPATH)/bin/thrift --gen cpp $(DCDBDEPLOYPATH)/cassandra/interface/cassandra.thrift; \ mv gen-cpp cassandra; \ echo "Done."; \ fi @if [ "$U" = "Linux" ]; then \ echo "Fixing Thrift includes... "; \ grep stdint cassandra/cassandra_types.h > /dev/null; \ if [ "$$?" -eq "1" ]; then sed -i '1i#include ' cassandra/cassandra_types.h; fi;\ grep stdint cassandra/Cassandra.h > /dev/null; \ if [ "$$?" -eq "1" ]; then sed -i '1i#include ' cassandra/Cassandra.h; fi;\ fi clean: clean-cassandra-headers rm -f $(OBJS) $(TARGET) clean-cassandra-headers: rm -rf cassandra install: $(TARGET) check-thrift-env install $(TARGET) $(DCDBDEPLOYPATH)/bin/