aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorjohannst <johannes.stoelp@gmail.com>2020-10-04 10:49:20 +0200
committerjohannst <johannes.stoelp@gmail.com>2020-10-04 10:49:20 +0200
commit4f69e91b44b4ae80b90aa25ce1114ed338923fd4 (patch)
tree6d1c51ce9c9970b531761cc3277cd1e371d4b63a /lib
parent27f66dfd4f0de8623656f38bebcccd91cdc4f182 (diff)
downloadmatcha-threads-4f69e91b44b4ae80b90aa25ce1114ed338923fd4.tar.gz
matcha-threads-4f69e91b44b4ae80b90aa25ce1114ed338923fd4.zip
add dependecy generation
Diffstat (limited to 'lib')
-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)