forked from CESNET/nemea-modules-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (40 loc) · 1.22 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
ifeq ($(CMAKE),)
CMAKE := $(shell which cmake3)
endif
ifeq ($(CMAKE),)
CMAKE := cmake
endif
ifeq ($(CLANG_FORMAT),)
CLANG_FORMAT := clang-format
endif
ifeq ($(RUN_CLANG_TIDY),)
RUN_CLANG_TIDY := run-clang-tidy
endif
SOURCE_DIR = $(shell pwd)/modules/ $(shell pwd)/common/
HEADER_FILTER = $(shell echo $(SOURCE_DIR) | sed 's/ /|/g')
SOURCE_REGEX = '.*\.\(cpp\|hpp\|c\|h\)'
.PHONY: all
all: build/Makefile
@$(MAKE) --no-print-directory -C build
%: build/Makefile
@$(MAKE) --no-print-directory -C build $@
build/Makefile: | build
@cd build && $(CMAKE) $(CMAKE_ARGS) ..
build:
@mkdir -p $@
.PHONY: format
format:
@find $(SOURCE_DIR) -type f -regex $(SOURCE_REGEX) -print0 | xargs -0 $(CLANG_FORMAT) --dry-run
.PHONY: format-fix
format-fix:
@find $(SOURCE_DIR) -type f -regex $(SOURCE_REGEX) -print0 | xargs -0 $(CLANG_FORMAT) -i
.PHONY: tidy
tidy: all
$(RUN_CLANG_TIDY) -p build -quiet -j $(shell nproc) -header-filter="$(HEADER_FILTER)" $(SOURCE_DIR)
.PHONY: tidy-fix
tidy-fix: all
$(RUN_CLANG_TIDY) -p build -quiet -fix -j $(shell nproc) -header-filter="$(HEADER_FILTER)" $(SOURCE_DIR)
.PHONY: doxygen
doxygen: build
@cd build && $(CMAKE) $(CMAKE_ARGS) -DNM_NG_ENABLE_DOC_DOXYGEN=ON ..
@$(MAKE) --no-print-directory -C build $@