File: ckati.md

package info (click to toggle)
android-platform-build-kati 10.0.0%2Br32%2Bgit20220314.09dfa26c4e59-7.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,628 kB
  • sloc: cpp: 10,340; sh: 1,087; python: 85; makefile: 46
file content (224 lines) | stat: -rw-r--r-- 5,363 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
---
title: CKATI
section: 1
header: User Commands
footer: ckati
---

## NAME

ckati - experimental GNU make clone

## SYNOPSIS

**ckati** [*OPTION*]... [*TARGET*]...

## DESCRIPTION

*ckati* is a C++ implementation of **kati**, an experimental **make** clone.

The motivation of **kati** was to speed up Android platform build. The Android
platform's build system is built on **GNU make** and allows developers to write
build rules in a descriptive way.

*ckati* is a complete rewrite of **GNU make** from scratch, focused on speeding
up incremental builds.

*ckati* supports two modes of execution. It can directly execute the commands
specified in the *Makefile*, or it can generate a *ninja* file corresponding
to the *Makefile*.

The *ninja* generator mode is the main mode of operation, since the built-in
executor of *ckati* lacks important features for a build system like parallel
builds.

The *ninja* generator mode is not fully compatible with **GNU make** due to
a feature mismatch between **make** and **ninja**. Since **ninja** only allows
one command per a rule, when the *Makefile* has multiple commands, *ckati*
generates a rule with the commands joined with `&&`. When `$(shell ...)`
is used, *ckati* translates it into shell's `$(...)`. This works in many cases,
but doesn't when the result of `$(shell ...)` is passed to another function:

    all:
    	echo $(if $(shell echo),FAIL,PASS)

If `-\-regen` flag is specified, *ckati* checks if anything in your environment
has changed after the previous run. If the *ninja* file doesn't need to be
regenerated, it finishes quickly.

The following is checked when deciding whether the *ninja* file should be
regenerated or not:

* The command line flags passed to *ckati*
* Timestamps of the *Makefiles* used to generate the previous *ninja* file
* Environment variables used while evaluating *Makefiles*
* Results of `$(wildcard ...)`
* Results of `$(shell ...)`

*Ckati* doesn't run `$(shell date ...)` and `$(shell echo ...)` during these
checks.

*Ckati* optimises `$(shell find ...)` calls, since the Android's build system
uses a lot of them to create a list of all .java/.mk files under a directory,
and they are slow. *Ckati* has a built-in emulator of **GNU find**. The find
emulator traverse the directory tree and creates an in-memory directory tree.
When `$(shell find ...)` is used, the find emulator returns results of
**find** commands using the cached tree, giving a performance boost.

## OPTIONS

**-d**

:   Print debugging information.

**-\-warn**

:   Print *ckati* warnings.

**-f** *FILE*

:   Use *FILE* as a *Makefile*.

**-c**

:   Do not run anything, only perform a syntax check.

**-i**

:   Dry run mode: print the commands that would be executed, but do not execute them.

**-s**

:   Silent operation; do not print the commands as they are executed.

**-j** *JOBS*

:   Specifies the number of *JOBS* (commands) to run simultaneously.

**-\-no\_builtin\_rules**

:   Do not provide any built-in rules.

**-\-ninja**

:   Ninja generator mode: do not execute commands directly, but generate a *ninja* file.
:   By default, the ninja file is saved as `build.ninja`, and a shell script to execute
:   **ninja** is saved as `ninja.sh`. An optional suffix can be added to the file names
:   by using **-\-ninja\_suffix** option.

**-\-ninja\_dir**

:   The directory where the *ninja* file will be generated; the default is the current directory.

**-\-ninja\_suffix**

:   The *ninja* file suffix; the default is no suffix.

**-\-use\_find\_emulator**

:   Emulate `find` command calls to improve build performance.

**-\-regen**

:   Regenerate the *ninja* file only when necessary.

**-\-detect\_android\_echo**

:   Detect the use of `$(shell echo ...)` in Android build system.

**-\-detect\_depfiles**

:   Detect dependency files.

The following options can emit warnings or errors if certain *Makefile*
features are used:

**-\-werror\_overriding\_commands**

:   Fail when overriding commands for a previously defined target.

**-\-warn\_implicit\_rules**, **-\-werror\_implicit\_rules**

:   Warn or fail when implicit rules are used.

**-\-warn\_suffix\_rules**, **-\-werror\_suffix\_rules**

:   Warn or fail when suffix rules are used.

**-\-warn\_real\_to\_phony**, **-\-werror\_real\_to\_phony**

:   Warn or fail when a real target depends on a `PHONY` target.

**-\-warn\_phony\_looks\_real**, **-\-werror\_phony\_looks\_real**

:   Warn or fail when a `PHONY` target contains slashes.

**-\-werror\_writable**

:   Fail when writing to a read-only directory.

## SUPPORTED MAKE FUNCTIONS

Text functions:

* `subst`
* `patsubst`
* `strip`
* `findstring`
* `filter`
* `filter-out`
* `sort`
* `word`
* `wordlist`
* `words`
* `firstword`
* `lastword`

File name functions:

* `dir`
* `notdir`
* `suffix`
* `basename`
* `addsuffix`
* `addprefix`
* `join`
* `wildcard`
* `realpath`
* `abspath`

Conditional functions:

* `if`
* `or`
* `and`

Make control functions:

* `info`
* `warning`
* `error`

Miscellaneous:

* `value`
* `eval`
* `shell`
* `call`
* `foreach`
* `origin`
* `flavor`
* `file`

## EXIT STATUS

**ckati** exits with a status of zero if all *Makefiles* were successfully
parsed and no targets that were built failed.

## SEE ALSO

**make**(1), **ninja**(1)

## AUTHOR

This manual page was written by Andrej Shadura for the Debian project.