aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
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