-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
84 lines (68 loc) · 1.76 KB
/
Copy pathMakefile
File metadata and controls
84 lines (68 loc) · 1.76 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
export PWD=$(shell pwd)
export BUILD=$(PWD)/build
VERSION='"$(shell git describe --tags --dirty)"'
export CC=gcc
CFLAGS_CONFIG?=
export CFLAGS=-std=c99 \
-fPIC \
-I$(PWD)/include \
-I$(BUILD)/include \
-DNRL_VERSION=$(VERSION) \
$(CFLAGS_CONFIG)
CFLAGS_RELEASE=-O2 -w -DNDEBUG
CFLAGS_DEBUG=-Wall -Wextra -g
export AR=ar
export ARFLAGS=rvsc
export TARGET_STATIC_IM=$(BUILD)/lib/libnanorl.part.a
export TARGET_STATIC=$(BUILD)/lib/libnanorl.a
export TARGET_SHARED=$(BUILD)/lib/libnanorl.so
export TARGET_EXAMPLE=$(BUILD)/bin/nrl_example
export TARGET_MAN=$(BUILD)/share/man/man3/nanorl.3.gz
export OBJ_DIR=
export TASK=
BUILD_MK=$(PWD)/build.mk
PREFIX?=/usr
MAN_SRC=doc/nanorl.man
# Build tasks
.PHONY: release
release: TASK=release
release: CFLAGS+=$(CFLAGS_RELEASE)
release: OBJ_DIR=$(BUILD)/obj
release:
$(MAKE) -f $(BUILD_MK)
.PHONY: debug
debug: TASK=debug
debug: CFLAGS+=$(CFLAGS_DEBUG)
debug: OBJ_DIR=$(BUILD)/objd
debug:
$(MAKE) -f $(BUILD_MK)
.PHONY: install
install:
mkdir -p $(PREFIX)/lib $(PREFIX)/include/nanorl $(PREFIX)/share/man/man3
install -Dm755 $(TARGET_SHARED) $(PREFIX)/lib
find $(BUILD)/include/nanorl -type f -exec install -Dm644 {} $(PREFIX)/include/nanorl \;
install -Dm644 $(MAN_SRC) $(PREFIX)/share/man/man3/nanorl.3
.PHONY: clean
clean:
rm -rf $(BUILD)
# Formatting
FORMAT=clang-format
FORMAT_CHECK_FLAGS=--dry-run --Werror
FORMAT_FIX_FLAGS=-i
FORMAT_FILES=$(shell find src -type f) \
$(shell find include -type f)
.PHONY: checkformat
checkformat:
$(FORMAT) $(FORMAT_CHECK_FLAGS) $(FORMAT_FILES)
.PHONY: format
format:
$(FORMAT) $(FORMAT_FIX_FLAGS) $(FORMAT_FILES)
# Documentation
DOXYGEN=doxygen
DOXYGEN_CONF=Doxyfile
.PHONY: docs
docs:
$(DOXYGEN) $(DOXYGEN_CONF)
.PHONY: fulldocs
fulldocs:
SRC_ENABLE='src' $(DOXYGEN) $(DOXYGEN_CONF)