[CRIU] [PATCH 08/12] make: Add scripts/Make.build helper

Pavel Emelyanov xemul at parallels.com
Tue Feb 5 18:53:05 EST 2013


On 02/05/2013 01:34 PM, Cyrill Gorcunov wrote:
> 
> This script contains of vatious helpers which allow us
> to write makefiles in simplified way. It will generate
> all rules we need.
> 
> There are a few variables the script operates with. Better
> to explain them with example. Lets consider the following
> tree
> 
> $(buildroot)
> 	arch/
> 		x86/
> 			parasite.c
> 	scripts/
> 	pie/
> 		Makefile
> 		parasite.c
> 
>  - "obj-y": the object file which is always compiled in the
>    directory the Makefile (where obj-y is used) lays on, this
>    is the case for pie/parasite.c. When compiling the builder
>    will add pie/ prefix to obj-y files.
> 
>  - "obj-e": the object file which is always compiled but lays
>    on some different directory. For example above it's a case
>    for arch/x86/parasite.c. No additional prefixes will be added
>    by script.

I don't understand the difference between -y and -e

>  - "asm-y", "asm-e": same as obj, but for .S files
>  - "lib-e": external library file we need to link with when
>    produce builtin targets.
> 
> Also, if there are several targets which need to be built in
> some directory, the builder supports that named "targeted" rules.
> 
> Typical use
> 
> 	targets += parasite
> 	targets += restorer
> 
> 	obj-y += log-simple.o
> 	obj-y += util-net.o
> 
> 	parasite-obj-y	+= parasite.o
> 	parasite-asm-e	+= $(ARCH_DIR)/parasite-head.o
> 	lib-e		+= $(SYSCALL-LIB)
> 
> 	restorer-obj-y	+= restorer.o
> 	restorer-obj-e	+= $(ARCH_DIR)/restorer.o
> 
> here two targets need to be built -- parasite and restorer,
> both share obj-y, lib-e files but have some differences in other
> aspects so we describe per-target additional object files.
> 
> When building the script will link two targets -- parasite.built-in.o
> and restorer.built-in.o.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  scripts/Makefile.build | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 79 insertions(+)
>  create mode 100644 scripts/Makefile.build
> 




More information about the CRIU mailing list