generated from default-writer/c-clang-ninja-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.linux.noprofiling.ninja
More file actions
79 lines (67 loc) · 2.83 KB
/
build.linux.noprofiling.ninja
File metadata and controls
79 lines (67 loc) · 2.83 KB
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
# Ninja build file generated from Makefile.linux
# Variables
cc = clang
cflags = -Wall -Wextra -std=c11 -O3
ldflags = -fuse-ld=lld
# split coverage options for per-edge use (avoid the -o in compile/link flags)
coverage_cflags =
coverage_ldflags = -fuse-ld=lld
# Rule for compiling .c files to .o
rule cc
command = $cc $cflags -c -o $out $in
description = Compiling $in
# Rule for generating assembly (.s) from .c sources (no shell)
rule asm
command = $cc $cflags -S -o $out $in
description = Generating assembly $out
# Rule for linking .o files (no shell)
rule link
command = $cc $ldflags -o $out $in
description = Linking $out
# Rule for assembling with nasm
rule nasm
command = nasm -f elf64 -o $out $in
description = Assembling $in
# Build statements for object files
build code_coverage_examples_doubly_linked_list.o: cc examples/doubly_linked_list.c
cflags = $cflags $coverage_cflags
build examples_doubly_linked_list.o: cc examples/doubly_linked_list.c
build examples_embedded_structs.o: cc examples/embedded_structs.c
build examples_assembler.o: cc examples/assembler.c
build examples_assembler_asm.o: nasm examples/assembler.asm
build examples_main.o: cc examples/main.c
build examples_thread.o: cc examples/thread.c
build test.o: cc tests/test.c
build alloc.o: cc src/reference/alloc.c
build thread.o: cc src/thread/thread.c
build bump.o: cc src/bump/alloc.c
build bucket.o: cc src/bucket/alloc.c
# Build statements for assembly output (.s) (optional)
build examples_doubly_linked_list.s: asm examples/doubly_linked_list.c
build examples_embedded_structs.s: asm examples/embedded_structs.c
build examples_main.s: asm examples/main.c
build examples_thread.s: asm examples/thread.c
build test.s: asm tests/test.c
build alloc.s: asm src/reference/alloc.c
build thread.s: asm src/thread/thread.c
build bump.s: asm src/bump/alloc.c
build bucket.s: asm src/bucket/alloc.c
# Build statements for the executable (link from .o files)
build code_coverage_examples_doubly_linked_list: link code_coverage_examples_doubly_linked_list.o
ldflags = $ldflags $coverage_ldflags
build examples_doubly_linked_list: link examples_doubly_linked_list.o
build examples_embedded_structs: link examples_embedded_structs.o
build examples_assembler: link examples_assembler.o examples_assembler_asm.o
build examples_main: link examples_main.o alloc.o
build examples_thread: link examples_thread.o thread.o alloc.o
build test_alloc: link test.o alloc.o
build test_bump_alloc: link test.o bump.o
build test_bucket_alloc: link test.o bucket.o
# Clean rule
rule clean
command = rm -f *.s *.o code_coverage_* examples_* test_* default.profdata *.profraw
description = Clean data
generator = 1
build clean: clean
# Default target
default examples_main examples_assembler examples_thread examples_embedded_structs examples_doubly_linked_list test_alloc test_bump_alloc test_bucket_alloc