forked from snabbco/snabb
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile
65 lines (58 loc) · 2.13 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
LUASRC = $(wildcard src/lua/*.lua)
LUAOBJ = $(LUASRC:.lua=.o)
CSRC = $(wildcard src/c/*.c)
COBJ = $(CSRC:.c=.o)
PREFIX = /usr/local
RECIPE ?= Makefile.vita-test
LUAJIT_CFLAGS := -include $(CURDIR)/gcc-preinclude.h -DLUAJIT_VMPROFILE
all: $(LUAJIT) $(SYSCALL) $(PFLUA) luajit ljsyscall pflua ljndpi blake2s curve25519sandy2x
cd src && $(MAKE) -f $(RECIPE)
luajit: $(LUAJIT)
@(cd lib/luajit && (cd src && $(MAKE) reusevm) && $(MAKE) CFLAGS="$(LUAJIT_CFLAGS)")
ljsyscall: $(SYSCALL)
@mkdir -p src/syscall/linux
@cp -p lib/ljsyscall/syscall.lua src/
@cp -p lib/ljsyscall/syscall/*.lua src/syscall/
@cp -p lib/ljsyscall/syscall/linux/*.lua src/syscall/linux/
@cp -pr lib/ljsyscall/syscall/linux/x64 src/syscall/linux/
@cp -pr lib/ljsyscall/syscall/shared src/syscall/
pflua:
@cp -p lib/pflua/src/pf.lua src/
@cp -pr lib/pflua/src/pf src/pf
ljndpi:
@mkdir -p src/ndpi
@cp -p lib/ljndpi/ndpi.lua src/
@cp -p lib/ljndpi/ndpi/*.lua src/ndpi/
blake2s:
@(cd lib/blake/sse && \
$(CC) $(DEBUG) -Wl,-E -O2 -c -Wall -Werror blake2s.c)
curve25519sandy2x:
@(cd lib/curve25519sandy2x && \
$(CC) $(DEBUG) -Wl,-E -O2 -c -Wall -Werror -static *.c *.S)
install: all
install -D src/snabb ${DESTDIR}${PREFIX}/bin/snabb
clean:
(cd lib/luajit && $(MAKE) clean)
(rm -rf lib/blake/sse/*.o)
(rm -rf lib/curve25519sandy2x/*.o)
(cd src; $(MAKE) clean)
(cd src; rm -rf syscall.lua syscall ndpi.lua ndpi pf.lua pf)
PACKAGE:=snabbswitch
DIST_BINARY:=snabb
BUILDDIR:=$(shell pwd)
dist: DISTDIR:=$(BUILDDIR)/$(PACKAGE)-$(shell git describe --tags)
dist: all
mkdir "$(DISTDIR)"
git clone "$(BUILDDIR)" "$(DISTDIR)/snabbswitch"
rm -rf "$(DISTDIR)/snabbswitch/.git"
cp "$(BUILDDIR)/src/snabb" "$(DISTDIR)/"
if test "$(DIST_BINARY)" != "snabb"; then ln -s "snabb" "$(DISTDIR)/$(DIST_BINARY)"; fi
cd "$(DISTDIR)/.." && tar cJvf "`basename '$(DISTDIR)'`.tar.xz" "`basename '$(DISTDIR)'`"
rm -rf "$(DISTDIR)"
docker:
docker build -t snabb .
@ln -sf ../src/scripts/dock.sh src/snabb
@echo "Usage: docker run -ti --rm snabb <program> ..."
@echo "or simply call 'src/snabb <program> ...'"
.SERIAL: all
.PHONY: luajit ljsyscall pflua ljndpi blake2s curve25519sandy2x