forked from Open-CAS/standalone-linux-io-tracer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
74 lines (61 loc) · 1.93 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
ifdef DEBUG
BUILD_DIR=build/debug
BUILD_TYPE=DEBUG
ifndef PREFIX
PREFIX=./rootfs
endif
else
BUILD_DIR=build/release
BUILD_TYPE=RELEASE
ifndef PREFIX
PREFIX=/
endif
endif
SOURCE_PATH:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
CMAKE:=$(SOURCE_PATH)/modules/open-cas-telemetry-framework/tools/third_party/cmake/bin/cmake
ifeq ("$(wildcard $(CMAKE))","")
$(info Using system $(shell cmake --version | grep version))
CMAKE=cmake
endif
.PHONY: init all clean
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
install: all
$(MAKE) uninstall
$(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
$(CMAKE) -DCOMPONENT=iotrace-install -P $(BUILD_DIR)/cmake_install.cmake
$(CMAKE) -DCOMPONENT=iotrace-post-install -P $(BUILD_DIR)/cmake_install.cmake
package: all
$(MAKE) -C $(BUILD_DIR) package
package_source: init
$(CMAKE) -P version.cmake
make -C $(BUILD_DIR) package_source
uninstall: init
$(MAKE) -C $(BUILD_DIR) iotrace-uninstall
$(MAKE) -C $(BUILD_DIR) octf-uninstall
uninstall-tracer: init
cd $(BUILD_DIR) && $(CMAKE) $(SOURCE_PATH) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DCMAKE_INSTALL_PREFIX=$(PREFIX)
$(MAKE) -C $(BUILD_DIR) iotrace-uninstall
test:
clean:
$(info Cleaning $(BUILD_DIR))
@if [ -d $(BUILD_DIR) ] ; \
then \
if [ -f $(BUILD_DIR)/Makefile ] ; \
then \
$(MAKE) -C $(BUILD_DIR) clean ; \
$(MAKE) -C $(BUILD_DIR) clean-module ; \
fi ; \
rm -rf $(BUILD_DIR) ; \
fi