generated from NathanielJS1541/AoC_Template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjustfile
45 lines (35 loc) · 1.3 KB
/
justfile
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
# Use with https://github.com/casey/just
# Use uname -m to get the architecture of the system.
architecture := `uname -m`
# Select an assembler, linker, and debugger.
#
# Detect whether the current architecture is aarch64 or not. If it is, then the
# native as and ld can be used. Otherwise, use binutils-aarch64-linux-gnu to
# generate the binary for aarch64 architecture.
as := if architecture == "aarch64" { "as" } else { "aarch64-linux-gnu-as" }
ld := if architecture == "aarch64" { "ld" } else { "aarch64-linux-gnu-ld" }
gdb := if architecture == "aarch64" { "gdb" } else { "gdb-multiarch" }
# Define the source and output files.
src := "main.s"
obj := "main.o"
out := "main"
# Default recipe: List available recipes to prevent running unexpectedly.
_default:
just --list
# Assemble the object file without debugging information.
_assemble:
{{ as }} -o {{ obj }} {{ src }}
# Assemble the output file with debugging information.
_assemble_debug:
{{ as }} -g -o {{ obj }} {{ src }}
# Link the executable.
_link:
{{ ld }} -o {{ out }} {{ obj }}
# (Default) build without debugging information.
build: _assemble _link
# Clean up any generated files.
clean:
rm -f {{ out }} {{ obj }}
# Build with debugging information, and launches gdb after building.
debug: _assemble_debug _link
{{ gdb }} --tui {{ out }}