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

3
LIBRARIES = DCDBLib
Axel Auweter's avatar
Axel Auweter committed
4
PROJECTS = FilePusher SysFsPusher CollectAgent ParastationProvider IPMIPusher MontBlancPusher SNMPPusher DCDBTools scripts
5

Axel Auweter's avatar
Axel Auweter committed
6
CASSANDRA_VERSION = 2.1.8
7
8
MOSQUITTO_VERSION = 1.3.5
BOOST_VERSION     = 1.57.0
Axel Auweter's avatar
Axel Auweter committed
9
SNMP_VERSION      = 5.7.3
Axel Auweter's avatar
Axel Auweter committed
10
OPENSSL_VERSION   = 1.0.1p
Axel Auweter's avatar
Axel Auweter committed
11
CPPDRV_VERSION    = 2.0.1
12
LIBUV_VERSION     = 0.10.36
13

14
BOOST_VERSION_U   = $(subst .,_,$(BOOST_VERSION))
15
DISTFILES =	apache-cassandra-$(CASSANDRA_VERSION).tar.gz;http://mirrors.sonic.net/apache/cassandra/$(CASSANDRA_VERSION)/apache-cassandra-$(CASSANDRA_VERSION)-bin.tar.gz \
16
17
		mosquitto-$(MOSQUITTO_VERSION).tar.gz;http://mosquitto.org/files/source/mosquitto-$(MOSQUITTO_VERSION).tar.gz \
		rudeconfig-5.0.5.tar.gz;http://rudeserver.com/config/download/rudeconfig-5.0.5.tar.gz \
Axel Auweter's avatar
Axel Auweter committed
18
		OpenIPMI-2.0.21.tar.gz;http://cznic.dl.sourceforge.net/project/openipmi/OpenIPMI%202.0%20Library/OpenIPMI-2.0.21.tar.gz \
Axel Auweter's avatar
Axel Auweter committed
19
20
		boost_$(BOOST_VERSION_U).tar.gz;http://cznic.dl.sourceforge.net/project/boost/boost/$(BOOST_VERSION)/boost_$(BOOST_VERSION_U).tar.gz \
		net-snmp-$(SNMP_VERSION).zip;http://cznic.dl.sourceforge.net/project/net-snmp/net-snmp/$(SNMP_VERSION)/net-snmp-$(SNMP_VERSION).zip \
Axel Auweter's avatar
Axel Auweter committed
21
		openssl-$(OPENSSL_VERSION).tar.gz;ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/openssl-$(OPENSSL_VERSION).tar.gz \
22
		cpp-driver-$(CPPDRV_VERSION).tar.gz;https://github.com/datastax/cpp-driver/archive/$(CPPDRV_VERSION).tar.gz \
23
		libuv-v$(LIBUV_VERSION).tar.gz;http://dist.libuv.org/dist/v$(LIBUV_VERSION)/libuv-v$(LIBUV_VERSION).tar.gz
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

FETCH = wget -c --no-check-certificate -O -

MAKETHREADS ?= $(if $(findstring $(shell uname),Darwin),$(shell sysctl machdep.cpu.thread_count | cut -b 27-),\
		$(if $(findstring $(shell uname),Linux),$(shell cat /proc/cpuinfo | grep processor | wc -l),4))

CASSANDRA_CLUSTER_NAME                 = Datacenter Monitor Database
CASSANDRA_FLUSH_LARGEST_MEMTABLES_AT   = 0.5
CASSANDRA_REDUCE_CACHE_SIZES_AT        = 0.6
CASSANDRA_REDUCE_CACHE_CAPACITY_TO     = 0.4
CASSANDRA_PARTITIONER                  = org.apache.cassandra.dht.ByteOrderedPartitioner
CASSANDRA_COMMITLOG_TOTAL_SPACE_IN_MB  = 256
CASSANDRA_COMMITLOG_SEGMENT_SIZE_IN_MB = 16

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

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# If cross-compiling for ARM, adjust the build settings
ifeq ("$(ARCH)", "arm")
ifeq ("$(CROSS_COMPILE)", "")
$(error "If you want to cross compile for ARM, you must set the CROSS_COMPILE variable with your cross compiler prefix")
endif
CROSS_COMPILE_STRP = $(CROSS_COMPILE:-=)
CC = "$(CROSS_COMPILE)gcc"
CXX = "$(CROSS_COMPILE)g++"
CMAKE_CROSS_FLAGS = -DCMAKE_C_COMPILER=$(CC) \
			-DCMAKE_CXX_COMPILER=$(CXX) \
			-DCMAKE_FIND_ROOT_PATH=/usr/$(CROSS_COMPILE_STRP) \
			-DCMAKE_LIBRARY_PATH=$(DCDBDEPLOYPATH)/lib \
			-DCMAKE_INCLUDE_PATH=$(DCDBDEPLOYPATH)/include
AUTOCONF_CROSS_FLAGS = --host=$(CROSS_COMPILE_STRP)
SKIP_PROJECTS = IPMIPusher MontBlancPusher
56
OPENSSL_TARGET = "linux-generic32"
57
else
58
OPENSSL_TARGET = $(if $(findstring $(shell uname),Darwin),"darwin64-x86_64-cc","linux-x86_64")
Axel Auweter's avatar
Axel Auweter committed
59
LRT = $(if $(findstring $(shell uname),Darwin),"","-lrt")
60
61
62
63
64
CMAKE_CROSS_FLAGS = ""
AUTOCONF_CROSS_FLAGS = ""
SKIP_PROJECTS = ""
endif

Axel Auweter's avatar
Axel Auweter committed
65
CFLAGS += -I$(DCDBDEPLOYPATH)/include -O2 -g
66
CXX11FLAGS = --std=c++11 -Wno-c99-extensions -Wno-missing-field-initializers -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
Axel Auweter's avatar
Axel Auweter committed
67
LDFLAGS += -L$(DCDBDEPLOYPATH)/lib -O2 -g
68

69
.PHONY : info all clean cleanall distclean check-cross-compile $(LIBRARIES) $(PROJECTS)
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93

info:
	@echo ""
	@echo "DCDB - Data Center Database"
	@echo "Buildsystem description"
	@echo ""
	@echo "Use the DCDBDEPSPATH environment variable to specify a build path for the"
	@echo "dependencies. Currently, the project dependenceis will be built to:"
	@echo "$(DCDBDEPSPATH)"
	@echo ""
	@echo "Use the DCDBDEPLOYPATH environment variable to specifiy the path for deployment"
	@echo "of all tools. Currently, the directory for deployment/staging is:"
	@echo "$(DCDBDEPLOYPATH)"
	@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 modify the number of parallel build threads, you may set the MAKETHREADS"
	@echo "environment variable. Currently, your system is configured to execute a"
	@echo "parallel build with $(MAKETHREADS) threads."
	@echo ""
	@echo "To start, please type:"
	@echo "     make all"
94
95
96
97
	@echo ""
	@echo "For ARM cross compilation, please type:"
	@echo "     make ARCH=arm CROSS_COMPILE=<X> all"
	@echo "where <X> is your cross copmlier prefix ( e.g. arm-linux-gnueabihf- )"
98

99
clean:
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
	@$(foreach l,$(LIBRARIES),echo "Cleaning $(l)..." && make -C $(l) clean && echo;)
	@$(foreach p,$(PROJECTS),echo "Cleaning $(p)..." && make -C $(p) clean && echo;)

cleanall: clean
	@cd $(DCDBDEPSPATH) && rm -f .prerequesites .extract-distfiles .download-distfiles
	@cd $(DCDBDEPSPATH) && rm -rf mosquitto_build
	@$(foreach f,$(DISTFILESPATHS),echo "Cleaning $(f)..." && rm -rf $(DCDBDEPSPATH)/$(f) && echo;)

distclean: clean
	@echo "Wiping dependencies..."
	@rm -rf $(DCDBDEPSPATH)

mrproper: distclean
	$(eval U := $(shell whoami))
	@if [ "$(U)" = "root" ]; then echo "Sorry, I won't allow you to use mrproper as root."; exit 1; fi
	@echo ""
	@echo "Wiping installation directory..."
	@rm -rf $(DCDBDEPLOYPATH)

119
all: check-cross-compile $(DCDBDEPSPATH)/.prerequesites
120
121
122
	@make $(LIBRARIES)
	@make $(PROJECTS)

123
124
125
126
127
128
check-cross-compile:
	@if [ "$(ARCH)" = "arm" ]; then \
		echo "Info: Cross-compiling for ARM using compiler prefix: $(CROSS_COMPILE_STRP)"; \
		echo; \
	fi;

129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
$(DCDBDEPSPATH)/.prerequesites: $(DCDBDEPSPATH)/.extract-distfiles
	@echo ""
	@echo "Preparing patches..."
	@cp -a patches $(DCDBDEPSPATH)/
	
	$(eval S := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*openssl/openssl/' | sed 's/\ .*//'))
	@if [ ! -e $(DCDBDEPSPATH)/$(S)/.installed ]; then \
		echo ""; \
		echo "Building OpenSSL library..."; \
		cd $(DCDBDEPSPATH)/$(S) && ./Configure shared --prefix=$(DCDBDEPLOYPATH) $(OPENSSL_TARGET); \
		cd $(DCDBDEPSPATH)/$(S) && make && make install_sw && touch $(DCDBDEPSPATH)/$(S)/.installed; \
	else \
		echo "Skipping OpenSSL library (already built)..."; \
	fi

	$(eval M := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*mosquitto/mosquitto/' | sed 's/\ .*//'))
	@if [ ! -e $(DCDBDEPSPATH)/$(M)/.installed ]; then \
		echo ""; \
		echo "Building Mosquitto library..."; \
		if [ -e $(DCDBDEPSPATH)/patches/$(M).patch ]; then \
			echo "Patching Mosquitto..."; \
			cd $(DCDBDEPSPATH)/$(M) && (patch -N -p0 < $(DCDBDEPSPATH)/patches/$(M).patch || true); \
		fi; \
		mkdir -p $(DCDBDEPSPATH)/mosquitto_build; \
		cd $(DCDBDEPSPATH)/mosquitto_build && \
154
155
156
157
158
159
160
			cmake $(CMAKE_CROSS_FLAGS) \
				-DOPENSSL_ROOT_DIR=$(DCDBDEPLOYPATH)/ \
				-DWITH_SRV=no \
				-DWITH_TLS=yes \
				-DWITH_TLS_PSK=yes \
				-DCMAKE_INSTALL_PREFIX:PATH=$(DCDBDEPLOYPATH)/ \
				$(DCDBDEPSPATH)/$(M) && \
161
162
163
164
165
166
167
168
169
170
			make -j $(MAKETHREADS) && make install && \
			touch $(DCDBDEPSPATH)/$(M)/.installed; \
	else \
		echo "Skipping Mosquitto library (already built)..."; \
	fi
	
	$(eval R := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*rudeconfig/rudeconfig/' | sed 's/\ .*//'))
	@if [ ! -e $(DCDBDEPSPATH)/$(R)/.installed ]; then \
		echo ""; \
		echo "Building Rudeconfig library..."; \
171
172
173
		cd $(DCDBDEPSPATH)/$(R) && ./configure --prefix=$(DCDBDEPLOYPATH) \
				CC="$(CC)" CFLAGS="$(CFLAGS)" CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" \
				$(AUTOCONF_CROSS_FLAGS) && \
174
175
176
177
178
179
180
181
182
183
			make -j $(MAKETHREADS) && \
			chmod +x install-sh && \
			make install && \
			touch $(DCDBDEPSPATH)/$(R)/.installed; \
	else \
		echo "Skipping Rudeconfig library (already built)..."; \
	fi

	$(eval O := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*OpenIPMI/OpenIPMI/' | sed 's/\ .*//'))
	$(eval X := $(shell uname))
184
185
186
	@if [ "$(ARCH)" = "arm" ]; then \
		echo "Skipping OpenIPMI - does not build on ARM"; \
	elif [ ! -e $(DCDBDEPSPATH)/$(O)/.installed ]; then \
187
188
189
190
191
192
193
194
195
196
		echo ""; \
		echo "Building OpenIPMI library..."; \
		if [ -e $(DCDBDEPSPATH)/patches/$(O).patch ]; then \
			echo "Patching OpenIPMI..."; \
			cd $(DCDBDEPSPATH)/$(O) && (patch -N -p1 < $(DCDBDEPSPATH)/patches/$(O).patch || true); \
		fi; \
		if [ "$(X)" == "Darwin" ]; then \
			echo "Fixing OpenIPMI for Mac OS..."; \
			cd $(DCDBDEPSPATH)/$(O) && find . -name 'Makefile*' | xargs sed -i '' -e 's/Map/map/g'; \
		fi; \
197
198
		cd $(DCDBDEPSPATH)/$(O) && aclocal && automake; \
		cd $(DCDBDEPSPATH)/$(O) && ./configure --prefix=$(DCDBDEPLOYPATH) --with-swig=no --with-perl=no --with-python=no \
Axel Auweter's avatar
Axel Auweter committed
199
			CC="$(CC)" CFLAGS="$(CFLAGS) $(LRT)" \
200
			$(AUTOCONF_CROSS_FLAGS); \
Axel Auweter's avatar
Axel Auweter committed
201
		echo "LRT = $(LRT)" && cd $(DCDBDEPSPATH)/$(O) && make -j $(MAKETHREADS) && make install && touch $(DCDBDEPSPATH)/$(O)/.installed; \
202
203
204
205
206
207
208
209
210
211
212
213
	else \
		echo "Skipping OpenIPMI library (already built)..."; \
	fi
	
	$(eval B := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*boost/boost/' | sed 's/\ .*//'))
	@if [ ! -e $(DCDBDEPSPATH)/$(B)/.installed ]; then \
		echo ""; \
		echo "Building Boost..."; \
		if [ -e $(DCDBDEPSPATH)/patches/$(B).patch ]; then \
			echo "Patching Boost..."; \
			cd $(DCDBDEPSPATH)/$(B) && (patch -N -p2 < $(DCDBDEPSPATH)/patches/$(B).patch || true); \
		fi; \
214
215
216
		if [ "$(ARCH)" = "arm" ]; then \
			echo " using gcc : arm : $(CROSS_COMPILE)g++ ; " > $(DCDBDEPSPATH)/$(B)/tools/build/src/user-config.jam; \
		fi; \
217
		cd $(DCDBDEPSPATH)/$(B) && ./bootstrap.sh --prefix=$(DCDBDEPLOYPATH) \
218
			--with-libraries=atomic,chrono,date_time,exception,filesystem,program_options,random,regex,system,thread,timer; \
219
		cd $(DCDBDEPSPATH)/$(B) && \
220
			./b2 -j $(MAKETHREADS) cxxflags="$(CXX11FLAGS)" install && touch $(DCDBDEPSPATH)/$(B)/.installed; \
221
222
223
224
225
226
227
228
229
230
231
232
	else \
		echo "Skipping Boost (already built)..."; \
	fi

	$(eval S := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*net-snmp/net-snmp/' | sed 's/\ .*//'))
	@if [ ! -e $(DCDBDEPSPATH)/$(S)/.installed ]; then \
		echo ""; \
		echo "Building net-snmp..."; \
		if [ -e $(DCDBDEPSPATH)/patches/$(S).patch ]; then \
			echo "Patching net-snmp..."; \
			cd $(DCDBDEPSPATH)/$(S) && (patch -N -p1 < $(DCDBDEPSPATH)/patches/$(S).patch || true); \
		fi; \
233
		cd $(DCDBDEPSPATH)/$(S) && env CC="$(CC)" CFLAGS="$(CFLAGS)" ./configure --prefix=$(DCDBDEPLOYPATH) --with-default-snmp-version="3" \
234
235
			--with-sys-contact="@@no.where" --with-sys-location="Unknown" --with-logfile="$(DCDBDEPLOYPATH)/var/log/snmpd.log" \
			--with-persistent-directory="$(DCDBDEPLOYPATH)/var/net-snmp" --disable-embedded-perl --without-perl-modules \
236
			--with-openssl=$(DCDBDEPLOYPATH) $(AUTOCONF_CROSS_FLAGS); \
237
238
239
240
241
242
243
244
245
246
		cd $(DCDBDEPSPATH)/$(S) && env CFLAGS="$(CFLAGS)" make -j $(MAKETHREADS) && make install && touch $(DCDBDEPSPATH)/$(S)/.installed; \
	else \
		echo "Skipping net-snmp (already built)..."; \
	fi

	$(eval U := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*libuv/libuv/' | sed 's/\ .*//'))
	@if [ ! -e $(DCDBDEPSPATH)/$(U)/.installed ]; then \
		echo ""; \
		echo "Building libuv..."; \
		cd $(DCDBDEPSPATH)/$(U) && \
247
		env CC="$(CC)" CFLAGS="$(CFLAGS)" make -j $(MAKETHREADS); \
248
249
250
251
252
253
254
255
256
257
258
259
260
261
		echo "Installing libuv..."; \
		mkdir -p $(DCDBDEPLOYPATH)/include/uv-private; \
		cd $(DCDBDEPSPATH)/$(U) && install -c include/uv.h $(DCDBDEPLOYPATH)/include/; \
		cd $(DCDBDEPSPATH)/$(U) && install -c include/uv-private/* $(DCDBDEPLOYPATH)/include/uv-private/; \
		mkdir -p $(DCDBDEPLOYPATH)/lib/; \
		if [ -e $(DCDBDEPSPATH)/$(U)/libuv.a ]; then cd $(DCDBDEPSPATH)/$(U) && install -c libuv.a $(DCDBDEPLOYPATH)/lib/; fi; \
		if [ -e $(DCDBDEPSPATH)/$(U)/libuv.so ]; then cd $(DCDBDEPSPATH)/$(U) && install -c libuv.so $(DCDBDEPLOYPATH)/lib/; ln -s $(DCDBDEPLOYPATH)/lib/libuv.so $(DCDBDEPLOYPATH)/lib/libuv.so.0.10; fi; \
		if [ -e $(DCDBDEPSPATH)/$(U)/libuv.dylib ]; then cd $(DCDBDEPSPATH)/$(U) && install -c libuv.dylib $(DCDBDEPLOYPATH)/lib/; fi; \
		touch $(DCDBDEPSPATH)/$(U)/.installed; \
	else \
		echo "Skipping libuv (already built)..."; \
	fi

	$(eval D := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*cpp-driver/cpp-driver/' | sed 's/\ .*//'))
262
	@if [ ! -e $(DCDBDEPSPATH)/$(D)/.installed ]; then \
263
264
265
266
267
268
269
270
		echo ""; \
		echo "Building cpp-driver..."; \
		if [ -e $(DCDBDEPSPATH)/patches/$(D).patch ]; then \
			echo "Patching cpp-driver..."; \
			cd $(DCDBDEPSPATH)/$(D) && (patch -N -p1 < $(DCDBDEPSPATH)/patches/$(D).patch || true); \
		fi; \
		mkdir -p $(DCDBDEPSPATH)/cpp-driver_build; \
		cd $(DCDBDEPSPATH)/cpp-driver_build && \
Axel Auweter's avatar
Axel Auweter committed
271
			cmake $(CMAKE_CROSS_FLAGS) \
272
				-DCMAKE_CXX_FLAGS="$(CXX11FLAGS) -Wno-unused-command-line-argument -L$(DCDBDEPLOYPATH)/lib " \
273
				-DOPENSSL_ROOT_DIR=$(DCDBDEPLOYPATH)/ \
274
				-DLIBUV_ROOT_DIR=$(DCDBDEPLOYPATH)/ \
275
				-DCASS_BUILD_EXAMPLES=NO \
Axel Auweter's avatar
Axel Auweter committed
276
				-DCMAKE_INSTALL_LIBDIR=lib \
277
278
				-DCMAKE_INSTALL_PREFIX=$(DCDBDEPLOYPATH)/ \
				-DCMAKE_EXE_LINKER_FLAGS="-L$(DCDBDEPLOYPATH)/lib -lboost_random" \
Axel Auweter's avatar
Axel Auweter committed
279
				-DCMAKE_SHARED_LINKER_FLAGS="-L$(DCDBDEPLOYPATH)/lib -lboost_random" \
280
				$(DCDBDEPSPATH)/$(D) && \
281
282
			make -j $(MAKETHREADS) && make install && \
			touch $(DCDBDEPSPATH)/$(D)/.installed; \
283
284
285
286
287
288
289
	else \
		echo "Skipping cpp-driver (already built)..."; \
	fi

	@echo ""
	@echo "Staging and configuring Cassandra..."
	@$(eval C := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*apache-cassandra/apache-cassandra/' | sed 's/\ .*//'))
290
	@rsync -rlptD $(DCDBDEPSPATH)/$(C)/ $(DCDBDEPLOYPATH)/cassandra
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
	@$(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 -e 's/.*cluster_name:.*/cluster_name:\ '\''$(CASSANDRA_CLUSTER_NAME)'\''/' $(DCDBDEPLOYPATH)/cassandra/conf/cassandra.yaml
	@sed -i -e 's/.*flush_largest_memtables_at:.*/flush_largest_memtables_at:\ $(CASSANDRA_FLUSH_LARGEST_MEMTABLES_AT)/' $(DCDBDEPLOYPATH)/cassandra/conf/cassandra.yaml
	@sed -i -e 's/.*reduce_cache_sizes_at:.*/reduce_cache_sizes_at:\ $(CASSANDRA_REDUCE_CACHE_SIZES_AT)/' $(DCDBDEPLOYPATH)/cassandra/conf/cassandra.yaml
	@sed -i -e 's/.*reduce_cache_capacity_to:.*/reduce_cache_capacity_to:\ $(CASSANDRA_REDUCE_CACHE_CAPACITY_TO)/' $(DCDBDEPLOYPATH)/cassandra/conf/cassandra.yaml
	@sed -i -e 's/.*partitioner:.*/partitioner:\ $(CASSANDRA_PARTITIONER)/' $(DCDBDEPLOYPATH)/cassandra/conf/cassandra.yaml
	@sed -i -e 's/.*commitlog_total_space_in_mb:.*/commitlog_total_space_in_mb: $(CASSANDRA_COMMITLOG_TOTAL_SPACE_IN_MB)/' $(DCDBDEPLOYPATH)/cassandra/conf/cassandra.yaml
	@sed -i -e 's/.*commitlog_segment_size_in_mb:.*/commitlog_segment_size_in_mb: $(CASSANDRA_COMMITLOG_SEGMENT_SIZE_IN_MB)/' $(DCDBDEPLOYPATH)/cassandra/conf/cassandra.yaml

	@touch $(DCDBDEPSPATH)/.prerequesites
	
$(DCDBDEPSPATH)/.extract-distfiles: $(foreach f,$(DISTFILESPATHS),$(DCDBDEPSPATH)/$(f)/.dirstamp)
	@touch $(DCDBDEPSPATH)/.extract-distfiles
	
$(DCDBDEPSPATH)/.download-distfiles: $(foreach f,$(DISTFILESNAMES),$(DCDBDEPSPATH)/distfiles/$(f))
	@touch $(DCDBDEPSPATH)/.download-distfiles

$(DCDBDEPSPATH)/distfiles/%: 
	@mkdir -p $(DCDBDEPSPATH)/distfiles
	$(eval F := $(shell echo "$@" | sed 's/.*\///'))
	$(eval FF := $(shell echo "$(DISTFILES)" | sed 's/.*$(F);//' | sed 's/ .*//'))
	@echo "Downloading $(FF) as $(F)..."
	@cd $(DCDBDEPSPATH)/distfiles && $(FETCH) $(FF) > $(F)

$(DCDBDEPSPATH)/%/.dirstamp: $(DCDBDEPSPATH)/.download-distfiles
	$(eval F := $(shell echo "$@" | sed 's/\/.dirstamp//' | sed 's/.*\///'))
	@echo "Extracting $(F)..."
	@if [ "$(suffix $(shell ls $(DCDBDEPSPATH)/distfiles/$(F)*))" = ".gz" ]; then \
		cd $(DCDBDEPSPATH) && tar xzf distfiles/$(F).tar.gz; \
	else \
		cd $(DCDBDEPSPATH) && unzip distfiles/$(F).zip > /dev/null; \
	fi
	@touch $@

$(LIBRARIES): $(DCDBDEPSPATH)/.prerequesites
	@echo ""
	@echo "Building Library $@..."
329
	@$(MAKE) -j $(MAKETHREADS) CC=$(CC) CXX=$(CXX) -C $@
330
	@echo "Installing Library $@..."
331
	@$(MAKE) CC=$(CC) CXX=$(CXX) -C $@ install
332

333
$(PROJECTS):
334
	$(eval X := $(shell echo "$(SKIP_PROJECTS)" | grep "$@"))
335
	@if [ "$(X)" = "" ]; then \
336
337
338
339
340
341
342
343
344
		echo ""; \
		echo "Building $@..."; \
		$(MAKE) -j $(MAKETHREADS) CC=$(CC) CXX=$(CXX) -C $@ ; \
		echo "Installing $@..."; \
		$(MAKE) CC=$(CC) CXX=$(CXX) -C $@ install ; \
	else \
		echo ""; \
		echo "Skipping $@..."; \
	fi