Version 13 (modified by bird, 11 years ago) (diff)


kmk is the make program in kBuild, i.e. what you invoke from the commandline or editor to perform the actual build. kmk is based on the GNU make CVS (2007-05-23), but provides a bunch of additional features required by the kBuild makefile scripts.

Why not use vanilla GNU make? There are several reasons:

  • When kBuild was reborn using GNU make (an earlier incarnation of the project was based on FreeBSD make) the 3.81 release was about 2 years ahead. kBuild relies on many features introduced after 3.80. Requiring 3.81 to be installed wasn't a viable option.
  • Be able to add new features without having trouble getting them accepted or having to wait 3-4 years until the next GNU make version is released and makes it out to all the corners of the world.
  • Be able to fix bugs fast, same reasoning as above.
  • Not having to require a specific, perhaps even unreleased, GNU make version.
  • Not having to deal with missing features and bugs specific to various GNU make versions and ports.
  • Finally, because we can. :-)

The current kmk code contains the following changes from GNU make:

  • Explicit multi-target rules, i.e. explicit make rules that output more than one file.
  • Prepend assignment operator, <=.
  • The special .NOTPARALLEL goal has been extended to be able to take a list of goals that must be executed without any parallel building going on. If no list is given, it will work like in vanilla GNU make which means the entire makefile will be executed without any parallel building. This extension is required to make the -jN argument useful in kBuild.
  • It has some extra predefined variables, see kmk Quick Reference for details.
  • It has a few new builtin functions, see kmk Quick Reference for details.
  • A bunch of builtin utilities which will be invoked without spawning new process or shell. Most of these are taken from BSD.
    • kmk_builtin_append
    • kmk_builtin_cp
    • kmk_builtin_cat
    • kmk_builtin_echo
    • kmk_builtin_install
    • kmk_builtin_ln
    • kmk_builtin_mkdir
    • kmk_builtin_mv
    • kmk_builtin_rm (clean just wouldn't work without this)
    • kmk_builtin_rmdir
    • kmk_builtin_printf
  • It contains bugfixes for several bugs in the Windows and OS/2 ports, most importantly path case mixups, broken shell invocation, and abspath.
  • It has several performance improvements with respect to the kind of work kBuild puts make thru. Most notably, keeping name and value lengths for variables and thereby skipping a lot of strlen() and being able to use memcpy() instead of strcpy(), and the variable append/prepend optimization (+= and <=). The latter was a major issue with the way kBuild is scripted.
  • A new argument --priority <1..5> which sets the priority of the kmk process. 1 is idle time, 3 is normal, and 5 is highest priority.