2014-10-23 21:39:15 +00:00
|
|
|
PLATFORM := $(shell uname -s)
|
2015-02-19 18:43:08 +00:00
|
|
|
VERSION := $(shell git describe --tags HEAD --always)
|
2015-05-05 20:55:49 +00:00
|
|
|
SHELL := $(shell which bash)
|
2015-04-01 04:18:56 +00:00
|
|
|
|
2015-05-05 20:55:49 +00:00
|
|
|
MAKE = make
|
|
|
|
ifeq ($(PLATFORM),FreeBSD)
|
|
|
|
MAKE = gmake
|
|
|
|
endif
|
2015-04-03 07:44:27 +00:00
|
|
|
|
|
|
|
DISTRO := $(shell . ./tools/lib.sh; _platform)
|
|
|
|
DISTRO_VERSION := $(shell . ./tools/lib.sh; _distro $(DISTRO))
|
|
|
|
ifeq ($(DISTRO),darwin)
|
2015-08-12 16:02:25 +00:00
|
|
|
ifeq ($(DISTRO_VERSION), 10.10)
|
|
|
|
BUILD_DIR = darwin
|
|
|
|
else
|
|
|
|
BUILD_DIR = darwin$(DISTRO_VERSION)
|
|
|
|
endif
|
2015-09-24 23:12:26 +00:00
|
|
|
else ifeq ($(DISTRO),freebsd)
|
|
|
|
BUILD_DIR = freebsd$(DISTRO_VERSION)
|
2014-10-23 21:39:15 +00:00
|
|
|
else
|
2015-04-03 07:44:27 +00:00
|
|
|
BUILD_DIR = $(DISTRO_VERSION)
|
2014-10-23 21:39:15 +00:00
|
|
|
endif
|
|
|
|
|
2015-03-02 04:08:05 +00:00
|
|
|
DEFINES := CTEST_OUTPUT_ON_FAILURE=1
|
2015-04-21 22:40:02 +00:00
|
|
|
.PHONY: docs build
|
2015-03-02 04:08:05 +00:00
|
|
|
|
2014-11-09 00:55:19 +00:00
|
|
|
all: .setup
|
2015-05-05 20:55:49 +00:00
|
|
|
cd build/$(BUILD_DIR) && cmake ../../ && \
|
2015-03-02 04:08:05 +00:00
|
|
|
$(DEFINES) $(MAKE) --no-print-directory $(MAKEFLAGS)
|
2014-09-24 03:23:03 +00:00
|
|
|
|
2015-03-09 00:00:14 +00:00
|
|
|
docs: .setup
|
2015-05-05 20:55:49 +00:00
|
|
|
cd build && cmake ../ && \
|
2015-03-09 00:00:14 +00:00
|
|
|
$(DEFINES) $(MAKE) docs --no-print-directory $(MAKEFLAGS)
|
|
|
|
|
2014-11-09 00:55:19 +00:00
|
|
|
debug: .setup
|
2015-04-15 03:58:25 +00:00
|
|
|
cd build/debug_$(BUILD_DIR) && DEBUG=True cmake ../../ && \
|
2015-04-01 04:18:56 +00:00
|
|
|
$(DEFINES) $(MAKE) --no-print-directory $(MAKEFLAGS)
|
2014-10-27 16:34:13 +00:00
|
|
|
|
2015-02-11 03:18:56 +00:00
|
|
|
test_debug: .setup
|
2015-04-15 03:58:25 +00:00
|
|
|
cd build/debug_$(BUILD_DIR) && DEBUG=True cmake ../../ && \
|
2015-04-01 04:18:56 +00:00
|
|
|
$(DEFINES) $(MAKE) test --no-print-directory $(MAKEFLAGS)
|
2015-02-11 03:18:56 +00:00
|
|
|
|
2015-01-31 11:09:30 +00:00
|
|
|
analyze: .setup
|
|
|
|
cd build/$(BUILD_DIR) && ANALYZE=True cmake ../../ && \
|
2015-04-01 04:18:56 +00:00
|
|
|
$(DEFINES) $(MAKE) --no-print-directory $(MAKEFLAGS)
|
2015-01-31 11:09:30 +00:00
|
|
|
|
2015-01-31 11:26:28 +00:00
|
|
|
sanitize: .setup
|
|
|
|
cd build/$(BUILD_DIR) && SANITIZE=True cmake ../../ && \
|
2015-04-01 04:18:56 +00:00
|
|
|
$(DEFINES) $(MAKE) --no-print-directory $(MAKEFLAGS)
|
2015-01-31 11:26:28 +00:00
|
|
|
|
2015-02-03 05:21:36 +00:00
|
|
|
sdk: .setup
|
2015-02-19 23:19:00 +00:00
|
|
|
cd build/$(BUILD_DIR) && SDK=True cmake ../../ && \
|
2015-04-01 04:18:56 +00:00
|
|
|
$(DEFINES) $(MAKE) --no-print-directory $(MAKEFLAGS)
|
2015-02-03 05:21:36 +00:00
|
|
|
|
|
|
|
test_sdk: .setup
|
2015-02-19 23:19:00 +00:00
|
|
|
cd build/$(BUILD_DIR) && SDK=True cmake ../../ && \
|
2015-04-01 04:18:56 +00:00
|
|
|
$(DEFINES) $(MAKE) test --no-print-directory $(MAKEFLAGS)
|
2015-02-03 05:21:36 +00:00
|
|
|
|
2015-02-19 01:19:45 +00:00
|
|
|
debug_sdk: .setup
|
2015-04-15 03:58:25 +00:00
|
|
|
cd build/debug_$(BUILD_DIR) && SDK=True DEBUG=True cmake ../../ && \
|
2015-04-01 04:18:56 +00:00
|
|
|
$(DEFINES) $(MAKE) --no-print-directory $(MAKEFLAGS)
|
2015-02-19 01:19:45 +00:00
|
|
|
|
|
|
|
test_debug_sdk: .setup
|
2015-04-15 03:58:25 +00:00
|
|
|
cd build/debug_$(BUILD_DIR) && SDK=True DEBUG=True cmake ../../ && \
|
2015-04-01 04:18:56 +00:00
|
|
|
$(DEFINES) $(MAKE) test --no-print-directory $(MAKEFLAGS)
|
2015-02-19 01:19:45 +00:00
|
|
|
|
2015-04-21 22:40:02 +00:00
|
|
|
build:
|
|
|
|
cd build/$(BUILD_DIR) && \
|
|
|
|
$(DEFINES) $(MAKE) --no-print-directory $(MAKEFLAGS)
|
|
|
|
|
|
|
|
debug_build:
|
|
|
|
cd build/debug_$(BUILD_DIR) && \
|
|
|
|
$(DEFINES) $(MAKE) --no-print-directory $(MAKEFLAGS)
|
|
|
|
|
|
|
|
test_build:
|
|
|
|
cd build/$(BUILD_DIR) && \
|
|
|
|
$(DEFINES) $(MAKE) test --no-print-directory $(MAKEFLAGS)
|
|
|
|
|
|
|
|
test_debug_build:
|
|
|
|
cd build/debug_$(BUILD_DIR) && \
|
|
|
|
$(DEFINES) $(MAKE) test --no-print-directory $(MAKEFLAGS)
|
|
|
|
|
2014-11-09 00:55:19 +00:00
|
|
|
deps: .setup
|
|
|
|
./tools/provision.sh build build/$(BUILD_DIR)
|
2014-09-24 03:23:03 +00:00
|
|
|
|
2015-05-05 20:55:49 +00:00
|
|
|
clean: .setup
|
|
|
|
cd build/$(BUILD_DIR) && cmake ../../ && \
|
|
|
|
$(DEFINES) $(MAKE) clean --no-print-directory $(MAKEFLAGS)
|
|
|
|
|
2014-09-24 03:23:03 +00:00
|
|
|
distclean:
|
2015-04-24 20:52:17 +00:00
|
|
|
rm -rf .sources build/$(BUILD_DIR) build/debug_$(BUILD_DIR) build/docs
|
2014-11-09 00:55:19 +00:00
|
|
|
ifeq ($(PLATFORM),Linux)
|
|
|
|
rm -rf build/linux
|
|
|
|
endif
|
2014-09-24 03:23:03 +00:00
|
|
|
|
2014-11-09 00:55:19 +00:00
|
|
|
.setup:
|
2015-04-03 07:44:27 +00:00
|
|
|
ifeq ($(DISTRO),unknown_version)
|
2015-04-01 04:18:56 +00:00
|
|
|
@echo Unknown, non-Redhat, non-Ubuntu based Linux distro
|
|
|
|
false
|
|
|
|
endif
|
2015-08-27 19:55:43 +00:00
|
|
|
@mkdir -p build/docs
|
2015-04-15 03:58:25 +00:00
|
|
|
@mkdir -p build/$(BUILD_DIR)
|
|
|
|
@mkdir -p build/debug_$(BUILD_DIR)
|
2014-11-09 00:55:19 +00:00
|
|
|
ifeq ($(PLATFORM),Linux)
|
2015-04-15 03:58:25 +00:00
|
|
|
@ln -snf $(BUILD_DIR) build/linux
|
|
|
|
@ln -snf debug_$(BUILD_DIR) build/debug_linux
|
2014-11-09 00:55:19 +00:00
|
|
|
endif
|
|
|
|
|
2015-05-04 21:15:19 +00:00
|
|
|
package: .setup
|
2015-01-11 07:02:32 +00:00
|
|
|
# Alias for packages (do not use CPack)
|
2015-05-04 21:15:19 +00:00
|
|
|
cd build/$(BUILD_DIR) && PACKAGE=True cmake ../../ && \
|
|
|
|
$(DEFINES) $(MAKE) packages --no-print-directory $(MAKEFLAGS)
|
|
|
|
|
|
|
|
packages: .setup
|
|
|
|
cd build/$(BUILD_DIR) && PACKAGE=True cmake ../../ && \
|
2015-03-02 04:08:05 +00:00
|
|
|
$(DEFINES) $(MAKE) packages --no-print-directory $(MAKEFLAGS)
|
2015-01-11 07:02:32 +00:00
|
|
|
|
2015-05-05 20:55:49 +00:00
|
|
|
sync: .setup
|
|
|
|
cd build/$(BUILD_DIR) && PACKAGE=True cmake ../../ && \
|
|
|
|
$(DEFINES) $(MAKE) sync --no-print-directory $(MAKEFLAGS)
|
|
|
|
|
2014-11-09 00:55:19 +00:00
|
|
|
%::
|
2015-05-05 20:55:49 +00:00
|
|
|
cd build/$(BUILD_DIR) && cmake ../../ && \
|
2015-04-01 04:18:56 +00:00
|
|
|
$(DEFINES) $(MAKE) --no-print-directory $@
|