File: basic

package info (click to toggle)
ninja-build 1.13.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,816 kB
  • sloc: cpp: 21,348; python: 2,473; ansic: 790; sh: 118; makefile: 20
file content (32 lines) | stat: -rw-r--r-- 424 bytes parent folder | download | duplicates (5)
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
#!/bin/sh

set -eu

WORKDIR=$(mktemp -d)
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
cd $WORKDIR

cat <<EOF > build.ninja
builddir = build

cc = gcc
cflags = -Wall

rule compile
  command = \$cc \$cflags -c \$in -o \$out

rule link
  command = \$cc \$in -o \$out

build prog.o: compile prog.c
build prog: link prog.o

default prog
EOF
cat <<EOF > prog.c
int main(int argc, char **argv) {
  return 0;
}
EOF
ninja
./prog