forked from dmarion/vpp-toys
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (39 loc) · 1.12 KB
/
Makefile
File metadata and controls
50 lines (39 loc) · 1.12 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
VPP_DIR?=$(PWD)/../vpp
build_dir = $(PWD)/build
define configure
@mkdir -p $(build_dir)
@cd $(build_dir) && cmake -G Ninja \
-DVPP_PATH:PATH=$(VPP_DIR) \
$(PWD)
endef
$(build_dir):
$(call configure)
.PHONY: build
build: $(build_dir)
@cmake --build $<
clean:
@rm -rf $(build_dir) bin
fixstyle:
@for i in */*.[ch]; do indent $$i; done
.PHONY: ctags
ctags:
@find . $(VPP_DIR) -name \*.[chS] > ctags.files
@ctags --totals --tag-relative -L ctags.files
@rm ctags.files
compdb:
@ninja -C build -t compdb \
$$(ninja -C build -t rules \
| sed -ne '/C_COMPILER.*debug/p' -e '/C_COMPILER__vpptoys/p') \
| sed -e 's/-Werror/-Werror -Wno-unused-function/' \
| sed -e 's/-Werror/-Werror -include vppinfra\/format.h/' \
> compile_commands.json
.DEFAULT_GOAL := help
help:
@echo "Make Targets:"
@echo " build - build binaries"
@echo " clean - wipe all build products"
@echo " ctags - (re)generate ctags database"
@echo " compdb - (re)generate compile_commands.json"
@echo ""
@echo "Make Arguments:"
@echo " VPP_DIR=<path> - path to VPP directory"