2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 13:28:27 +00:00

make: Use generic build engine for libcriu.so

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Cyrill Gorcunov 2013-08-28 23:57:47 +04:00 committed by Pavel Emelyanov
parent c75c92db1d
commit dfdac2cf3a
2 changed files with 32 additions and 14 deletions

View File

@ -126,12 +126,9 @@ ifeq ($(GCOV),1)
%.o $(PROGRAM): override CFLAGS += --coverage %.o $(PROGRAM): override CFLAGS += --coverage
endif endif
all: config pie $(VERSION_HEADER) lib all: config pie $(VERSION_HEADER) $(CRIU-LIB)
$(Q) $(MAKE) $(PROGRAM) $(Q) $(MAKE) $(PROGRAM)
lib: $(VERSION_HEADER)
$(Q) $(MAKE) -C lib all
protobuf/%:: protobuf/%::
$(Q) $(MAKE) $(build)=protobuf $@ $(Q) $(MAKE) $(build)=protobuf $@
protobuf: protobuf:
@ -152,6 +149,11 @@ pie: arch/$(ARCH)
built-in.o: $(VERSION_HEADER) pie built-in.o: $(VERSION_HEADER) pie
$(Q) $(MAKE) $(build-crtools)=. $@ $(Q) $(MAKE) $(build-crtools)=. $@
lib/%:: $(VERSION_HEADER) config built-in.o
$(Q) $(MAKE) $(build)=lib $@
lib: $(VERSION_HEADER) config built-in.o
$(Q) $(MAKE) $(build)=lib all
PROGRAM-BUILTINS += pie/util-fd.o PROGRAM-BUILTINS += pie/util-fd.o
PROGRAM-BUILTINS += pie/util.o PROGRAM-BUILTINS += pie/util.o
PROGRAM-BUILTINS += protobuf/built-in.o PROGRAM-BUILTINS += protobuf/built-in.o
@ -176,11 +178,11 @@ clean-built:
$(Q) $(MAKE) $(build)=arch/$(ARCH) clean $(Q) $(MAKE) $(build)=arch/$(ARCH) clean
$(Q) $(MAKE) $(build)=protobuf clean $(Q) $(MAKE) $(build)=protobuf clean
$(Q) $(MAKE) $(build)=pie clean $(Q) $(MAKE) $(build)=pie clean
$(Q) $(MAKE) $(build)=lib clean
$(Q) $(MAKE) $(build-crtools)=. clean $(Q) $(MAKE) $(build-crtools)=. clean
$(Q) $(MAKE) -C Documentation clean $(Q) $(MAKE) -C Documentation clean
$(Q) $(RM) ./include/config.h $(Q) $(RM) ./include/config.h
$(Q) $(RM) ./$(PROGRAM) $(Q) $(RM) ./$(PROGRAM)
$(Q) $(MAKE) -C lib clean
rebuild: clean-built rebuild: clean-built
$(E) " FORCE-REBUILD" $(E) " FORCE-REBUILD"

View File

@ -1,13 +1,29 @@
.PHONY: all clean obj-y += criu.o
all: libcriu.so cflags-y += -shared -fPIC -Wa,--noexecstack -fno-stack-protector
LDFLAGS += --export-dynamic
includes += -iquote $(obj)/../arch/$(ARCH)/include -iquote $(obj)/../include -iquote $(obj)/..
libcriu.so: criu.o .SECONDARY:
$(Q) $(CC) $(CFLAGS) -shared -o $@ criu.o
criu.o: #
$(Q) $(CC) $(CFLAGS) -fPIC -c criu.c -I ../include/ # We need util-fd.c to be re-compiled with
# own flags, but our build engine can't
# do such tricks yet, so write a rule
# manually for a while.
$(obj)/util-fd.o: $(obj)/../pie/util-fd.c
$(E) " CC " $@
$(Q) $(CC) -c $(cflags-y) $(CFLAGS) $(includes) $< -o $@
clean: $(obj)/built-in.o: $(obj)/util-fd.o
$(Q) $(RM) -f *.o
$(Q) $(RM) -f *.so $(obj)/libcriu.so: $(obj)/built-in.o
$(E) " GEN " $@
$(Q) $(CC) $(CFLAGS) -shared $^ -o $@
_all += $(obj)/built-in.o
cleanup-y += $(obj)/*.so
ifneq ($(MAKECMDGOALS),clean)
incdeps := y
endif