aboutsummaryrefslogtreecommitdiffhomepage
path: root/content/2023-09-01-cas-llsc-aba/Makefile
blob: 602418fa073465cd0f5bdfeceac5169b4f8317d0 (plain) (blame)
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
BINS = cas-aba-issue cas-ptr-generation a64-basic-llsc a64-llsc

CFLAGS_cas-ptr-generation = -mcx16
CFLAGS = -g -O3 -Wall -Wextra $(CFLAGS_$(*))

A64_SYSROOT = /usr/aarch64-linux-gnu

run:   $(BINS:%=run-%)
build: $(BINS:%=%.elf)

# -- HOST NATIVE TARGETS -------------------------------------------------------

run-%: %.elf
	./$^

%.elf : %.cc
	$(CXX) $(CFLAGS) -o $@ $^ -latomic

disasm: cas-ptr-generation.elf
	objdump -C -d -j .text -M intel --no-show-raw-insn --visualize-jumps=color $^ | less -R

# -- ARM64 CROSS TARGETS -------------------------------------------------------

a64-%.elf: a64-%.cc
	clang++ $(CFLAGS) -target aarch64-linux-gnu --sysroot=$(A64_SYSROOT) -fuse-ld=lld -o $@ $^
	#llvm-objdump -j .text -C -d $@

run-a64-%: a64-%.elf
	qemu-aarch64 -L $(A64_SYSROOT) -E LD_LIBRARY_PATH=$(A64_SYSROOT)/lib64 $^

# -- MISC TARGETS --------------------------------------------------------------

fmt:
	clang-format -i *.cc

clean:
	$(RM) *.elf