Commit 516920a0 authored by Michael Ott's avatar Michael Ott

Clean up Makefiles

parent 63cce1e2
include config.mk
MAKEFILENAME := $(lastword $(MAKEFILE_LIST))
SUB_DIRS = lib CollectAgent dcdbpusher tools scripts
......@@ -39,8 +41,6 @@ CASSANDRA_COMMITLOG_SEGMENT_SIZE_IN_MB = 16
CASSANDRA_TOMBSTONE_WARN_THRESHOLD = 100000
CASSANDRA_TOMBSTONE_FAILURE_THRESHOLD = 10000000
HTTPD_PORT = 8080
# If cross-compiling for ARM, adjust the build settings
ifeq ("$(ARCH)", "arm")
OPENSSL_TARGET = "linux-generic32"
......@@ -86,10 +86,12 @@ info:
clean:
@$(foreach s,$(SUB_DIRS),echo "Cleaning $(s)..." && make -C $(s) clean && echo;)
cleanall: clean
cleandeps:
@$(foreach f,$(DISTFILESPATHS),echo "Cleaning $(f)..." && rm -rf $(DCDBDEPSPATH)/$(f) && echo;)
@$(foreach f,cpp-netlib,echo "Cleaning $(f)..." && rm -rf $(DCDBDEPSPATH)/$(f)_build && echo;)
cleanall: clean cleandeps
distclean: clean
@echo "Wiping dependencies..."
@rm -rf $(DCDBDEPSPATH)
......@@ -101,24 +103,12 @@ mrproper: distclean
@echo "Wiping installation directory..."
@rm -rf $(DCDBDEPLOYPATH)
update-distfile-hashes: .md5sums
$(eval X := $(shell cat .md5sums | tr \\\n \; ))
@echo "Updating $(MAKEFILENAME)..."
@sed -i -e 's/^DISTFILES_HASHES\ =.*/DISTFILES_HASHES\ =\ $(X)/' $(MAKEFILENAME) ;
@rm -f .md5sums
all: check-cross-compile deps $(foreach s,$(SUB_DIRS),$(s)-build)
install: depsinstall $(SUB_DIRS)
@cd include && install $(PUBHEADERS) $(DCDBDEPLOYPATH)/include/dcdb && cd ..
@echo DONE
check-cross-compile:
@if [ "$(ARCH)" = "arm" ]; then \
echo "Info: Cross-compiling for ARM using compiler prefix: $(CROSS_COMPILE_STRP)"; \
echo; \
fi;
deps: $(foreach f,$(DISTFILESPATHS),$(DCDBDEPSPATH)/$(f)/.built)
depsinstall: $(foreach f,$(DISTFILESPATHS),$(DCDBDEPSPATH)/$(f)/.installed)
......@@ -273,14 +263,8 @@ $(SUB_DIRS): $(foreach s,$(SUB_DIRS),$(s)-build)
@$(MAKE) CC=$(CC) CXX=$(CXX) -C $@ install
$(PROJECTS): deps
$(eval X := $(shell echo "$(SKIP_PROJECTS)" | grep "$@"))
@if [ "$(X)" = "" ]; then \
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
echo ""; \
echo "Building $@..."; \
$(MAKE) -j $(MAKETHREADS) CC=$(CC) CXX=$(CXX) -C $@ ; \
echo "Installing $@..."; \
$(MAKE) CC=$(CC) CXX=$(CXX) -C $@ install ; \
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))
OS = $(shell uname -s)
......@@ -10,26 +6,6 @@ MAKETHREADS ?= $(if $(findstring $(shell uname),Darwin),$(shell sysctl machdep.c
DISTFILESNAMES = $(foreach f,$(DISTFILES),$(shell echo "$(f)" | sed 's/;.*//'))
DISTFILESPATHS = $(foreach f,$(DISTFILES),$(shell echo "$(f)" | sed 's/.tar.gz;.*//; s/.tgz;.*//; 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 -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
LDFLAGS += -L$(DCDBDEPLOYPATH)/lib -O2 -g
......@@ -91,6 +67,3 @@ $(DCDBDEPSPATH)/%/.patched: $(DCDBDEPSPATH)/%/.extracted
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;)
......@@ -5,3 +5,5 @@ DCDBDEPLOYPATH ?= $(DCDBBASEPATH)/install
DEFAULT_VERSION = 0.3
GIT_VERSION = $(shell git describe --tags 2>/dev/null|sed 's/-\([0-9]*\)/.\1/')
VERSION := $(if $(GIT_VERSION),$(GIT_VERSION),$(DEFAULT_VERSION))
OS = $(shell uname -s)
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