summaryrefslogtreecommitdiff
path: root/rules.ninja
blob: 7f8dae5b02c8e6fec2488822b2a8d161bfd0e23d (plain)
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
rule gen
  command = rc ./setup.rc $dir
  generator = 1

# toolchain
rule cc
  command = $cc -MMD -MF $out.d $cflags -c -o $out $in
  depfile = $out.d
  deps = gcc

rule as
  command = $as $asflags -o $out $in

rule link
  command = $cc $ldflags -o $out $in $ldlibs

rule ar
  command = rm -f $out && $ar crs $out $in

rule objcopy
  command = $objcopy $objcopyflags $in $out

rule lines
  command = ln -f $rspfile $out
  rspfile = $out.tmp
  rspfile_content = $in_newline

rule nasm
  command = nasm $nasmflags -o $out $in

# misc tools
rule touch
  command = touch $out

rule empty
  command = >$out

rule copy
  command = ln -f $in $out

rule cat
  command = cat $in >$out.tmp && mv $out.tmp $out

rule mergeperms
  command = sort -k 2 -m $in >$out.tmp && mv $out.tmp $out

rule gzip
  command = gzip -c -9 -n $in >$out.tmp && mv $out.tmp $out

rule yacc
  command = oldcwd=$$PWD && cd $outdir && $yacc $yaccflags $$oldcwd/$in

rule sed
  command = sed $expr $in >$out.tmp && mv $out.tmp $out

rule awk
  command = awk $expr $in >$out.tmp && mv $out.tmp $out

rule grep
  command = grep $expr $in >$out.tmp && mv $out.tmp $out

rule tic
  command = tic $ticflags $in

rule waylandproto
  command = wayland-scanner $type $in $out.tmp && mv $out.tmp $out

rule githash
  command = rc ./scripts/hash.rc $builddir/$repo.git $args $in >$out.tmp && mv $out.tmp $out

rule gittree
  command = rc ./scripts/tree.rc $builddir/$repo.git $repo_tag $in $out
  restat = 1

rule gitcommit
  command = rc ./scripts/commit.rc $builddir/$repo.git $repo_branch $repo_tag $out

rule gitarchive
  command = git -C $builddir/$repo.git archive -o $$PWD/$out $repo_tag

rule gitinit
  command = mkdir -p $builddir/$repo.git && git -C $builddir/$repo.git init --bare && touch $out

rule fetchcurl
  command = rc ./scripts/fetch-curl.rc $dir $args && touch $out
  restat = 1
  generator = 1
  pool = console

rule fetchgit
  command = rc ./scripts/fetch-git.rc $dir $args && touch $out
  restat = 1
  generator = 1
  pool = console

rule fetchlocal
  command = rc ./$dir/fetch.rc $dir $args && touch $out
  restat = 1
  generator = 1
  pool = console