forked from zeek/packet-bricks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.old
68 lines (59 loc) · 2.05 KB
/
Makefile.old
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
#---------------------------------------------------------------------#
BINDIR := $(shell pwd)/bin
BIN := $(BINDIR)/bricks
OSARCH := $(shell uname)
OSARCH := $(findstring $(OSARCH),FreeBSD Linux Darwin)
DEBUG_CFLAGS := -g -DDEBUG -Wall -Werror -Wunused-function -Wextra -D_GNU_SOURCE -D__USE_GNU
DEBUG_CFLAGS += -DDLUA -DDPKTENG -DDNMP -DDUTIL -DDIFACE -DDBKEND -DDPKTHASH -DDRULE
#---------------------------------------------------------------------#
ifeq ($V,) # no echo
export MSG=@echo
export HIDE=@
else
export MSG=@\#
export HIDE=
endif
export OSARCH
export OBJDIR := $(shell pwd)/.objs
export CFLAGS := -O3 -pipe -Wall -Wunused-function -Wextra -Werror -D_GNU_SOURCE -D__USE_GNU
export NETMAP_INCLUDE := -I$(shell pwd)/include/netmap
ifeq ($(OSARCH),FreeBSD)
export INCLUDE := -I$(shell pwd)/include -I/usr/local/include/lua51/ -Isys/sys/
export LIBS := -L/usr/local/lib/ -llua-5.1 -lpthread
export LDFLAGS := $(LIBS)
else
export INCLUDE := -I$(shell pwd)/include -I/usr/include/lua5.1/
export LIBS := -llua5.1 -lpthread
export LDFLAGS := $(LIBS) -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc \
-fno-builtin-free -fno-builtin-posix_memalign -ljemalloc
endif
#---------------------------------------------------------------------#
all: bricks
objs:
mkdir -p $(OBJDIR)
cd src && $(MAKE)
objs-dbg:
$(eval export CFLAGS := $(DEBUG_CFLAGS))
mkdir -p $(OBJDIR)
cd src && $(MAKE)
bricks: objs
mkdir -p $(BINDIR)
$(MSG) " LD $@"
$(HIDE) $(CC) $(OBJDIR)/*.o $(LDFLAGS) -o $(BIN)
strip $(BIN)
run: bricks
$(BIN) -f scripts/startup.lua
#---------------------------------------------------------------------#
debug: bricks-debug
bricks-debug: objs-dbg
mkdir -p $(BINDIR)
$(MSG) " LD $@-debug"
$(HIDE) $(CC) $(OBJDIR)/*.o $(LDFLAGS) -o $(BIN)
#---------------------------------------------------------------------#
clean:
cd src && $(MAKE) clean
$(RM) -rf $(BINDIR) include/*~ tags scripts/*~
.PHONY: clean
tags:
find -name '*.c' -or -name '*.h' | xargs ctags
#---------------------------------------------------------------------#