-
Notifications
You must be signed in to change notification settings - Fork 22
/
Makefile
79 lines (66 loc) · 2.01 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
75
76
77
78
79
# Copyright(c) 2012-2018 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
SHELL := /bin/bash
.DEFAULT_GOAL := all
CMAKE_FILE=CMakeLists.txt
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=/
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:
$(MAKE) init
$(CMAKE) -P version.cmake
cd modules/open-cas-telemetry-framework && $(CMAKE) -P octf-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 ; \
fi ; \
rm -rf $(BUILD_DIR) ; \
fi