-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
70 lines (53 loc) · 2.61 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
PREFIX=/usr/local
CC=cc
INCLUDES=-Ilibs -Isrc -I.
LDFLAGS=libs/libchaste/libchaste.a
GLOBAL_CFLAGS=-g -std=c99 -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 -fPIC -Wno-missing-field-initializers -Wno-missing-braces
RELEASE_CFLAGS=$(INCLUDES) $(GLOBAL_CFLAGS) -O3 -Wall -DNDEBUG -DNOIFASSERT
ASSERT_CFLAGS=$(INCLUDES) $(GLOBAL_CFLAGS) -O3 -Wall -DNDEBUG
DEBUG_CFLAGS=$(INCLUDES) $(GLOBAL_CFLAGS) -Werror -Wall -Wextra -pedantic
BIN=bin/exact-capture
TOOLS=bin/exact-pcap-extract bin/exact-pcap-parse bin/exact-pcap-match bin/exact-pcap-modify bin/exact-pcap-analyze
EXACTCAP_SRCS=$(wildcard src/*.c) $(wildcard src/**/*.c)
EXACTCAP_HDRS=$(wildcard src/*.h) $(wildcard src/**/*.h)
LIBCHASTE_HDRS=$(wildcard libs/chaste/*.h) $(wildcard libs/chaste/**/*.h)
BUFF_SRC=tools/data_structs/buff.c tools/data_structs/pcap_buff.c
BUFF_HDRS=tools/data_structs/buff.h tools/data_structs/pcap_buff.h
all: CFLAGS = $(RELEASE_CFLAGS)
all: $(BIN) $(TOOLS)
assert: CFLAGS = $(ASSERT_CFLAGS)
assert: $(BIN) $(TOOLS)
debug: CFLAGS = $(DEBUG_CFLAGS)
debug: $(BIN) $(TOOLS)
tools: CFLAGS= $(RELEASE_CFLAGS)
tools: $(TOOLS)
bin/exact-capture: $(EXACTCAP_SRCS) $(EXACTCAP_HDRS) $(LIBCASHTE_HDRS)
mkdir -p bin
$(CC) $(CFLAGS) $(EXACTCAP_SRCS) $(LDFLAGS) -lm -lexanic -lpthread -lrt -o $@
bin/exact-pcap-parse: $(BUFF_SRC) $(BUFF_HDRS) tools/exact-pcap-parse.c $(EXACTCAP_HDRS) $(LIBCAHSTE_HDRS)
mkdir -p bin
$(CC) $(CFLAGS) $(BUFF_SRC) $(BUFF_HDRS) tools/exact-pcap-parse.c $(LDFLAGS) -o $@
bin/exact-pcap-match: $(BUFF_SRC) $(BUFF_HDRS) tools/exact-pcap-match.c $(EXACTCAP_HDRS) $(LIBCAHSTE_HDRS)
$(CC) $(CFLAGS) $(BUFF_SRC) $(BUFF_HDRS) tools/exact-pcap-match.c $(LDFLAGS) -o $@
bin/exact-pcap-extract: $(BUFF_SRC) $(BUFF_HDRS) tools/exact-pcap-extract.c $(EXACTCAP_HDRS) $(LIBCAHSTE_HDRS)
$(CC) $(CFLAGS) $(BUFF_SRC) $(BUFF_HDRS) tools/exact-pcap-extract.c $(LDFLAGS) -o $@
bin/exact-pcap-analyze: $(BUFF_SRC) $(BUFF_HDRS) tools/exact-pcap-analyze.c tools/utils.c $(EXACTCAP_HDRS) $(LIBCAHSTE_HDRS)
$(CC) $(CFLAGS) $(BUFF_SRC) $(BUFF_HDRS) tools/exact-pcap-analyze.c tools/utils.c $(LDFLAGS) -o $@
bin/exact-pcap-modify: tools/exact-pcap-modify.c $(EXACTCAP_HDRS) $(LIBCAHSTE_HDRS)
$(CC) $(CFLAGS) tools/exact-pcap-modify.c $(LDFLAGS) -o $@
install: all install_tools
install -d $(PREFIX)/bin
install -m 0755 -D $(BIN) $(PREFIX)/bin
install_tools: tools
install -d $(PREFIX)/bin
install -m 0755 -D $(TOOLS) $(PREFIX)/bin
uninstall: uninstall_tools
rm -f $(foreach file,$(BIN),$(PREFIX)/bin/$(file))
uninstall_tools:
rm -f $(foreach file,$(TOOLS),$(PREFIX)/bin/$(file))
.PHONY: docs
docs:
$(MAKE) -C docs/
clean:
rm -rf bin/*
$(MAKE) -C docs/ clean