aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjohannst <johannes.stoelp@gmail.com>2020-09-26 22:21:40 +0200
committerjohannst <johannes.stoelp@gmail.com>2020-09-26 22:21:40 +0200
commit9ff82723e360761e94917c6d15d070dd3534ea2a (patch)
treead907e9fc1448cb769be0613565f99000a13daef
parent33f286000db35fe50639c237caa736deea304585 (diff)
downloadmatcha-threads-9ff82723e360761e94917c6d15d070dd3534ea2a.tar.gz
matcha-threads-9ff82723e360761e94917c6d15d070dd3534ea2a.zip
split makefiles
-rw-r--r--Makefile11
-rw-r--r--lib/Makefile24
2 files changed, 26 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 3f89456..05a908f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,21 +1,14 @@
# Copyright (c) 2020 Johannes Stoelp
-AS := gcc
-ASFLAGS := -g -O0
CXX := g++
CXXFLAGS := -g -O0 -Wall -Wextra -I.
-AR := ar
-lib/libmatcha.a: lib/compile_guard.o lib/thread.o lib/executor.o lib/arch/x86_64/thread_create.o lib/arch/x86_64/yield.o \
- lib/thread.h lib/executor.h lib/arch/x86_64/asm.h
- $(AR) rcs $@ $(filter %.o,$^)
+lib/libmatcha.a:
+ make -C lib
%.o: %.cc
$(CXX) -c -o $@ $^ $(CXXFLAGS)
-%.o: %.s
- $(AS) -c -o $@ $^ $(ASFLAGS)
-
fmt:
fd --type f '.+.h$$|.+.cc$$' --exec clang-format -i {}
diff --git a/lib/Makefile b/lib/Makefile
new file mode 100644
index 0000000..5fbbf0b
--- /dev/null
+++ b/lib/Makefile
@@ -0,0 +1,24 @@
+# Copyright (c) 2020 Johannes Stoelp
+
+AS := gcc
+ASFLAGS := -g -O0
+CXX := g++
+CXXFLAGS := -g -O0 -Wall -Wextra -I.
+AR := ar
+
+ARCH := x86_64
+
+libmatcha.a: compile_guard.o thread.o executor.o \
+ thread.h executor.h \
+ arch/$(ARCH)/thread_create.o arch/$(ARCH)/yield.o \
+ arch/$(ARCH)/asm.h
+ $(AR) rcs $@ $(filter %.o,$^)
+
+%.o: %.cc
+ $(CXX) -c -o $@ $^ $(CXXFLAGS)
+
+%.o: %.s
+ $(AS) -c -o $@ $^ $(ASFLAGS)
+
+clean:
+ rm -f *.o **/*.o libmatcha.a