Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Makefile « lib - github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 575a7bad3ff45a641347e6aa2f08d9f2e8ed8e53 (plain)
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
CRIU_SO			:= libcriu.so
CRIU_A			:= libcriu.a
UAPI_HEADERS		:= lib/c/criu.h images/rpc.proto images/rpc.pb-c.h criu/include/version.h

#
# File to keep track of files installed by setup.py
CRIT_SETUP_FILES	:= lib/.crit-setup.files

all-y	+= lib-c lib-a lib-py

#
# C language bindings.
lib/c/Makefile: ;
lib/c/%: .FORCE
	$(Q) $(MAKE) $(build)=lib/c $@

cflags-so		+= $(CFLAGS) -rdynamic -Wl,-soname,$(CRIU_SO).$(CRIU_SO_VERSION_MAJOR)
ldflags-so		+= -lprotobuf-c

lib/c/$(CRIU_SO): lib/c/built-in.o
	$(call msg-link, $@)
	$(Q) $(CC) -shared $(cflags-so) -o $@ $^ $(ldflags-so) $(LDFLAGS)
lib/c/$(CRIU_A): lib/c/built-in.o
	$(call msg-link, $@)
	$(Q) $(AR) rcs $@ $^
lib-c: lib/c/$(CRIU_SO)
lib-a: lib/c/$(CRIU_A)
.PHONY: lib-c lib-a

#
# Python bindings.
lib/py/Makefile: ;
lib/py/%: .FORCE
	$(call msg-gen, $@)
	$(Q) $(MAKE) $(build)=lib/py $@
lib-py:
	$(Q) $(MAKE) $(build)=lib/py all
.PHONY: lib-py

clean-lib:
	$(Q) $(MAKE) $(build)=lib/c clean
	$(Q) $(MAKE) $(build)=lib/py clean
.PHONY: clean-lib
clean: clean-lib
cleanup-y	+= lib/c/$(CRIU_SO) lib/c/$(CRIU_A) lib/c/criu.pc
mrproper: clean

install: lib-c lib-a lib-py crit/crit lib/c/criu.pc.in
	$(E) "  INSTALL " lib
	$(Q) mkdir -p $(DESTDIR)$(LIBDIR)
	$(Q) install -m 755 lib/c/$(CRIU_SO) $(DESTDIR)$(LIBDIR)/$(CRIU_SO).$(CRIU_SO_VERSION_MAJOR).$(CRIU_SO_VERSION_MINOR)
	$(Q) ln -fns $(CRIU_SO).$(CRIU_SO_VERSION_MAJOR).$(CRIU_SO_VERSION_MINOR) $(DESTDIR)$(LIBDIR)/$(CRIU_SO).$(CRIU_SO_VERSION_MAJOR)
	$(Q) ln -fns $(CRIU_SO).$(CRIU_SO_VERSION_MAJOR).$(CRIU_SO_VERSION_MINOR) $(DESTDIR)$(LIBDIR)/$(CRIU_SO)
	$(Q) install -m 755 lib/c/$(CRIU_A) $(DESTDIR)$(LIBDIR)/$(CRIU_A)
	$(Q) mkdir -p $(DESTDIR)$(INCLUDEDIR)/criu/
	$(Q) install -m 644 $(UAPI_HEADERS) $(DESTDIR)$(INCLUDEDIR)/criu/
	$(E) "  INSTALL " pkgconfig/criu.pc
	$(Q) mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig
	$(Q) sed -e 's,@version@,$(CRIU_VERSION),' -e 's,@libdir@,$(LIBDIR),' -e 's,@includedir@,$(dir $(INCLUDEDIR)/criu/),' lib/c/criu.pc.in > lib/c/criu.pc
	$(Q) install -m 644 lib/c/criu.pc $(DESTDIR)$(LIBDIR)/pkgconfig
	$(E) "  INSTALL " crit
	$(Q) $(PYTHON) scripts/crit-setup.py install --prefix=$(DESTDIR)$(PREFIX) --record $(CRIT_SETUP_FILES)
.PHONY: install

uninstall:
	$(E) " UNINSTALL" $(CRIU_SO)
	$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBDIR)/,$(CRIU_SO).$(CRIU_SO_VERSION_MAJOR))
	$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBDIR)/,$(CRIU_SO))
	$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBDIR)/,$(CRIU_A))
	$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBDIR)/,$(CRIU_SO).$(CRIU_SO_VERSION_MAJOR).$(CRIU_SO_VERSION_MINOR))
	$(Q) $(RM) $(addprefix $(DESTDIR)$(INCLUDEDIR)/criu/,$(notdir $(UAPI_HEADERS)))
	$(E) " UNINSTALL" pkgconfig/criu.pc
	$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBDIR)/pkgconfig/,criu.pc)
	$(E) " UNINSTALL" crit
	$(Q) while read -r file; do $(RM) "$$file"; done < $(CRIT_SETUP_FILES)
.PHONY: uninstall