[CRIU] [PATCH 3/4] make: Use generic build engine for libcriu.so
Pavel Emelyanov
xemul at parallels.com
Thu Aug 29 05:11:13 EDT 2013
On 08/28/2013 11:57 PM, Cyrill Gorcunov wrote:
>
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
> Makefile | 12 +++++++-----
> lib/Makefile | 34 +++++++++++++++++++++++++---------
> 2 files changed, 32 insertions(+), 14 deletions(-)
>
> @@ -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
> - $(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 $@
How about syscalls? Which rule makes them get linked into .so?
> -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
More information about the CRIU
mailing list