Commit dfdac2cf authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

make: Use generic build engine for libcriu.so

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent c75c92db
......@@ -126,12 +126,9 @@ ifeq ($(GCOV),1)
%.o $(PROGRAM): override CFLAGS += --coverage
endif
all: config pie $(VERSION_HEADER) lib
all: config pie $(VERSION_HEADER) $(CRIU-LIB)
$(Q) $(MAKE) $(PROGRAM)
lib: $(VERSION_HEADER)
$(Q) $(MAKE) -C lib all
protobuf/%::
$(Q) $(MAKE) $(build)=protobuf $@
protobuf:
......@@ -152,6 +149,11 @@ pie: arch/$(ARCH)
built-in.o: $(VERSION_HEADER) pie
$(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.o
PROGRAM-BUILTINS += protobuf/built-in.o
......@@ -176,11 +178,11 @@ clean-built:
$(Q) $(MAKE) $(build)=arch/$(ARCH) clean
$(Q) $(MAKE) $(build)=protobuf clean
$(Q) $(MAKE) $(build)=pie clean
$(Q) $(MAKE) $(build)=lib clean
$(Q) $(MAKE) $(build-crtools)=. clean
$(Q) $(MAKE) -C Documentation clean
$(Q) $(RM) ./include/config.h
$(Q) $(RM) ./$(PROGRAM)
$(Q) $(MAKE) -C lib clean
rebuild: clean-built
$(E) " FORCE-REBUILD"
......
.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
$(Q) $(CC) $(CFLAGS) -shared -o $@ criu.o
.SECONDARY:
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:
$(Q) $(RM) -f *.o
$(Q) $(RM) -f *.so
$(obj)/built-in.o: $(obj)/util-fd.o
$(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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment