Commit 83af643a authored by Michael Ott's avatar Michael Ott
Browse files

Modify Makefile to accomodate split source trees

parent 81c6eeb6
include ../config.mk include ../config.mk
CXXFLAGS = -O2 -g --std=c++11 -Wall -Wno-unused-local-typedefs -Wno-deprecated-declarations -Wno-unknown-warning-option -fmessage-length=0 -I$(DCDBDEPLOYPATH)/include/ -I$(DCDBBASEPATH)/include/ -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG -I$(DCDBDEPSPATH)/cpp-netlib-0.12.0-final/deps/asio/asio/include -I$(DCDBDEPSPATH)/cpp-netlib-0.12.0-final -I$(DCDBDEPSPATH)/cpp-netlib-0.12.0-final/deps/cxxopts/src -DASIO_HEADER_ONLY -DBOOST_TEST_DYN_LINK CXXFLAGS = -O2 -g --std=c++11 -Wall -Wno-unused-local-typedefs -Wno-deprecated-declarations -Wno-unknown-warning-option -fmessage-length=0 -I$(DCDBDEPLOYPATH)/include/ -I../include/ -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG -I$(DCDBDEPSPATH)/cpp-netlib-0.12.0-final/deps/asio/asio/include -I$(DCDBDEPSPATH)/cpp-netlib-0.12.0-final -I$(DCDBDEPSPATH)/cpp-netlib-0.12.0-final/deps/cxxopts/src -DASIO_HEADER_ONLY -DBOOST_TEST_DYN_LINK
OBJS = collectagent.o \ OBJS = collectagent.o \
sensorcache.o \ sensorcache.o \
......
MAKEFILENAME := $(lastword $(MAKEFILE_LIST)) MAKEFILENAME := $(lastword $(MAKEFILE_LIST))
include config.mk
LIBRARIES = lib LIBRARIES = lib
PROJECTS = CollectAgent tools scripts PROJECTS = CollectAgent tools scripts
...@@ -22,13 +21,9 @@ DISTFILES = apache-cassandra-$(CASSANDRA_VERSION).tar.gz;http://archive.apache.o ...@@ -22,13 +21,9 @@ DISTFILES = apache-cassandra-$(CASSANDRA_VERSION).tar.gz;http://archive.apache.o
libuv-v$(LIBUV_VERSION).tar.gz;http://dist.libuv.org/dist/v$(LIBUV_VERSION)/libuv-v$(LIBUV_VERSION).tar.gz \ libuv-v$(LIBUV_VERSION).tar.gz;http://dist.libuv.org/dist/v$(LIBUV_VERSION)/libuv-v$(LIBUV_VERSION).tar.gz \
cpp-netlib-$(CPPNET_VERSION).tar.gz;http://downloads.cpp-netlib.org/0.12.0/cpp-netlib-$(CPPNET_VERSION).tar.gz cpp-netlib-$(CPPNET_VERSION).tar.gz;http://downloads.cpp-netlib.org/0.12.0/cpp-netlib-$(CPPNET_VERSION).tar.gz
DISTFILES_HASHES = apache-cassandra-2.2.6.tar.gz;8e2a8696ced6c4f9db06c40b2f5a7936;mosquitto-1.3.5.tar.gz;55094ad4dc7c7985377f43d4fc3d09da;boost_1_58_0.tar.gz;5a5d5614d9a07672e1ab2a250b5defc5;openssl-1.0.1u.tar.gz;130bb19745db2a5a09f22ccbbf7e69d0;cpp-driver-2.0.1.tar.gz;70bf83e1cbd0d35b7e5ed66fc4dccbb1;libuv-v0.10.36.tar.gz;8eb77b4fee4f311c114a9fee06f5a2ab;cpp-netlib-0.12.0-final.tar.gz;29b87c0e8c1a9e7fbdea5afcec947d53 DISTFILES_HASHES = apache-cassandra-2.2.6.tar.gz|8e2a8696ced6c4f9db06c40b2f5a7936;mosquitto-1.3.5.tar.gz|55094ad4dc7c7985377f43d4fc3d09da;boost_1_58_0.tar.gz|5a5d5614d9a07672e1ab2a250b5defc5;openssl-1.0.1u.tar.gz|130bb19745db2a5a09f22ccbbf7e69d0;cpp-driver-2.0.1.tar.gz|70bf83e1cbd0d35b7e5ed66fc4dccbb1;libuv-v0.10.36.tar.gz|8eb77b4fee4f311c114a9fee06f5a2ab;cpp-netlib-0.12.0-final.tar.gz|29b87c0e8c1a9e7fbdea5afcec947d53
FETCH = wget -c --no-check-certificate -O - include common.mk
MD5 = $(if $(shell which md5),md5,$(if $(shell md5sum --tag Makefile 2&> /dev/null || true),md5sum --tag,openssl md5 <))
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_CLUSTER_NAME = Datacenter Monitor Database
CASSANDRA_FLUSH_LARGEST_MEMTABLES_AT = 0.5 CASSANDRA_FLUSH_LARGEST_MEMTABLES_AT = 0.5
...@@ -42,36 +37,14 @@ CASSANDRA_TOMBSTONE_FAILURE_THRESHOLD = 10000000 ...@@ -42,36 +37,14 @@ CASSANDRA_TOMBSTONE_FAILURE_THRESHOLD = 10000000
HTTPD_PORT = 8080 HTTPD_PORT = 8080
DISTFILESNAMES = $(foreach f,$(DISTFILES),$(shell echo "$(f)" | sed 's/;.*//'))
DISTFILESPATHS = $(foreach f,$(DISTFILES),$(shell echo "$(f)" | sed 's/.tar.gz;.*//' | sed 's/.zip;.*//' ))
# If cross-compiling for ARM, adjust the build settings # If cross-compiling for ARM, adjust the build settings
ifeq ("$(ARCH)", "arm") 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
OPENSSL_TARGET = "linux-generic32" OPENSSL_TARGET = "linux-generic32"
else else
OPENSSL_TARGET = $(if $(findstring $(shell uname),Darwin),"darwin64-x86_64-cc","linux-x86_64") OPENSSL_TARGET = $(if $(findstring $(shell uname),Darwin),"darwin64-x86_64-cc","linux-x86_64")
LRT = $(if $(findstring $(shell uname),Darwin),"","-lrt")
CMAKE_CROSS_FLAGS = ""
AUTOCONF_CROSS_FLAGS = ""
SKIP_PROJECTS = ""
endif endif
CFLAGS += -I$(DCDBDEPLOYPATH)/include -O2 -g PUBHEADERS = pusherpqueue.h dcdbdaemon.h
CXX11FLAGS = --std=c++11 -Wno-c99-extensions -Wno-missing-field-initializers -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG -Wno-unused-local-typedef
LDFLAGS += -L$(DCDBDEPLOYPATH)/lib -O2 -g
.PHONY : info all clean cleanall distclean check-cross-compile $(LIBRARIES) $(PROJECTS) .PHONY : info all clean cleanall distclean check-cross-compile $(LIBRARIES) $(PROJECTS)
...@@ -133,9 +106,10 @@ update-distfile-hashes: .md5sums ...@@ -133,9 +106,10 @@ update-distfile-hashes: .md5sums
.md5sums: $(DCDBDEPSPATH)/.download-distfiles .md5sums: $(DCDBDEPSPATH)/.download-distfiles
@$(foreach f,$(DISTFILESNAMES),echo "Checksumming $(f)..." && printf "$(f);" >> .md5sums && $(MD5) $(DCDBDEPSPATH)/distfiles/$(f) | sed -e 's/.*\ //' >> .md5sums; ) @$(foreach f,$(DISTFILESNAMES),echo "Checksumming $(f)..." && printf "$(f);" >> .md5sums && $(MD5) $(DCDBDEPSPATH)/distfiles/$(f) | sed -e 's/.*\ //' >> .md5sums; )
all: check-cross-compile $(DCDBDEPSPATH)/.prerequesites all: check-cross-compile $(foreach f,$(DISTFILESPATHS),$(DCDBDEPSPATH)/$(f)/.installed) $(LIBRARIES) $(PROJECTS)
@make $(LIBRARIES) @mkdir -p $(DCDBDEPLOYPATH)/include/dcdb
@make $(PROJECTS) cd include && install $(PUBHEADERS) $(DCDBDEPLOYPATH)/include/dcdb && cd ..
@echo DONE
check-cross-compile: check-cross-compile:
@if [ "$(ARCH)" = "arm" ]; then \ @if [ "$(ARCH)" = "arm" ]; then \
...@@ -143,140 +117,86 @@ check-cross-compile: ...@@ -143,140 +117,86 @@ check-cross-compile:
echo; \ echo; \
fi; fi;
$(DCDBDEPSPATH)/.prerequesites: $(DCDBDEPSPATH)/.extract-distfiles $(DCDBDEPSPATH)/openssl-$(OPENSSL_VERSION)/.installed: $(DCDBDEPSPATH)/openssl-$(OPENSSL_VERSION)/.patched
@echo "" @echo "Building OpenSSL library..."
@echo "Preparing patches..." cd $(@D) && ./Configure shared --prefix=$(DCDBDEPLOYPATH) $(OPENSSL_TARGET)
@cp -a patches $(DCDBDEPSPATH)/ cd $(@D) && make && make install_sw && touch $(@)
$(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/\ .*//')) $(DCDBDEPSPATH)/mosquitto-$(MOSQUITTO_VERSION)/.installed: $(DCDBDEPSPATH)/mosquitto-$(MOSQUITTO_VERSION)/.patched
@if [ ! -e $(DCDBDEPSPATH)/$(M)/.installed ]; then \ @echo "Building Mosquitto library...";
echo ""; \ mkdir -p $(DCDBDEPSPATH)/mosquitto_build;
echo "Building Mosquitto library..."; \ cd $(DCDBDEPSPATH)/mosquitto_build && \
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 && \
cmake $(CMAKE_CROSS_FLAGS) \ cmake $(CMAKE_CROSS_FLAGS) \
-DOPENSSL_ROOT_DIR=$(DCDBDEPLOYPATH)/ \ -DOPENSSL_ROOT_DIR=$(DCDBDEPLOYPATH)/ \
-DWITH_SRV=no \ -DWITH_SRV=no \
-DWITH_TLS=yes \ -DWITH_TLS=yes \
-DWITH_TLS_PSK=yes \ -DWITH_TLS_PSK=yes \
-DCMAKE_INSTALL_PREFIX:PATH=$(DCDBDEPLOYPATH)/ \ -DCMAKE_INSTALL_PREFIX:PATH=$(DCDBDEPLOYPATH)/ \
$(DCDBDEPSPATH)/$(M) && \ $(@D) && \
make -j $(MAKETHREADS) && make install && \ make -j $(MAKETHREADS) && make install && \
touch $(DCDBDEPSPATH)/$(M)/.installed; \ touch $(@)
else \
echo "Skipping Mosquitto 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; \
if [ "$(ARCH)" = "arm" ]; then \
echo " using gcc : arm : $(CROSS_COMPILE)g++ ; " > $(DCDBDEPSPATH)/$(B)/tools/build/src/user-config.jam; \
fi; \
cd $(DCDBDEPSPATH)/$(B) && ./bootstrap.sh --prefix=$(DCDBDEPLOYPATH) \
--with-libraries=atomic,chrono,date_time,exception,filesystem,program_options,random,regex,system,thread,timer; \
cd $(DCDBDEPSPATH)/$(B) && \
./b2 -j $(MAKETHREADS) cxxflags="$(CXX11FLAGS)" install && touch $(DCDBDEPSPATH)/$(B)/.installed; \
else \
echo "Skipping Boost (already built)..."; \
fi
$(eval U := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*libuv/libuv/' | sed 's/\ .*//')) $(DCDBDEPSPATH)/boost_$(BOOST_VERSION_U)/.installed: $(DCDBDEPSPATH)/boost_$(BOOST_VERSION_U)/.patched
@if [ ! -e $(DCDBDEPSPATH)/$(U)/.installed ]; then \ @echo "Building Boost..."
echo ""; \ if [ "$(ARCH)" = "arm" ]; then \
echo "Building libuv..."; \ echo " using gcc : arm : $(CROSS_COMPILE)g++ ; " > $(@D)/tools/build/src/user-config.jam; \
cd $(DCDBDEPSPATH)/$(U) && \
env CC="$(CC)" CFLAGS="$(CFLAGS)" make -j $(MAKETHREADS); \
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/\ .*//'))
@if [ ! -e $(DCDBDEPSPATH)/$(D)/.installed ]; then \
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 && \
cmake $(CMAKE_CROSS_FLAGS) \
-DCMAKE_CXX_FLAGS="$(CXX11FLAGS) -Wno-unused-command-line-argument -L$(DCDBDEPLOYPATH)/lib " \
-DOPENSSL_ROOT_DIR=$(DCDBDEPLOYPATH)/ \
-DLIBUV_ROOT_DIR=$(DCDBDEPLOYPATH)/ \
-DCASS_BUILD_EXAMPLES=NO \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_INSTALL_PREFIX=$(DCDBDEPLOYPATH)/ \
-DCMAKE_EXE_LINKER_FLAGS="-L$(DCDBDEPLOYPATH)/lib -lboost_random" \
-DCMAKE_SHARED_LINKER_FLAGS="-L$(DCDBDEPLOYPATH)/lib -lboost_random" \
$(DCDBDEPSPATH)/$(D) && \
make -j $(MAKETHREADS) && make install && \
touch $(DCDBDEPSPATH)/$(D)/.installed; \
else \
echo "Skipping cpp-driver (already built)..."; \
fi fi
cd $(@D) && ./bootstrap.sh --prefix=$(DCDBDEPLOYPATH) \
--with-libraries=atomic,chrono,date_time,exception,filesystem,program_options,random,regex,system,thread,timer \
cd $(@D) && ./b2 -j $(MAKETHREADS) cxxflags="$(CXX11FLAGS)" install && touch $(@)
$(DCDBDEPSPATH)/libuv-v$(LIBUV_VERSION)/.installed: $(DCDBDEPSPATH)/libuv-v$(LIBUV_VERSION)/.patched
@echo "Building libuv..."
cd $(@D) && env CC="$(CC)" CFLAGS="$(CFLAGS)" make -j $(MAKETHREADS)
@echo "Installing libuv..."
mkdir -p $(DCDBDEPLOYPATH)/include/uv-private
cd $(@D) && install -c include/uv.h $(DCDBDEPLOYPATH)/include/
cd $(@D) && install -c include/uv-private/* $(DCDBDEPLOYPATH)/include/uv-private/
mkdir -p $(DCDBDEPLOYPATH)/lib/
if [ -e $(@D)/libuv.a ]; then cd $(@D) && install -c libuv.a $(DCDBDEPLOYPATH)/lib/; fi
if [ -e $(@D)/libuv.so ]; then cd $(@D) && install -c libuv.so $(DCDBDEPLOYPATH)/lib/; ln -s $(DCDBDEPLOYPATH)/lib/libuv.so $(DCDBDEPLOYPATH)/lib/libuv.so.0.10; fi
if [ -e $(@D)/libuv.dylib ]; then cd $(@D) && install -c libuv.dylib $(DCDBDEPLOYPATH)/lib/; fi
touch $(@D)/.installed;
$(DCDBDEPSPATH)/cpp-driver-$(CPPDRV_VERSION)/.installed: $(DCDBDEPSPATH)/cpp-driver-$(CPPDRV_VERSION)/.patched
@echo "Building cpp-driver..."
mkdir -p $(DCDBDEPSPATH)/cpp-driver_build
cd $(DCDBDEPSPATH)/cpp-driver_build && \
cmake $(CMAKE_CROSS_FLAGS) \
-DCMAKE_CXX_FLAGS="$(CXX11FLAGS) -Wno-unused-command-line-argument -L$(DCDBDEPLOYPATH)/lib " \
-DOPENSSL_ROOT_DIR=$(DCDBDEPLOYPATH)/ \
-DLIBUV_ROOT_DIR=$(DCDBDEPLOYPATH)/ \
-DCASS_BUILD_EXAMPLES=NO \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_INSTALL_PREFIX=$(DCDBDEPLOYPATH)/ \
-DCMAKE_EXE_LINKER_FLAGS="-L$(DCDBDEPLOYPATH)/lib -lboost_random" \
-DCMAKE_SHARED_LINKER_FLAGS="-L$(DCDBDEPLOYPATH)/lib -lboost_random" \
$(@D) && \
make -j $(MAKETHREADS) && make install && \
touch $(@D)/.installed
$(eval N := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*cpp-netlib/cpp-netlib/' | sed 's/\ .*//')) $(DCDBDEPSPATH)/cpp-netlib-$(CPPNET_VERSION)/.installed: $(DCDBDEPSPATH)/cpp-netlib-$(CPPNET_VERSION)/.patched
@if [ ! -e $(DCDBDEPSPATH)/$(N)/.installed ]; then \ @echo "Building cpp-netlib..."
echo ""; \ mkdir -p $(DCDBDEPSPATH)/cpp-netlib_build
echo "Building cpp-netlib..."; \ cd $(DCDBDEPSPATH)/cpp-netlib_build && \
if [ -e $(DCDBDEPSPATH)/patches/$(N).patch ]; then \ cmake $(CMAKE_CROSS_FLAGS) \
echo "Patching cpp-netlib..."; \ -DCMAKE_CXX_FLAGS="$(CXX11FLAGS) -Wno-unused-command-line-argument -L$(DCDBDEPLOYPATH)/lib " \
cd $(DCDBDEPSPATH)/$(N) && (patch -N -p1 < $(DCDBDEPSPATH)/patches/$(N).patch || true); \ -DCPP-NETLIB_ENABLE_HTTPS=off \
fi; \ -DCPP-NETLIB_BUILD_TESTS=OFF \
mkdir -p $(DCDBDEPSPATH)/cpp-netlib_build; \ -DCPP-NETLIB_BUILD_EXAMPLES=OFF \
cd $(DCDBDEPSPATH)/cpp-netlib_build && \ -DCMAKE_INSTALL_LIBDIR=lib \
cmake $(CMAKE_CROSS_FLAGS) \ -DCMAKE_INSTALL_PREFIX=$(DCDBDEPLOYPATH)/ \
-DCMAKE_CXX_FLAGS="$(CXX11FLAGS) -Wno-unused-command-line-argument -L$(DCDBDEPLOYPATH)/lib " \ -DBOOST_LIBRARYDIR=$(DCDBDEPLOYPATH)/lib \
-DCPP-NETLIB_ENABLE_HTTPS=off \ -DBOOST_ROOT=$(DCDBDEPSPATH)/$(B)/ \
-DCPP-NETLIB_BUILD_TESTS=OFF \ $(@D) && \
-DCPP-NETLIB_BUILD_EXAMPLES=OFF \ make -j $(MAKETHREADS) && \
-DCMAKE_INSTALL_LIBDIR=lib \ make install && \
-DCMAKE_INSTALL_PREFIX=$(DCDBDEPLOYPATH)/ \ touch $(@D)/.installed
-DBOOST_LIBRARYDIR=$(DCDBDEPLOYPATH)/lib \
-DBOOST_ROOT=$(DCDBDEPSPATH)/$(B)/ \
$(DCDBDEPSPATH)/$(N) && \
make -j $(MAKETHREADS) && \
make install && \
touch $(DCDBDEPSPATH)/$(N)/.installed; \
else \
echo "Skipping cpp-netlib (already built)..."; \
fi
$(DCDBDEPSPATH)/apache-cassandra-$(CASSANDRA_VERSION)/.installed: $(DCDBDEPSPATH)/apache-cassandra-$(CASSANDRA_VERSION)/.patched $(DCDBDEPLOYPATH)
@echo "" @echo ""
@echo "Staging and configuring Cassandra..." @echo "Staging and configuring Cassandra..."
@$(eval C := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*apache-cassandra/apache-cassandra/' | sed 's/\ .*//')) @rsync -rlptD $(@D)/ $(DCDBDEPLOYPATH)/cassandra
@rsync -rlptD $(DCDBDEPSPATH)/$(C)/ $(DCDBDEPLOYPATH)/cassandra
@$(eval P := $(shell echo "$(DCDBDEPLOYPATH)" | sed 's/\//\\\//g')) @$(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\/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/.*cluster_name:.*/cluster_name:\ '\''$(CASSANDRA_CLUSTER_NAME)'\''/' $(DCDBDEPLOYPATH)/cassandra/conf/cassandra.yaml
...@@ -288,45 +208,9 @@ $(DCDBDEPSPATH)/.prerequesites: $(DCDBDEPSPATH)/.extract-distfiles ...@@ -288,45 +208,9 @@ $(DCDBDEPSPATH)/.prerequesites: $(DCDBDEPSPATH)/.extract-distfiles
@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 @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
@sed -i -e 's/.*tombstone_warn_threshold:.*/tombstone_warn_threshold: $(CASSANDRA_TOMBSTONE_WARN_THRESHOLD)/' $(DCDBDEPLOYPATH)/cassandra/conf/cassandra.yaml @sed -i -e 's/.*tombstone_warn_threshold:.*/tombstone_warn_threshold: $(CASSANDRA_TOMBSTONE_WARN_THRESHOLD)/' $(DCDBDEPLOYPATH)/cassandra/conf/cassandra.yaml
@sed -i -e 's/.*tombstone_failure_threshold:.*/tombstone_failure_threshold: $(CASSANDRA_TOMBSTONE_FAILURE_THRESHOLD)/' $(DCDBDEPLOYPATH)/cassandra/conf/cassandra.yaml @sed -i -e 's/.*tombstone_failure_threshold:.*/tombstone_failure_threshold: $(CASSANDRA_TOMBSTONE_FAILURE_THRESHOLD)/' $(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)
@if [ "$(NOCHECK)" = "" ]; then \
printf "Verifying checksum... "; \
if [ "`echo "$(DISTFILES_HASHES)" | sed -e 's/.*$(F);//' | sed -e 's/;.*//';`" = "`$(MD5) $(DCDBDEPSPATH)/distfiles/$(F) | sed -e 's/.*\ //'`" ]; then \
echo "Checksum OK!"; \
else \
echo "Checksum FAIL!"; \
exit 2; \
fi \
else \
echo "Skipping checksum verification..."; \
fi
@echo ""
$(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 $@ @touch $@
$(LIBRARIES): $(DCDBDEPSPATH)/.prerequesites $(LIBRARIES):
@echo "" @echo ""
@echo "Building Library $@..." @echo "Building Library $@..."
@$(MAKE) -j $(MAKETHREADS) CC=$(CC) CXX=$(CXX) -C $@ @$(MAKE) -j $(MAKETHREADS) CC=$(CC) CXX=$(CXX) -C $@
......
DCDBBASEPATH ?= $(realpath $(dir $(lastword $(MAKEFILE_LIST)))/..)
DCDBDEPSPATH ?= $(DCDBBASEPATH)/deps
DCDBDEPLOYPATH ?= $(DCDBBASEPATH)/install
FETCH = wget -c --no-check-certificate -O
MD5 = $(if $(shell which md5 2>/dev/null),md5,$(if $(shell md5sum --tag Makefile 2&> /dev/null || true),md5sum --tag,openssl md5))
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))
DISTFILESNAMES = $(foreach f,$(DISTFILES),$(shell echo "$(f)" | sed 's/;.*//'))
DISTFILESPATHS = $(foreach f,$(DISTFILES),$(shell echo "$(f)" | sed 's/.tar.gz;.*//' | sed 's/.zip;.*//' ))
# 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)
else
LRT = $(if $(findstring $(shell uname),Darwin),"","-lrt")
CMAKE_CROSS_FLAGS = ""
AUTOCONF_CROSS_FLAGS = ""
endif
CFLAGS += -I$(DCDBDEPLOYPATH)/include -O2 -g
CXX11FLAGS = --std=c++11 -Wno-c99-extensions -Wno-missing-field-initializers -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG -Wno-unused-local-typedef
LDFLAGS += -L$(DCDBDEPLOYPATH)/lib -O2 -g
.PHONY: all info
.PRECIOUS: $(DCDBDEPSPATH)/distfiles/% $(DCDBDEPSPATH)/%/.extracted $(DCDBDEPSPATH)/%/.patched
.SECONDEXPANSION:
getarchive = $(filter $1%,$(DISTFILESNAMES))
gethash = $(subst $(1)|,,$(filter $(1)%,$(subst ;, ,$(DISTFILES_HASHES))))
all: $(TARGET)
$(DCDBDEPSPATH):
@mkdir -p $(DCDBDEPSPATH)
$(DCDBDEPSPATH)/distfiles: $(DCDBDEPSPATH)
@mkdir -p $(DCDBDEPSPATH)/distfiles
$(DCDBDEPLOYPATH):
@mkdir -p $(DCDBDEPLOYPATH)
$(DCDBDEPSPATH)/distfiles/%: $(DCDBDEPSPATH)/distfiles
@echo "Download $(*)"
$(eval U := $(shell echo "$(DISTFILES)" | sed 's/.*$(*);//' | sed 's/ .*//'))
@if [ -e $(@) ]; then \
if [ `$(MD5) $(@)|sed -e 's/.*\ //'` = $(call gethash,$(*)) ]; then \
touch $(@); \
else \
rm $(@); \
fi; \
fi
@if [ ! -e $(@) ]; then \
$(FETCH) $(@) $(U); \
fi
$(DCDBDEPSPATH)/%/.extracted: $(DCDBDEPSPATH)/distfiles/$$(call getarchive,%)
$(eval F := $(notdir $(<)))
@if [ ! -e $(@) ]; then \
printf "Verifying checksum: $(F) "; \
if [ `$(MD5) $(<)|sed -e 's/.*\ //'` = $(call gethash,$(F)) ]; then \
echo " => OK!"; \
else \
echo " => FAIL!"; \
exit 2; \
fi; \
echo Extracting: $(F); \
if [ "$(suffix $(F))" = ".gz" ]; then \
cd $(DCDBDEPSPATH) && tar xzf distfiles/$(F); \
else \
cd $(DCDBDEPSPATH) && unzip distfiles/$(F) > /dev/null; \
fi; \
fi
@touch $@
$(DCDBDEPSPATH)/%/.patched: $(DCDBDEPSPATH)/%/.extracted
$(eval P := $(realpath patches))
@if [ ! -e $(@) && -e $(P)/$(*).patch ]; then \
echo Patching: $(*); \
cd $(@D) && (patch -N -p1 < $(P)/$(*).patch || true); \
fi
@touch $@
cleandeps:
@$(foreach f,$(DISTFILESPATHS),echo "Cleaning $(f)..." && rm -rf $(DCDBDEPSPATH)/$(f) $(DCDBDEPSPATH)/$(f)_build && echo;)
DCDBBASEPATH = $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) DCDBBASEPATH ?= $(realpath $(dir $(lastword $(MAKEFILE_LIST)))/..)
DCDBDEPSPATH ?= $(DCDBBASEPATH)/deps DCDBDEPSPATH ?= $(DCDBBASEPATH)/deps
DCDBDEPLOYPATH ?= $(DCDBBASEPATH)/install DCDBDEPLOYPATH ?= $(DCDBBASEPATH)/install
--- config.h 2014-10-28 18:38:17.000000000 +0100 --- mosquitto-1.3.5/config.h 2014-10-28 18:38:17.000000000 +0100
+++ config.h 2014-10-28 18:38:27.000000000 +0100 +++ mosquitto-1.3.5/config.h 2014-10-28 18:38:27.000000000 +0100
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
* *
* Compile time options have moved to config.mk. * Compile time options have moved to config.mk.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment