wiki:kmk

Version 3 (modified by bird, 17 years ago) (diff)

--

kmk is the make program in kBuild, e.g. it is what you invoke from the commandline or editor to perform the actual build. kmk is based on the latest GNU make release, currently 3.81, 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 still isn'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:

  • It has some extra predefined variables:
    • KMK_VERSION
    • KMK_FEATURES
    • KBUILD_VERSION
    • KBUILD_VERSION_MAJOR
    • KBUILD_VERSION_MINOR
    • KBUILD_VERSION_PATCH
    • PATH_KBUILD - only when installed on *nix.
    • PATH_KBUILD_BIN - only when installed on *nix.
  • It has a few new builtin functions:
    • toupper
    • tolower
    • compvar
    • kb-src-tool (kBuild internal)
    • kb-obj-base (kBuild internal)
    • kb-obj-suff (kBuild internal)
    • kb-src-prop (kBuild internal)
    • kb-src-one (kBuild internal)
  • 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 expansion optimization (+=). The latter was a major issue with the way kBuild is scripted.
  • 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_echo
    • kmk_builtin_install
    • kmk_builtin_ln
    • kmk_builtin_mkdir
    • kmk_builtin_rm (clean just wouldn't work without this)
    • kmk_builtin_rmdir On the todo list is:
    • kmk_builtin_mv
    • ...
  • 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.