google / kati

An experimental GNU make clone

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can kati be used for conversion of ordinary makefiles?

zyppe opened this issue · comments

commented

If I have the makefile for some project, can I use kati to convert the makefile to ninja file and make by ninja. If it can works, it can make 'make' more fast.
If it can, could you write to tell us how we convert?

Depending on your makefile, it may be possible, yes. The most likely problem that you may run into is that Kati does not support recursive make when combined with the ninja output.

Android uses a bunch of arguments to kati:

  --ninja
  --ninja_dir=out
  --ninja_suffix=-aosp_arm
  --no_ninja_prelude
  --regen
  --ignore_optional_include=out/%.P
  --detect_android_echo
  --color_warnings
  --gen_all_targets
  --use_find_emulator
  --werror_find_emulator
  --no_builtin_rules
  --werror_suffix_rules
  --warn_real_to_phony
  --warn_phony_looks_real
  --werror_real_to_phony
  --werror_phony_looks_real
  --werror_writable
  --top_level_phony
  --kati_stats
  --writable out/
  --werror_implicit_rules
  --werror_overriding_commands

But you can probably start with something simple, depending on the structure of your build (this assumes you write everything into an out/* directory):

ckati --ninja --ninja_dir=out --regen
out/ninja.sh

If your source tree is large, I'd recommend trying --use_find_emulator to see if it works for you, it can be a rather big speedup if you've got expensive find commands that it can get rid of.

--color_warnings is nice, as is --detect_android_echo if your rules begin with an echo command.

Many of the rest are for extra warnings / errors that help bring sanity to large & diverse codebases.

If you do move to Kati, there are a number of extensions to the make language as well -- .KATI_DEPFILE is the most important to use, .KATI_RESTAT can be useful in some cases too, and .KATI_IMPLICIT_OUTPUTS to support multiple outputs of a single command (that requires a custom ninja currently). There are a number of others that can help with large codebase sanity as well (readonly / deprecated / obsolete variables)

I don't see any reference to an input makefile in this command:

ckati --ninja --ninja_dir=out --regen

Does it mean that ckati does not take input arguments, and instead it crawls my project looking for makefiles? Or does the makefile have to be in the current directory and named Makefile or something?