summaryrefslogtreecommitdiff
path: root/Makefile
blob: 5d60dda4b6668c5ebf587675c07a56f0b11bbcfd (plain)
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
BUILD_DIR = $(CURDIR)/build
LOCAL_DIR = $(CURDIR)
DEBUG_FLAGS = -DCMAKE_BUILD_TYPE=Debug
REL_FLAGS = -DCMAKE_BUILD_TYPE=Release

ifneq ($(INSTALL_PREFIX),)
DEBUG_FLAGS += -DCMAKE_INSTALL_PREFIX=$(INSTALL_PREFIX)
REL_FLAGS += -DCMAKE_INSTALL_PREFIX=$(INSTALL_PREFIX)
endif

ifneq ($(RTE_PREFIX),)
DEBUG_FLAGS += -DCMAKE_PREFIX_PATH=$(RTE_PREFIX)
REL_FLAGS += -DCMAKE_PREFIX_PATH=$(RTE_PREFIX)
endif

all: _make_build_dir _compile_rel

PHONY: all _make_build_dir _compile_debug _compile_rel _install \
	   build_release build_debug install

_make_build_dir:
	mkdir -p $(BUILD_DIR)

_compile_debug:
	cd $(BUILD_DIR) && cmake $(LOCAL_DIR) $(DEBUG_FLAGS) && make

_compile_rel:
	cd $(BUILD_DIR) && cmake $(LOCAL_DIR) $(REL_FLAGS) && make

_install:
	cd $(BUILD_DIR) && make install
_clean:
	rm -rf $(BUILD_DIR)
	
# Release Version, No Debug Symbol and Optimized with -O2
build_release: _make_build_dir _compile_rel
# Debug Version, Optimized with -O0
build_debug: _make_build_dir _compile_debug
# Install
install: _install
# Clean
clean: _clean