-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
86 lines (69 loc) · 1.97 KB
/
Makefile
File metadata and controls
86 lines (69 loc) · 1.97 KB
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
80
81
82
83
84
85
BUILD_TYPE?=Release
BUILD_DIR?=build
BUILD_REPOS?=git@github.com:OpenChannelSSD/pblk-tools.git
#
# Traditional build commands / make interface
#
default: make
.PHONY: debug
debug:
$(eval BUILD_TYPE := Debug)
.PHONY: cmake_check
cmake_check:
@cmake --version || (echo "\n** Please install 'cmake' **\n" && exit 1)
.PHONY: configure
configure: cmake_check
mkdir -p $(BUILD_DIR)
cd $(BUILD_DIR) && cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) ../src
@echo "Modify build configuration in '$(BUILD_DIR)'"
.PHONY: make
make: configure
cd $(BUILD_DIR) && make
.PHONY: install
install:
cd $(BUILD_DIR) && make install
.PHONY: clean
clean:
rm -fr $(BUILD_DIR) || true
all: clean default install
#
# Extension: package generation
#
.PHONY: make-pkg
make-pkg: configure
cd $(BUILD_DIR) && make package
.PHONY: install-pkg
install-pkg:
sudo dpkg -i $(BUILD_DIR)/*.deb
.PHONY: uninstall-pkg
uninstall-pkg:
sudo apt-get --yes remove nvm_pblk || true
#
# Extension: commands useful in development cycle
#
.PHONY: dev
dev: uninstall-pkg clean make make-pkg install-pkg
#
# Extension: documentation generation
#
.PHONY: doc
doc:
@mkdir -p $(BUILD_DIR)/doc/sphinx/html
sphinx-build -b html -c doc -E doc/src $(BUILD_DIR)/doc/sphinx/html
.PHONY: sphinx-view
doc-view:
xdg-open $(BUILD_DIR)/doc/sphinx/html/index.html
.PHONY: doc-publish
doc-publish:
rm -rf $(BUILD_DIR)/ghpages
mkdir -p $(BUILD_DIR)/ghpages
git clone -b gh-pages $(BUILD_REPOS) --single-branch $(BUILD_DIR)/ghpages
cd $(BUILD_DIR)/ghpages && git rm -rf --ignore-unmatch .
cp -r $(BUILD_DIR)/doc/sphinx/html/. $(BUILD_DIR)/ghpages/
touch $(BUILD_DIR)/ghpages/.nojekyll
cd $(BUILD_DIR)/ghpages && git config user.name "Mr. Robot"
cd $(BUILD_DIR)/ghpages && git config user.email "foo@example.com"
cd $(BUILD_DIR)/ghpages && git add .
cd $(BUILD_DIR)/ghpages && git commit -m "Autogen docs for `git rev-parse --short HEAD`."
cd $(BUILD_DIR)/ghpages && git push origin --delete gh-pages
cd $(BUILD_DIR)/ghpages && git push origin gh-pages