-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile.rump
103 lines (81 loc) · 3.34 KB
/
Makefile.rump
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
include Makefile.include
###### source
RUMP_TOP=rump
# RUMP_DEBUG=-DDEBUG -DDEBUGJACK
RUMPUSER_CONF_H=$(RUMP_TOP)/lib/librumpuser/rumpuser_config.h
RUMP_NUSE_SRC=nuse-syscalls.c
RUMP_SRC= \
$(RUMP_TOP)/lib/librumpuser/rumpuser_sp.c \
$(RUMP_TOP)/lib/librumpuser/rumpuser.c \
$(RUMP_TOP)/lib/librumpuser/rumpuser_errtrans.c \
$(RUMP_TOP)/lib/librumpuser/rumpuser_random.c \
$(RUMP_TOP)/lib/librumpuser/rumpuser_pth_dummy.c
RUMP_HIJACK_SRC= \
$(RUMP_TOP)/lib/librumphijack/hijack.c
RUMP_CLIENT_SRC= \
$(RUMP_TOP)/lib/librumpclient/rumpclient.c \
$(RUMP_TOP)/sys/rump/librump/rumpkern/rump_syscalls.c
###### build flags
RUMP_CFLAGS=-I./$(RUMP_TOP)/lib/librumpuser \
-I./$(RUMP_TOP)/sys/rump/include \
-I./$(RUMP_TOP)/sys \
-I./$(RUMP_TOP)/lib/librumpuser \
-I./$(RUMP_TOP)/lib/librumpclient \
$(CFLAGS) -DRUMPUSER_CONFIG -DLIBRUMPUSER \
-I. -DRUMP_CLIENT \
$(RUMP_DEBUG)
RUMP_LDFLAGS=-lpthread -ldl -Wl,-rpath=. -L. -lrumpclient $(covl_$(COV)) -Wl,-z,lazy
RUMP_NUSE_OBJ=$(addsuffix .o,$(basename $(RUMP_NUSE_SRC)))
RUMP_OBJ=$(addsuffix .o,$(basename $(RUMP_SRC)))
RUMP_CLIENT_OBJ=$(addsuffix .o,$(basename $(RUMP_CLIENT_SRC)))
RUMP_HIJACK_OBJ=$(addsuffix .o,$(basename $(RUMP_HIJACK_SRC)))
RUMPS_OBJ=$(RUMP_OBJ) $(RUMP_NUSE_OBJ)
### required to build rump-netbsd-src
quiet_cmd_gitrump = GIT $@
cmd_gitrump = if [ ! -d "rump" ] ; then \
git submodule init; \
git submodule update rump ;\
fi ;\
rm -f git-sparse ;\
wget --no-check-certificate -q \
https://raw.githubusercontent.com/icoxfog417/git-sparse/master/git-sparse \
-O git-sparse ;\
sed -i "s/\/bin\/sh/\/bin\/bash/" git-sparse ;\
chmod +x git-sparse ;\
PATH=${PATH}:. git sparse
git-sparse:
$(QUIET_GEN) wget --no-check-certificate -q \
https://raw.githubusercontent.com/icoxfog417/git-sparse/master/git-sparse \
-O git-sparse ;\
sed -i "s/\/bin\/sh/\/bin\/bash/" git-sparse ;\
chmod +x git-sparse
$(RUMP_TOP): git-sparse
$(QUIET_GEN) git submodule init ;\
git submodule update rump ;\
PATH=${PATH}:. git sparse
$(RUMPUSER_CONF_H): $(RUMP_TOP)
@$(QUIET_GEN) cd $(RUMP_TOP)/lib/librumpuser/ && LDFLAGS= CFLAGS= ./configure
#### rumpserver object compile: embed to liblinux-nuse.so
$(RUMP_NUSE_OBJ): %.o : %.c $(RUMPUSER_CONF_H) Makefile.rump
$(QUIET_CC) $(CC) $(CFLAGS) $(RUMP_CFLAGS) \
-I$(srctree)/include -DHOSTOPS -c $< -o $@
$(RUMP_OBJ): %.o : %.c $(RUMPUSER_CONF_H) Makefile.rump
$(QUIET_CC) $(CC) $(CFLAGS) $(RUMP_CFLAGS) -DHOSTOPS -c $< -o $@
librumpserver.so: $(RUMP_TOP) $(RUMP_OBJ) $(RUMP_NUSE_OBJ) Makefile.rump Makefile
$(QUIET_LINK) $(CC) -shared -Wl,-z,lazy $(RUMPS_OBJ) -o $@
#### rump {client,hijack} compile
$(RUMP_CLIENT_OBJ): %.o : %.c $(RUMPUSER_CONF_H) Makefile.rump Makefile
$(QUIET_CC) $(CC) $(RUMP_CFLAGS) -U_FORTIFY_SOURCE -c $< -o $@
$(RUMP_HIJACK_OBJ): %.o : %.c Makefile.rump Makefile
$(QUIET_CC) $(CC) $(RUMP_CFLAGS) -U_FORTIFY_SOURCE -c $< -o $@
#### librumpclient.so
librumpclient.so: $(RUMP_CLIENT_OBJ) Makefile.rump
$(QUIET_LINK) $(CC) -shared $(RUMP_CLIENT_OBJ) $(covl_$(COV)) -o $@
#### libnuse-hijack.so
libnuse-hijack.so: $(RUMP_HIJACK_OBJ) $(RUMP_CLIENT_LIB) Makefile.rump
$(QUIET_LINK) $(CC) -shared $(RUMP_HIJACK_OBJ) $(RUMP_LDFLAGS) -o $@
clean:
$(call QUIET_CLEAN, RUMP) rm -f $(RUMP_CLIENT_OBJ) $(RUMP_NUSE_OBJ) \
$(RUMP_HIJACK_OBJ) $(RUMP_OBJ) git-sparse $(RUMPUSER_CONF_H)
.PHONY: clean
.NOTPARALLEL :