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

Cyrill Gorcunov gorcunov at openvz.org
Tue Feb 5 04:34:35 EST 2013


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.

 - "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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0008-make-Add-scripts-Make.build-helper.patch
Type: text/x-patch
Size: 1952 bytes
Desc: not available
URL: <http://lists.openvz.org/pipermail/criu/attachments/20130205/f9c4faef/attachment-0001.bin>


More information about the CRIU mailing list