Makefile 5.01 KB
Newer Older
Michael Ott's avatar
Michael Ott committed
1
2
include config.mk

3
PROJECTS = FilePusher SysFsPusher CollectAgent ParastationProvider
4
5
6
7
8
9
DISTFILES = thrift-0.9.0.tar.gz;https://dist.apache.org/repos/dist/release/thrift/0.9.0/thrift-0.9.0.tar.gz \
		apache-cassandra-1.2.3.tar.gz;http://mirror.netcologne.de/apache.org/cassandra/1.2.3/apache-cassandra-1.2.3-bin.tar.gz \
		mosquitto-1.1.3.tar.gz;http://mosquitto.org/files/source/mosquitto-1.1.3.tar.gz \
		rudeconfig-5.0.5.tar.gz;http://rudeserver.com/config/download/rudeconfig-5.0.5.tar.gz \
		boost_1_53_0.tar.gz;http://netcologne.dl.sourceforge.net/project/boost/boost/1.53.0/boost_1_53_0.tar.gz
FETCH = wget -c --no-check-certificate -O -
Axel Auweter's avatar
Axel Auweter committed
10
MAKETHREADS = 4
11
12
13
14

DISTFILESNAMES = $(foreach f,$(DISTFILES),$(shell echo "$(f)" | sed 's/;.*//'))
DISTFILESPATHS = $(foreach f,$(DISTFILES),$(shell echo "$(f)" | sed 's/.tar.gz;.*//'))

15
.PHONY : info all clean cleanall distclean $(PROJECTS)
16
17
18
19
20
21

info:
	@echo ""
	@echo "DCDB - Data Center Database"
	@echo "Buildsystem description"
	@echo ""
Michael Ott's avatar
Michael Ott committed
22
	@echo "Use the DCDBDEPSPATH environment variable to specify a build path."
23
	@echo "Currently, the project will be built to:"
Michael Ott's avatar
Michael Ott committed
24
	@echo "$(DCDBDEPSPATH)"
25
	@echo ""
26
27
	@echo "Use the DCDBDEPLOYPATH environment variable to specifiy the path for deployment"
	@echo "of all tools. Currently, the directory for deployment/staging is:"
28
	@echo "$(DCDBDEPLOYPATH)"
29
30
31
32
33
34
35
	@echo ""
	@echo "There should only be a few requirements to build DCDB."
	@echo "On Ubuntu, these are: build-essential, cmake, libssl-dev"
	@echo "To run Cassandra, you should also have a JAVA runtime installed."
	@echo ""
	@echo "To start, please type:"
	@echo "     make all"
36
37

clean:
Michael Ott's avatar
Michael Ott committed
38
	@$(foreach p,$(PROJECTS),echo "Cleaning $(p)..." && make -C $(p) clean && echo;)
39
40

cleanall: clean
Michael Ott's avatar
Michael Ott committed
41
42
	@cd $(DCDBDEPSPATH) && rm -f .prerequesites .extract-distfiles .download-distfiles
	@cd $(DCDBDEPSPATH) && rm -rf mosquitto_build
Michael Ott's avatar
Michael Ott committed
43
	@$(foreach f,$(DISTFILESPATHS),echo "Cleaning $(f)..." && rm -rf $(DCDBDEPSPATH)/$(f) && echo;)
44

Michael Ott's avatar
Michael Ott committed
45
46
distclean: clean
	@echo "Wiping dependencies..."
Michael Ott's avatar
Michael Ott committed
47
	@rm -rf $(DCDBDEPSPATH)
48

Michael Ott's avatar
Michael Ott committed
49
all: $(DCDBDEPSPATH)/.prerequesites
50
	make $(PROJECTS)
51

Michael Ott's avatar
Michael Ott committed
52
$(DCDBDEPSPATH)/.prerequesites: $(DCDBDEPSPATH)/.extract-distfiles
53
54
	@echo ""
	@echo "Building Mosquitto library..."
Michael Ott's avatar
Michael Ott committed
55
	@mkdir -p $(DCDBDEPSPATH)/mosquitto_build
