diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | lib/Makefile | 22 |
2 files changed, 14 insertions, 9 deletions
@@ -1,4 +1,5 @@ *.o +*.d *.a demo1 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) |