aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorjohannst <johannes.stoelp@gmail.com>2020-09-18 01:13:53 +0200
committerjohannst <johannes.stoelp@gmail.com>2020-09-18 01:13:53 +0200
commitec45be0578fb50ad4f3df28275f01d82a6d7b518 (patch)
tree2dada348d0ea71793a6fa76b2232e7c7bce8bc58 /Makefile
parent61ba2dc2a41cd4a2148f5647c142f53e7f9a1cc7 (diff)
downloadmatcha-threads-ec45be0578fb50ad4f3df28275f01d82a6d7b518.tar.gz
matcha-threads-ec45be0578fb50ad4f3df28275f01d82a6d7b518.zip
split matcha header into h/cc file + adapt make rules
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile20
1 files changed, 17 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index e86f7fa..ab48a9d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,29 @@
-CXX := g++
+AS := gcc
+CXX := g++
CXXFLAGS := -g -O0 -Wall -Wextra -I.
+AR := ar
+RANLIB := ranlib
-example/test: example/test.cc lib/thread_create.s lib/matcha.h
- $(CXX) -o $@ $^ $(CXXFLAGS)
+lib/libmatcha.a: lib/matcha.o lib/thread_create.o lib/matcha.h
+ $(AR) rcs $@ $(filter %.o,$^)
+ $(RANLIB) $@
+
+%.o: %.cc
+ $(CXX) -c -o $@ $^ $(CXXFLAGS)
+
+%.o: %.s
+ $(AS) -c -o $@ $^
fmt:
fd --type f '.+.h$$|.+.cc$$' --exec clang-format -i {}
+example/test: example/test.o lib/libmatcha.a
+ $(CXX) -o $@ $^
+
gdb: example/test
which cgdb && cgdb -x util.gdb -ex 'start' example/test \
|| gdb -x util.gdb -ex 'start' example/test
clean:
rm -f example/test
+ rm -f **/*.o **/lib*.a