aboutsummaryrefslogtreecommitdiff
path: root/lib/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Makefile')
-rw-r--r--lib/Makefile22
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/Makefile b/lib/Makefile
index c880346..24fe7bd 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -10,21 +10,25 @@ AS := $(PREFIX)gcc
ASFLAGS := -g -O0
CXX := $(PREFIX)g++
CXXFLAGS := -g -O0 -Wall -Wextra -I.
+DEPS_GEN := -MMD
AR := $(PREFIX)ar
-libmatcha.a: thread.o executor.o \
- thread.h executor.h \
- arch/$(ARCH)/thread_create.o arch/$(ARCH)/yield.o \
- arch/$(ARCH)/init_stack.o \
- arch/$(ARCH)/api.h
- $(AR) rcs $@ $(filter %.o,$^)
+OBJS := thread.o executor.o
+OBJS += arch/$(ARCH)/thread_create.o arch/$(ARCH)/yield.o arch/$(ARCH)/init_stack.o
+
+DEPS := $(OBJS:%.o=%.d)
+
+libmatcha.a: $(OBJS)
+ $(AR) rcs $@ $^
%.o: %.cc
- $(CXX) -c -o $@ $^ $(CXXFLAGS)
+ $(CXX) -c -o $@ $(CXXFLAGS) $(DEPS_GEN) $<
%.o: %.s
- $(AS) -c -o $@ $^ $(ASFLAGS)
+ $(AS) -c -o $@ $(ASFLAGS) $<
clean:
- find . -name '*.o' -exec rm -f {} \;
+ rm -f $(OBJS) $(DEPS)
rm -f libmatcha.a
+
+-include $(DEPS)