56
	$(eval M := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*mosquitto/mosquitto/' | sed 's/\ .*//'))
Michael Ott's avatar
Michael Ott committed
57
	@cd $(DCDBDEPSPATH)/mosquitto_build && cmake -DWITH_TLS=OFF -DCMAKE_INSTALL_PREFIX:PATH=$(DCDBDEPLOYPATH)/ $(DCDBDEPSPATH)/$(M) && make -j $(MAKETHREADS) && make install
58
59
60
61
	
	@echo ""
	@echo "Building Rudeconfig library..."
	$(eval R := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*rudeconfig/rudeconfig/' | sed 's/\ .*//'))
Michael Ott's avatar
Michael Ott committed
62
	@cd $(DCDBDEPSPATH)/$(R) && ./configure --prefix=$(DCDBDEPLOYPATH) && make -j $(MAKETHREADS) && chmod +x install-sh && make install
63
64
65
66
	
	@echo ""
	@echo "Building Boost..."
	$(eval B := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*boost/boost/' | sed 's/\ .*//'))
Michael Ott's avatar
Michael Ott committed
67
	@cd $(DCDBDEPSPATH)/$(B) && ./bootstrap.sh --prefix=$(DCDBDEPLOYPATH) --with-libraries=atomic,chrono,date_time,exception,filesystem,program_options,thread,timer && ./b2 -j $(MAKETHREADS) install
68
69
70
71

	@echo ""
	@echo "Buidling Thrift..."
	$(eval T := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*thrift/thrift/' | sed 's/\ .*//'))
Michael Ott's avatar
Michael Ott committed
72
	@cd $(DCDBDEPSPATH)/$(T) && ./configure --prefix=$(DCDBDEPLOYPATH) --without-qt4 --without-csharp \
73
74
75
		--without-java --without-erlang --without-python --without-perl --without-php --without-php_extension \
		--without-ruby --without-haskell --without-go --without-d --with-cpp --with-boost=$(DCDBDEPLOYPATH) && make && make install

76
77
78
	@echo ""
	@echo "Staging and configuring Cassandra..."
	@$(eval C := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*apache-cassandra/apache-cassandra/' | sed 's/\ .*//'))
Michael Ott's avatar
Michael Ott committed
79
	@rsync -a $(DCDBDEPSPATH)/$(C)/ $(DCDBDEPLOYPATH)/cassandra
80
81
82
83
	@$(eval P := $(shell echo "$(DCDBDEPLOYPATH)" | sed 's/\//\\\//g'))
	@sed -i.original -e 's/\/var\/lib\/cassandra/$(P)\/var\/lib\/cassandra/g' $(DCDBDEPLOYPATH)/cassandra/conf/cassandra.yaml
	@sed -i.original -e 's/\/var\/log\/cassandra/$(P)\/var\/log\/cassandra/g' $(DCDBDEPLOYPATH)/cassandra/conf/log4j-server.properties

Michael Ott's avatar
Michael Ott committed
84
	@touch $(DCDBDEPSPATH)/.prerequesites
85
	
Michael Ott's avatar
Michael Ott committed
86
87
$(DCDBDEPSPATH)/.extract-distfiles: $(foreach f,$(DISTFILESPATHS),$(DCDBDEPSPATH)/$(f)/.dirstamp)
	@touch $(DCDBDEPSPATH)/.extract-distfiles
88
	
Michael Ott's avatar
Michael Ott committed
89
90
$(DCDBDEPSPATH)/.download-distfiles: $(foreach f,$(DISTFILESNAMES),$(DCDBDEPSPATH)/distfiles/$(f))
	@touch $(DCDBDEPSPATH)/.download-distfiles
91

Michael Ott's avatar
Michael Ott committed
92
93
$(DCDBDEPSPATH)/distfiles/%: 
	@mkdir -p $(DCDBDEPSPATH)/distfiles
94
95
96
	$(eval F := $(shell echo "$@" | sed 's/.*\///'))
	$(eval FF := $(shell echo "$(DISTFILES)" | sed 's/.*$(F);//' | sed 's/ .*//'))
	@echo "Downloading $(FF) as $(F)..."
Michael Ott's avatar
Michael Ott committed
97
	@cd $(DCDBDEPSPATH)/distfiles && $(FETCH) $(FF) > $(F)
98

Michael Ott's avatar
Michael Ott committed
99
$(DCDBDEPSPATH)/%/.dirstamp: $(DCDBDEPSPATH)/.download-distfiles
100
101
	$(eval F := $(shell echo "$@" | sed 's/\/.dirstamp//' | sed 's/.*\///'))
	@echo "Extracting $(F)..."
Michael Ott's avatar
Michael Ott committed
102
	@cd $(DCDBDEPSPATH) && tar xzf distfiles/$(F).tar.gz
103
104
	@touch $@

Michael Ott's avatar
Michael Ott committed
105
$(PROJECTS): $(DCDBDEPSPATH)/.prerequesites
Michael Ott's avatar
Michael Ott committed
106
	@echo ""
107
	@echo "Building $@..."
Michael Ott's avatar
Michael Ott committed
108
	@$(MAKE) -C $@ 
109
	@echo "Installing $@..."
Michael Ott's avatar
Michael Ott committed
110
	@$(MAKE) -C $@ install