-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
79 lines (61 loc) · 1.72 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
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
# _ _ _ __ _ ______ ______
# | | | | | \ | |_____] | \
# |_____ |__|__| | \_| |_____] |_____/
#
CC ?= gcc
# TODO: can't use -pedantic-errors yet due to LOG macros
#
CFLAGS = -Iinclude -std=c99 -Wall
DEBUG ?= 0
APP_VERSION := $(shell git describe --always --tags)
CC_VERSION := "$(CC) $(shell $(CC) -dumpversion)"
TARGET ?= unix
RONN = ronn
MANPAGE = lwnbd.3
include .env
include src/Makefile
ifeq ($(TARGET),unix)
include ports/unix.mk
endif
ifeq ($(TARGET),iop)
include ports/playstation2/iop/iop.mk
endif
ifeq ($(TARGET),ee)
include ports/playstation2/ee/ee.mk
endif
ifeq ($(LWNBD_DEBUG),0)
else ifeq ($(DEBUG),1)
LWNBD_DEBUG = 1
endif
ifeq ($(LWNBD_DEBUG),1)
CFLAGS += -DLWNBD_DEBUG -g
endif
ifeq ($(MAKE_SILENT),1)
.SILENT: $(OBJ)
endif
ifeq ($(MAKE_FATAL),1)
CFLAGS += -Wfatal-errors
endif
$(MANPAGE): README.md
$(RONN) -r --pipe $< > $@
$(BIN): banner $(OBJ)
$(CC) $(CFLAGS) -o $(BIN) $(OBJ) $(LDFLAGS) $(LIBS)
banner:
@echo " _ _ _ __ _ ______ ______"
@echo "| | | | | \\ | |_____] | \\"
@echo "|_____ |__|__| | \\_| |_____] |_____/"
@echo
@echo -e "library version $(APP_VERSION) - BSD 2-Clause License\n"
clean:
rm -f $(BIN) $(MANPAGE) $(OBJ) *~ core
find -iname "*.o" -exec rm -f {} \;
nbdcleanup:
sudo lsof -t /dev/nbd* | sudo xargs -r kill -9
# hackish but let you check/format same way both CI and your own env.
# and manage .clang-format-ignore file properly.
cfla = $(WORKSPACE)/tools/clang-format-lint-action
check:
@python3 $(cfla)/run-clang-format.py --clang-format-executable $(cfla)/clang-format/clang-format14 -r .
format:
@python3 $(cfla)/run-clang-format.py --clang-format-executable $(cfla)/clang-format/clang-format14 -r . -i true
.PHONY: all clean test