From 4f69e91b44b4ae80b90aa25ce1114ed338923fd4 Mon Sep 17 00:00:00 2001 From: johannst Date: Sun, 4 Oct 2020 10:49:20 +0200 Subject: add dependecy generation --- lib/Makefile | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'lib/Makefile') 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) -- cgit v1.2.3