-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
35 lines (27 loc) · 1.02 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
CURRENT_DIR:=$(shell pwd)
BUILD_DIR?=${CURRENT_DIR}/build
BUILD_TYPE?=Release
INSTALL_DIR?=${CURRENT_DIR}/install
# ON or OFF
RUNTIME_LTO?=ON
all: install
.PHONY: build install clean check-path
check-path:
@echo "Building in ${BUILD_DIR}"
@echo "Installing in ${INSTALL_DIR}"
@echo "Build type: ${BUILD_TYPE}"
@echo "Runtime LTO: ${RUNTIME_LTO}"
build: check-path
mkdir -p $(BUILD_DIR)
cd $(BUILD_DIR) && cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -DRUNTIME_LTO=$(RUNTIME_LTO) ../
cd $(BUILD_DIR) && make -j4
install: build
cd $(BUILD_DIR) && make install
cp -r scripts/* $(INSTALL_DIR)/bin
@echo "export RUNTIME_LTO=$(RUNTIME_LTO)" > $(INSTALL_DIR)/PROMPT.rc
@echo "export SLAMP_INSTALL_DIR=$(INSTALL_DIR)" >> $(INSTALL_DIR)/PROMPT.rc
@echo "export PATH=$(INSTALL_DIR)/bin:\$$PATH" >> $(INSTALL_DIR)/PROMPT.rc
@echo "export LD_LIBRARY_PATH=$(INSTALL_DIR)/lib:\$$LD_LIBRARY_PATH" >> $(INSTALL_DIR)/PROMPT.rc
clean:
rm -rf $(BUILD_DIR)
rm -rf $(INSTALL_DIR)