[LWN Logo]
[LWN.net]
From: Keith Owens <kaos@ocs.com.au>
To: kbuild-devel@lists.sourceforge.net
Subject: [kbuild-devel] kbuild-2.5 makefile.in syntax
Date: Sun, 01 Apr 2001 06:42:38 -0700

kbuild reads all the Makefile.in files from the source trees plus any
prepend or append files and generates a global makefile.  The global
makefile lets make work out all the dependencies and perform an
accurate kernel build.

Filenames default to relative to the directory that contains the
Makefile.in file.  For source files the filename is replaced with the
full pathname to the top level version of the file, which can be in the
object directory if it was the target of prepend/append.  For object
files the file is replaced by the object directory that corresponds to
the current source directory.  Filenames are effectively chrooted at
the top of the source/object trees, for example objfile(/lib/lib.a) is
valid.

The shorthand commands are :-

expsyms(object_list)
  These objects export symbols.

select(CONFIG_foo object_list)
  If CONFIG_foo is 'y' or 'm' then compile and/or link the object list
  with the relevant flags.  If any of the objects are made up of sub
  objects (see objlink) then the selection type propagates onto these
  sub objects.

always(object_list)
  Always compile the object list and link them into vmlinux.

always_mod(object_list)
  Always compile the object list as a module.

link_subdirs(sub-directory_list)
  The link order for vmlinux is important.  The existing kbuild makes a
  mess of the link order by confusing compilation order with link
  order.  kbuild 2.5 leaves compilation order to make, which does a
  good job when given a global makefile.  The link order of non-module
  objects into vmlinux is defined by the link_subdirs commands.

  Normal tree traversal rules, starting from the top level Makefile.in.
  Each directory is checked for any built in objects and they are
  linked into vmlinux in the order they are specified in Makefile.in,
  via select, always and link_subdirs commands.

extra_aflags(object flag_list)
  When the object is built from assembler source, use the extra flags.

extra_aflags_all(flag_list)
  The flags apply to all assembler compiles in this directory.

extra_cflags(object flag_list)
  When the object is built from C source, use the extra flags.

extra_cflags_all(flag_list)
  The flags apply to all C compiles in this directory.

extra_ldflags(object flag_list)
  When the object is linked from source or sub objects, use the extra
  flags.

objlink(target object_list)
  Add the object list to the cumulative list of sub objects that make
  up the target.  This does not say if the target will be compiled, it
  just defines its components.

objlink_cond(CONFIG_foo target object_list)
  If CONFIG_foo is selected (either 'y' or 'm') then add the object
  list to the cumulative list of sub objects that make up the target.

ifsel(CONFIG_foo)
  True if CONFIG_foo is selected, either 'y' or 'm'.  It needs a
  matching endif.

ifnsel(CONFIG_foo)
  True if CONFIG_foo is not selected, either 'n' or blank.  It needs a
  matching endif.

ifselmod(CONFIG_foo)
  True if CONFIG_foo is selected as a module ('m').  It needs a
  matching endif.

ifselnmod(CONFIG_foo)
  True if CONFIG_foo is selected but not as a module ('y').  It needs a
  matching endif.

assembler(object_list)
  Build these objects from assembler input, not from C.
  Note: This is a hangover from the non-shadow design and will probably
  be removed.

srcfile(filename)
  Replaced with the name of the top level version of the file, which
  can be in the object directory if it was the target of prepend or
  append.

srcfile_opt(filename)
  If the filename exists, do the same as srcfile.  Otherwise replace
  with the filename in the base source tree.

srcfile_base(filename)
  Always replace with the filename in the base source tree, even if the
  file does not exist.  Used with make '%' based rules.

src_includelist(directory_list)
  Expand into '-Idirectory' name for each directory in the list, in
  each source tree, from the top source tree down.

objfile(filename)
  Replaced with the filename in the current object directory.


Unlike the existing kbuild, every kbuild 2.5 Makefile.in is self
contained.  select(), always() and always_mod() only work for objects
in the current directory, one makefile cannot control the compilation
of an object in another directory.  Cross directory linking is allowed.


_______________________________________________
kbuild-devel mailing list
kbuild-devel@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/kbuild-devel