Makefile 1.84 KB
Newer Older
1
CXXFLAGS =	-O0 -g -Wall -fmessage-length=0 -I../../thrift/lib/cpp/src/ -I/opt/local/include/ -I../../mosquitto-1.1/lib/
2
3
4

OBJS =		CollectAgent.o cassandra/Cassandra.o cassandra/cassandra_constants.o cassandra/cassandra_types.o

5
LIBS =		-L../../thrift/lib/cpp/.libs/ -lthrift -L../../mosquitto-1.1/lib/ -lmosquitto -lssl -lcrypto -lpthread
6
7
8

TARGET =	CollectAgent

9
10
11
SUBTARGETS = cassandra-lib check-thrift-env

P =		$(shell cd ../../thrift/lib/cpp/.libs/;pwd)
12
Q =		$(shell cd ../../mosquitto-1.1/lib/;pwd)
13
U =		$(shell uname)
14
15
16
17
18
19

$(TARGET):	$(SUBTARGETS) $(OBJS) 
	$(CXX) -o $(TARGET) $(OBJS) $(LIBS)

all:	$(TARGET)

20
21
22
23
check-thrift-env:
	@if [ "$U" = "Darwin" ]; then \
	R=`echo $$DYLD_LIBRARY_PATH | grep $P`; \
	if [ "$$R" = "" ]; then \
24
	echo "******************************************"; echo "Please type the following line before running: "; echo '  export DYLD_LIBRARY_PATH=$$DYLD_LIBRARY_PATH:$P'; echo "******************************************"; \
25
26
	fi; \
	fi
27
28
29
30
31
32
33
	@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:$Q'; echo "******************************************"; \
	fi; \
	fi

34

35
cassandra-lib: cassandra-headers
36
37
38
39
40
41
	@if [ "$U" = "Linux" ]; then \
	echo -n "Fixing Thrift includes... "; \
	sed -i '1i#include <stdint.h>' cassandra/cassandra_types.h; \
	sed -i '1i#include <stdint.h>' cassandra/Cassandra.h; \
	echo "Done."; \
	fi
42
43
44
45
46
47
48
49
50
51
52
53
54

cassandra-headers:
	@if [ ! -e cassandra ]; then \
	printf "Building Thrift interface headers... "; \
	../../thrift/compiler/cpp/thrift --gen cpp ../../cassandra/interface/cassandra.thrift; \
	mv gen-cpp cassandra; \
	echo "Done."; \
	fi

clean: clean-cassandra-headers
	rm -f $(OBJS) $(TARGET)

clean-cassandra-headers:
55
	rm -rf cassandra