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

Cyrill Gorcunov gorcunov at openvz.org
Wed Feb 6 02:07:50 EST 2013


On Wed, Feb 06, 2013 at 03:53:05AM +0400, Pavel Emelyanov wrote:
> 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

That's because of cross directory references. -y stands for
inplace object files, while -e for external ones.

Say we have

	pie/
		a.c
	arch/x86
		b.c

but pie code uses b.c. Internally our Makefile.build script prefix
all obj-y object with pie/ directory and generates rules as

pie/%.o: pie/%.c
	gcc -c ...

but this won't work when source lays in other directory, thus we
tell build farm -- don't mangle objects which belong to obj-e
with pie/ prefix but use this object directly.

iow, for obj-e object only suffix is used for rules generation,
and it imples that obj-e object do have prefix assigned in makefile
itself.

ie, for example above we would need to write

	obj-y += a.o
	obj-e += arch/x86/b.o

and buld farm will generate rules

pie/%.o: pie/%.c
	...

arch/x86/%.o: arch/x86/%.c
	...

on the fly.

Finally both pie/a.o and arch/x86/b.o get linked into pie/built-in.o.

	Cyrill


More information about the CRIU mailing list