forked from Open-CAS/standalone-linux-io-tracer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (54 loc) · 1.66 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
# Copyright(c) 2012-2018 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause-Clear
SHELL := /bin/bash
.DEFAULT_GOAL := all
CMAKE_FILE=CMakeLists.txt
OPT_DIR=/opt/octf
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
ifneq ("$(wildcard $(OPT_DIR)/cmake/bin/cmake)","")
# Found our installation of cmake in opt dir
CMAKE=$(OPT_DIR)/cmake/bin/cmake
else
CMAKE=cmake
endif
SOURCE_PATH:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
.PHONY: init all clean
init:
mkdir -p $(BUILD_DIR)
all: init
cd $(BUILD_DIR) && $(CMAKE) $(SOURCE_PATH) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DCMAKE_INSTALL_PREFIX=$(PREFIX)
$(MAKE) -C $(BUILD_DIR) all
install: all
$(MAKE) uninstall
$(CMAKE) -DCOMPONENT=octf-install -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
uninstall: init
cd $(BUILD_DIR) && $(CMAKE) $(SOURCE_PATH) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DCMAKE_INSTALL_PREFIX=$(PREFIX)
$(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 \
$(MAKE) -C $(BUILD_DIR) clean ; \
$(MAKE) -C $(BUILD_DIR) clean-module ; \
rm -rf $(BUILD_DIR) ; \
fi