forked from checkpoint-restore/criu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
116 lines (95 loc) · 3.3 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
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
104
105
106
107
108
109
110
111
112
113
114
115
116
CFLAGS := $(filter-out -pg $(CFLAGS-GCOV) $(CFLAGS-ASAN),$(CFLAGS))
CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
CFLAGS += -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=0
PLUGIN_ARCH_DIR := compel/arch/$(ARCH)/plugins
#
# CFLAGS, ASFLAGS, LDFLAGS
# Required for pie code
ccflags-y += $(CFLAGS_PIE)
# UAPI inclusion, referred as <compel/...>
ccflags-y += -I compel/include/uapi
asflags-y += -I compel/include/uapi
# General compel includes
ccflags-y += -iquote compel/include
ifeq ($(ARCH),mips)
ccflags-y += -mno-abicalls -fno-pic -fno-stack-protector
else
ccflags-y += -fpie -fno-stack-protector
endif
# General compel/plugins includes
ccflags-y += -iquote $(obj)/include
asflags-y += -iquote $(obj)/include
# Arch compel/plugins includes
ccflags-y += -iquote $(PLUGIN_ARCH_DIR)/include
asflags-y += -iquote $(PLUGIN_ARCH_DIR)/include
asflags-y += -iquote $(PLUGIN_ARCH_DIR)
# General flags for assembly
ifeq ($(ARCH),mips)
asflags-y += -mno-abicalls -fno-pic -Wstrict-prototypes
else
asflags-y += -fpie -Wstrict-prototypes
endif
asflags-y += -nostdlib -fomit-frame-pointer
asflags-y += -fno-stack-protector
ldflags-y += -z noexecstack
#
# Shmem plugin
target += shmem
shmem-lib-y += shmem/shmem.o
#
# STD plugin
target += std
std-lib-y += std/std.o
std-lib-y += std/fds.o
std-lib-y += std/log.o
std-lib-y += std/string.o
std-lib-y += std/infect.o
std-lib-y += ./$(PLUGIN_ARCH_DIR)/std/parasite-head.o
#
# FDS plugin
target += fds
fds-lib-y += fds/fds.o
ifeq ($(ARCH),x86)
std-lib-y += ./$(PLUGIN_ARCH_DIR)/std/memcpy.o
endif
ifeq ($(ARCH),mips)
std-lib-y += ./$(PLUGIN_ARCH_DIR)/std/memcpy.o
endif
ifeq ($(ARCH),ppc64)
std-lib-y += ./$(PLUGIN_ARCH_DIR)/std/memcpy.o
std-lib-y += ./$(PLUGIN_ARCH_DIR)/std/memcmp.o
endif
include ./$(PLUGIN_ARCH_DIR)/std/syscalls/Makefile.syscalls
define syscall-priority
$(addprefix $(obj)/,$($(1):%.o=%.d)): | $($(2))
$(addprefix $(obj)/,$($(1):%.o=%.i)): | $($(2))
$(addprefix $(obj)/,$($(1):%.o=%.s)): | $($(2))
$(addprefix $(obj)/,$($(1))): | $($(2))
endef
#
# Almost all plugins depen on syscall headers
# and definitions so we have to order their
# generation manually.
$(foreach t,$(target),$(eval $(call syscall-priority,$(t)-lib-y,std-headers-deps)))
#
# FIXME syscall-types.h should be setup earlier
#
install: compel/plugins/std.lib.a compel/plugins/fds.lib.a
$(E) " INSTALL " compel plugins
$(Q) mkdir -p $(DESTDIR)$(LIBEXECDIR)/compel/
$(Q) install -m 0644 $^ $(DESTDIR)$(LIBEXECDIR)/compel/
$(Q) mkdir -p $(DESTDIR)$(LIBEXECDIR)/compel/scripts
$(Q) install -m 0644 compel/arch/$(ARCH)/scripts/compel-pack.lds.S $(DESTDIR)$(LIBEXECDIR)/compel/scripts
$(E) " INSTALL " compel plugins uapi
$(Q) mkdir -p $(DESTDIR)$(INCLUDEDIR)/compel/plugins/std/asm
$(Q) cp -fL compel/plugins/include/uapi/*.h $(DESTDIR)$(INCLUDEDIR)/compel/plugins/
$(Q) cp -fL compel/plugins/include/uapi/std/*.h $(DESTDIR)$(INCLUDEDIR)/compel/plugins/std/
$(Q) cp -fL compel/plugins/include/uapi/std/asm/*.h $(DESTDIR)$(INCLUDEDIR)/compel/plugins/std/asm/
.PHONY: install
uninstall:
$(E) " UNINSTALL" compel plugins
$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBEXECDIR)/compel/,*.lib.a)
$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBEXECDIR)/compel/scripts/,compel-pack.lds.S)
$(E) " UNINSTALL" compel and plugins uapi
$(Q) $(RM) -rf $(addprefix $(DESTDIR)$(INCLUDEDIR)/,compel/plugins)
.PHONY: uninstall