-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (52 loc) · 1.39 KB
/
Makefile
File metadata and controls
63 lines (52 loc) · 1.39 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
# Makefile
# Purpose: Provides the base build scaffolding for the epoll-echo project.
# Uses conservative hardening-friendly defaults suitable for GNU/Linux.
CC ?= cc
CFLAGS ?= -O2 -g
CFLAGS += -std=c11 -Wall -Wextra \
-Werror=implicit-function-declaration \
-Wpointer-arith -Wformat -Wshadow \
-D_GNU_SOURCE -fstack-protector-strong -D_FORTIFY_SOURCE=2
CPPFLAGS += -Iinclude -MMD -MP
LDFLAGS ?= -Wl,-z,relro -Wl,-z,now -pie
LDLIBS ?=
ARTIFACT_PATTERNS := ../epoll-echo_*.deb ../epoll-echo_*.dsc ../epoll-echo_*.changes \
../epoll-echo_*.buildinfo ../epoll-echo_*.tar.* ../epoll-echo-dbgsym_*.ddeb
ifeq ($(ENABLE_SYSTEMD),1)
CPPFLAGS += -DENABLE_SYSTEMD
LDLIBS += -lsystemd
endif
BIN := epoll-echo
SRCS := \
src/main.c \
src/loop.c \
src/tcp.c \
src/udp.c \
src/cmd.c \
src/stats.c \
src/timeutil.c \
src/log.c \
src/net.c
OBJS := $(SRCS:.c=.o)
DEPS := $(OBJS:.o=.d)
.PHONY: all clean test deb
all: $(BIN)
$(BIN): $(OBJS)
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
%.o: %.c
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
clean:
$(RM) $(OBJS) $(BIN) $(DEPS)
test: $(BIN)
@echo "No automated tests are defined yet."
deb:
dpkg-buildpackage -us -uc
debian/rules clean
@set -e; \
for pattern in $(ARTIFACT_PATTERNS); do \
for f in $$pattern; do \
[ -e "$$f" ] || continue; \
mv -f "$$f" .; \
done; \
done
-include $(DEPS)