aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorjohannst <johannes.stoelp@gmail.com>2020-09-29 04:31:51 +0200
committerjohannst <johannes.stoelp@gmail.com>2020-09-29 04:31:51 +0200
commit533a9e57de8cb74594499f625810ad812359d3fb (patch)
tree8e8eed62ab86416170b4c9716b36bae736d6b3a8 /Makefile
parent48142327c37f716da307bd4a9b22576ad0a67c22 (diff)
downloadmatcha-threads-533a9e57de8cb74594499f625810ad812359d3fb.tar.gz
matcha-threads-533a9e57de8cb74594499f625810ad812359d3fb.zip
added basic arm64 support
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile33
1 files changed, 28 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index b3665cc..47c7c90 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,16 @@
# Copyright (c) 2020 Johannes Stoelp
-CXX := g++
+ARCH ?= x86_64
+
+ifeq ($(ARCH),arm64)
+PREFIX := aarch64-linux-gnu-
+endif
+
+CXX := $(PREFIX)g++
CXXFLAGS := -g -O0 -Wall -Wextra -I.
lib/libmatcha.a:
- make -C lib
+ make -C lib ARCH=$(ARCH)
%.o: %.cc
$(CXX) -c -o $@ $^ $(CXXFLAGS)
@@ -13,12 +19,29 @@ fmt:
fd --type f '.+\.h$$|.+\.cc$$' --exec clang-format -i {}
example/demo1: example/demo1.o lib/libmatcha.a
- $(CXX) -o $@ $^
+ $(CXX) -o $@ $^ $(LDFLAGS)
+ifeq ($(ARCH),arm64)
+ qemu-aarch64 \
+ -L /usr/aarch64-linux-gnu \
+ -E LD_LIBRARY_PATH=/usr/aarch64-linux-gnu/lib \
+ example/demo1
+else
+ example/demo1
+endif
gdb: example/demo1
+ifeq ($(ARCH),arm64)
+ qemu-aarch64 \
+ -L /usr/aarch64-linux-gnu \
+ -E LD_LIBRARY_PATH=/usr/aarch64-linux-gnu/lib \
+ -g 1234 \
+ example/demo1 &
+ gdb-multiarch -ex 'target remote :1234' -ex 'b main' -ex 'c' example/demo1
+else
which cgdb && cgdb -x util.gdb -ex 'start' example/demo1 \
|| gdb -x util.gdb -ex 'start' example/demo1
+endif
clean:
- rm -f example/demo1
- rm -f **/*.o **/lib*.a
+ make -C lib clean
+ rm -f example/demo1 example/demo1.o