-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (39 loc) · 1.16 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
# SPDX-License-Identifier: GPL-2.0-or-later */
#
# Copyright(c) 2024 John Sanpe <[email protected]>
#
SDBD_C_FLAGS = -Wall -Wextra -Wno-unused-parameter \
-Wl,--gc-sections -ffunction-sections -fdata-sections \
-lbfenv -lbfdev -lpthread -lutil
SDBD_C_RELDBG_FLAGS = $(SDBD_C_FLAGS) \
-g -DDEBUG
SDBD_C_DEBUG_FLAGS = $(SDBD_C_RELDBG_FLAGS) \
-fsanitize=address -fsanitize=undefined \
-fsanitize-recover=all -fno-omit-frame-pointer \
-fno-stack-protector
all: sdbd
small: sdbd-small
reldbg: sdbd-reldbg
debug: sdbd-debug
PHONY += all small reldbg debug
clean:
rm -rf sdbd sdbd-reldbg sdbd-small sdbd-debug
PHONY += clean
install: sdbd
install -Dm755 sdbd /usr/local/bin/sdbd
PHONY += install
uninstall:
rm -f /usr/local/bin/sdbd
PHONY += uninstall
sdbd: sdbd.c
$(CROSS_COMPILE)gcc -o $@ $^ -O2 $(SDBD_C_FLAGS)
$(CROSS_COMPILE)strip $@
sdbd-small: sdbd.c
$(CROSS_COMPILE)gcc -o $@ $^ -O2 -DPROFILE_SMALL $(SDBD_C_FLAGS)
$(CROSS_COMPILE)strip $@
sdbd-reldbg: sdbd.c
$(CROSS_COMPILE)gcc -o $@ $^ -O2 $(SDBD_C_RELDBG_FLAGS)
sdbd-debug: sdbd.c
$(CROSS_COMPILE)gcc -o $@ $^ -O0 $(SDBD_C_DEBUG_FLAGS)
# Declare the contents of the PHONY variable as phony.
.PHONY: $(PHONY)