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.windows.ninja
More file actions
64 lines (53 loc) · 2.12 KB
/
build.windows.ninja
File metadata and controls
64 lines (53 loc) · 2.12 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
# Ninja build file generated from Makefile.windows
# Variables
cc = clang-cl
cflags = /W4 /Zi
ldflags = /DEBUG
# Rule for compiling .c files to .obj
rule cc
command = $cc $cflags /c /Fo$out $in
description = Compiling $in
# Rule for generating assembly (.s) from .c sources
rule asm
command = $cc $cflags -S -o $out $in
description = Generating assembly $out
# Rule for linking .obj files to .exe
rule link
command = lld-link $ldflags /OUT:$out.exe $in
description = Linking $out
# Build statements for object files
build examples_doubly_linked_list.obj: cc examples/doubly_linked_list.c
build examples_embedded_structs.obj: cc examples/embedded_structs.c
build examples_main.obj: cc examples/main.c
build examples_thread.obj: cc examples/thread.c
build test.obj: cc tests/test.c
build alloc.obj: cc src/reference/alloc.c
build thread.obj: cc src/thread/thread.c
build bump.obj: cc src/bump/alloc.c
build bucket.obj: 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 statement for the executable
build examples_doubly_linked_list: link examples_doubly_linked_list.obj
build examples_embedded_structs: link examples_embedded_structs.obj
build examples_main: link examples_main.obj alloc.obj
build examples_thread: link examples_thread.obj thread.obj alloc.obj
build test_alloc: link test.obj alloc.obj
build test_bump_alloc: link test.obj bump.obj
build test_bucket_alloc: link test.obj bucket.obj
# Clean rule
rule clean
command = cmd /c "del *.s *.obj *.pdb *.exe 2>nul || exit 0"
description = Clean
generator = 1
build clean: clean
# Default target
default examples_main examples_thread examples_embedded_structs examples_doubly_linked_list test_alloc test_bump_alloc test_bucket_alloc