forked from checkpoint-restore/criu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.compel
77 lines (62 loc) · 2.78 KB
/
Makefile.compel
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
COMPEL_BIN := ./compel/compel-host
export COMPEL_BIN
COMPEL_VERSION_HEADER := compel/include/version.h
$(COMPEL_VERSION_HEADER): Makefile.versions
$(call msg-gen, $(COMPEL_VERSION_HEADER))
$(Q) echo "/* Autogenerated, do not edit */" > $(COMPEL_VERSION_HEADER)
$(Q) echo "#ifndef COMPEL_SO_VERSION_H__" >> $(COMPEL_VERSION_HEADER)
$(Q) echo "#define COMPEL_SO_VERSION_H__" >> $(COMPEL_VERSION_HEADER)
$(Q) echo "#define COMPEL_SO_VERSION \"$(COMPEL_SO_VERSION)\"" >> $(COMPEL_VERSION_HEADER)
$(Q) echo "#define COMPEL_SO_VERSION_MAJOR " $(COMPEL_SO_VERSION_MAJOR) >> $(COMPEL_VERSION_HEADER)
$(Q) echo "#define COMPEL_SO_VERSION_MINOR " $(COMPEL_SO_VERSION_MINOR) >> $(COMPEL_VERSION_HEADER)
$(Q) echo "#define COMPEL_SO_VERSION_SUBLEVEL " $(COMPEL_SO_VERSION_SUBLEVEL) >> $(COMPEL_VERSION_HEADER)
$(Q) echo "#endif /* COMPEL_SO_VERSION_H__ */" >> $(COMPEL_VERSION_HEADER)
compel/include/asm:
$(call msg-gen, $@)
$(Q) ln -s ../arch/$(ARCH)/src/lib/include $@
compel-deps += compel/include/asm
compel-deps += $(COMPEL_VERSION_HEADER)
compel-deps += $(CONFIG_HEADER)
compel-deps += include/common/asm
compel-plugins += compel/plugins/std.lib.a compel/plugins/fds.lib.a
LIBCOMPEL_SO := libcompel.so
LIBCOMPEL_A := libcompel.a
export LIBCOMPEL_SO LIBCOMPEL_A
#
# Compel itself.
compel/Makefile: ;
compel/%: $(compel-deps) $(compel-plugins) .FORCE
$(Q) $(MAKE) $(build)=compel $@
criu-deps += compel/compel-host-bin
#
# Make sure the host program is ready after the
# library and plugins are built.
compel/compel-host-bin: | compel/$(LIBCOMPEL_A) $(compel-plugins)
$(COMPEL_BIN): compel/compel-host-bin
#
# Plugins
compel/plugins/Makefile: ;
compel/plugins/%: $(compel-deps) .FORCE
$(Q) $(MAKE) $(build)=compel/plugins $@
#
# GNU make 4.x supports targets matching via wide
# match targeting, where GNU make 3.x series (used on
# Travis) is not, so we have to write them here explicitly.
compel/plugins/std.lib.a: $(compel-deps) .FORCE
$(Q) $(MAKE) $(build)=compel/plugins $@
compel/plugins/shmem.lib.a: $(compel-deps) compel/plugins/std.lib.a .FORCE
$(Q) $(MAKE) $(build)=compel/plugins $@
compel/plugins/fds.lib.a: $(compel-deps) compel/plugins/std.lib.a .FORCE
$(Q) $(MAKE) $(build)=compel/plugins $@
compel/compel: compel/built-in.o compel/$(LIBCOMPEL_A) | $(compel-deps)
$(call msg-link, $@)
$(Q) $(CC) $(CFLAGS) $^ $(WRAPFLAGS) $(LDFLAGS) -rdynamic -o $@
#
# And compel library.
LIBCOMPEL_SO_CFLAGS += $(CFLAGS) -rdynamic -Wl,-soname,$(LIBCOMPEL_SO).$(COMPEL_SO_VERSION_MAJOR)
compel/$(LIBCOMPEL_SO): compel/$(LIBCOMPEL_A)
$(call msg-link, $@)
$(Q) $(CC) -shared $(LIBCOMPEL_SO_CFLAGS) -o $@ -Wl,--whole-archive $^ -Wl,--no-whole-archive $(LDFLAGS)
compel-install-targets += compel/$(LIBCOMPEL_SO)
compel-install-targets += compel/compel
compel-install-targets += $(compel-plugins)