master rules.ninja
  1rule gen
  2  command = lua $basedir/setup.lua
  3  generator = 1
  4
  5# toolchain
  6rule cc
  7  command = $cc -MD -MF $out.d $cflags -c -o $out $in
  8  depfile = $out.d
  9  deps = gcc
 10  description = 	CC	$out
 11
 12rule cpp
 13  command = $cc -MD -MF $out.d $cflags -E -P -o $out $in
 14  depfile = $out.d
 15  deps = gcc
 16  description = 	CPP	$out
 17
 18rule as
 19  command = $as $asflags -o $out $in
 20  description = 	AS	$out
 21
 22rule link
 23  command = $cc $ldflags -o $out $in $ldlibs
 24  description = 	LINK	$out
 25
 26rule ar
 27  command = rm -f $out && $ar crs $out $in
 28  description = 	AR	$out
 29
 30rule ld
 31  command = $ld -o $out $in
 32  description = 	LD	$out
 33
 34rule objcopy
 35  command = $objcopy $objcopyflags $in $out
 36
 37rule rsp
 38  command = ln -f $rspfile $out
 39  description = 	RSP	$out
 40  rspfile = $out.tmp
 41  rspfile_content = $in_newline
 42
 43# TODO: Enable dependency-tracking for nasm when
 44# https://bugzilla.nasm.us/show_bug.cgi?id=3392280#c6 is fixed.
 45rule nasm
 46  command = nasm $nasmflags -o $out $in
 47
 48rule mc
 49  command = $mc $mcflags -o $out $in
 50
 51rule muse
 52  command = muse $museflags -o $out $in
 53
 54rule probe
 55  command = sh $basedir/scripts/probe.sh $var $out $cc $cflags $ldflags -o /dev/null -x c $in
 56
 57rule probe-size
 58  command = sh $basedir/scripts/probe-size.sh $var $out $cc $cflags -c -o /dev/null -x c $in
 59
 60# misc tools
 61rule touch
 62  command = touch $out
 63
 64rule empty
 65  command = >$out
 66  description = 	EMPTY	$out
 67
 68rule copy
 69  command = ln -f $in $out
 70  description = 	COPY	$out
 71
 72rule cat
 73  command = cat $in >$out
 74
 75rule gzip
 76  command = gzip -c -9 -n <$in >$out
 77  description = 	GZIP	$out
 78
 79rule yacc
 80  command = yacc $yaccflags $in
 81  description = 	YACC	$out
 82
 83rule sed
 84  command = sed $expr $in >$out
 85  description = 	SED	$out
 86
 87rule awk
 88  command = awk $expr $in >$out
 89  description = 	AWK	$out
 90
 91rule grep
 92  command = grep $expr $in >$out
 93
 94rule printf
 95  command = printf $args >$out
 96
 97rule tic
 98  command = tic $ticflags $in
 99
100rule wayland-proto
101  command = wayland-scanner $type <$in >$out
102
103rule git-hash
104  command = sh $basedir/scripts/hash.sh $repo $args $in >$out
105  description = 	HASH	$args
106
107rule git-tree
108  command = sh $basedir/scripts/tree.sh $repo $repo_tag $in $out
109  description = 	TREE	$out
110  restat = 1
111
112rule git-commit
113  command = sh $basedir/scripts/commit.sh $repo $repo_branch $repo_tag $out
114
115rule git-init
116  command = git init $repo_flags $repo && touch $out
117
118rule fspec-hash
119  command = $builddir/pkg/fspec-sync/host/fspec-hash <$in >$out
120
121rule fspec-sort
122  command = $builddir/pkg/fspec-sync/host/fspec-sort -p <$in >$out
123
124rule fspec-tar
125  command = $builddir/pkg/fspec-sync/host/fspec-tar <$in | zstd >$out
126
127rule fetch
128  command = PAX=$$PWD/$builddir/pkg/pax/host/pax sh $script $gendir && touch $out
129  description = 	FETCH	$gendir
130  restat = 1
131  generator = 1
132  pool = console