forked from Open-CAS/open-cas-telemetry-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
74 lines (60 loc) · 1.7 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Copyright(c) 2012-2018 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause-Clear
SHELL := /bin/bash
.DEFAULT_GOAL := all
CMAKE_FILE=CMakeLists.txt
TEST_DIR=build/test
TEST_PREFIX=./rootfs
ifdef DEBUG
ifndef BUILD_DIR
BUILD_DIR=build/debug
endif
BUILD_TYPE=DEBUG
ifndef PREFIX
PREFIX=./rootfs
endif
else
ifndef BUILD_DIR
BUILD_DIR=build/release
endif
BUILD_TYPE=RELEASE
ifndef PREFIX
PREFIX=/
RUN_LD_CONFIG=1
endif
endif
SOURCE_PATH:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
CMAKE=$(SOURCE_PATH)/tools/third_party/cmake/bin/cmake
ifeq ("$(wildcard $(CMAKE))","")
$(info Using system $(shell cmake --version | grep version))
CMAKE=cmake
endif
.PHONY: init all install uninstall reinstall package clean doc
init:
mkdir -p $(BUILD_DIR)
cd $(BUILD_DIR) && $(CMAKE) $(SOURCE_PATH) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DCMAKE_INSTALL_PREFIX=$(PREFIX)
all: init
$(MAKE) -C $(BUILD_DIR) all
doc: init
$(MAKE) -C $(BUILD_DIR) doc
install: all
$(CMAKE) -DCOMPONENT=octf-install -P $(BUILD_DIR)/cmake_install.cmake
$(CMAKE) -DCOMPONENT=octf-install-headers -P $(BUILD_DIR)/cmake_install.cmake
$(CMAKE) -DCOMPONENT=octf-install-cmake -P $(BUILD_DIR)/cmake_install.cmake
$(CMAKE) -DCOMPONENT=octf-post-install -P $(BUILD_DIR)/cmake_install.cmake
uninstall: init
$(MAKE) -C $(BUILD_DIR) octf-uninstall
reinstall: | uninstall install
package: all
$(MAKE) -C $(BUILD_DIR) package
test:
BUILD_DIR=$(TEST_DIR) PREFIX=$(TEST_PREFIX) $(MAKE) all
BUILD_DIR=$(TEST_DIR) PREFIX=$(TEST_PREFIX) $(MAKE) install
$(MAKE) -C $(TEST_DIR) run-unit-tests
clean:
$(info Cleaning $(BUILD_DIR))
@if [ -d $(BUILD_DIR) ] ; \
then \
$(MAKE) -C $(BUILD_DIR) clean ; \
rm -rf $(BUILD_DIR) ; \
fi