From 5e0b7f1a565ffd90c80da3965b2f706e7d55ce42 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 2 Feb 2019 04:41:59 +0100 Subject: [PATCH] Add basic automatic dependency management to Makefiles. --- AK/.gitignore | 1 + Kernel/.gitignore | 1 + Kernel/Makefile | 8 +++++--- LibC/.gitignore | 1 + LibC/Makefile | 8 +++++--- LibGUI/.gitignore | 1 + LibGUI/Makefile | 8 +++++--- SharedGraphics/.gitignore | 1 + Terminal/.gitignore | 1 + Terminal/Makefile | 8 +++++--- Userland/.gitignore | 1 + Userland/Makefile | 8 +++++--- WindowServer/.gitignore | 1 + 13 files changed, 33 insertions(+), 15 deletions(-) diff --git a/AK/.gitignore b/AK/.gitignore index e9b985837af..ff8bc6b4e43 100644 --- a/AK/.gitignore +++ b/AK/.gitignore @@ -1,2 +1,3 @@ akit-test *.o +*.d diff --git a/Kernel/.gitignore b/Kernel/.gitignore index 8431799f130..69c0ff7371f 100644 --- a/Kernel/.gitignore +++ b/Kernel/.gitignore @@ -1,4 +1,5 @@ *.o +*.d .floppy-image Boot/boot.bin kernel diff --git a/Kernel/Makefile b/Kernel/Makefile index 3c572674b52..5fe43e0b447 100644 --- a/Kernel/Makefile +++ b/Kernel/Makefile @@ -86,7 +86,7 @@ INCLUDE_FLAGS = -I.. -I. DEFINES = -DSERENITY -DKERNEL -DSANITIZE_PTRS -CXXFLAGS = $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(KERNEL_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(SUGGEST_FLAGS) $(INCLUDE_FLAGS) $(DEFINES) +CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(KERNEL_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(SUGGEST_FLAGS) $(INCLUDE_FLAGS) $(DEFINES) CXX = clang LD = ld LDFLAGS = -T linker.ld --strip-debug -melf_i386 --gc-sections --build-id=none -z norelro -z now @@ -111,6 +111,8 @@ $(BOOTLOADER): Boot/boot.asm .cpp.o: @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< -clean: - @echo "CLEAN"; rm -f $(KERNEL) $(OBJS) $(BOOTLOADER) $(IMAGE) +-include $(OBJS:%.o=%.d) + +clean: + @echo "CLEAN"; rm -f $(KERNEL) $(OBJS) $(BOOTLOADER) $(IMAGE) *.d diff --git a/LibC/.gitignore b/LibC/.gitignore index 1f6ba4783d7..196c9f02afa 100644 --- a/LibC/.gitignore +++ b/LibC/.gitignore @@ -1,2 +1,3 @@ *.o +*.d LibC.a diff --git a/LibC/Makefile b/LibC/Makefile index 90dbd15ed5e..7704012171e 100644 --- a/LibC/Makefile +++ b/LibC/Makefile @@ -59,7 +59,7 @@ INCLUDE_FLAGS = -I.. -I. DEFINES = -DSERENITY -DUSERLAND -DSANITIZE_PTRS -CXXFLAGS = $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(LIBC_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES) +CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(LIBC_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES) CXX = clang LD = ld AR = ar @@ -73,6 +73,8 @@ $(LIBRARY): $(OBJS) .cpp.o: @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< -clean: - @echo "CLEAN"; rm -f $(LIBRARY) $(OBJS) +-include $(OBJS:%.o=%.d) + +clean: + @echo "CLEAN"; rm -f $(LIBRARY) $(OBJS) *.d diff --git a/LibGUI/.gitignore b/LibGUI/.gitignore index 0e4334e1179..2786c2d53d2 100644 --- a/LibGUI/.gitignore +++ b/LibGUI/.gitignore @@ -1,2 +1,3 @@ *.o +*.d LibGUI.a diff --git a/LibGUI/Makefile b/LibGUI/Makefile index f38bdc94be4..22d6a0bd760 100644 --- a/LibGUI/Makefile +++ b/LibGUI/Makefile @@ -32,7 +32,7 @@ INCLUDE_FLAGS = -I../LibC -I.. -I. DEFINES = -DSERENITY -DUSERLAND -DSANITIZE_PTRS -DLIBGUI -CXXFLAGS = $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(LIBC_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES) +CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(LIBC_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES) CXX = clang LD = ld AR = ar @@ -46,6 +46,8 @@ $(LIBRARY): $(OBJS) .cpp.o: @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< -clean: - @echo "CLEAN"; rm -f $(LIBRARY) $(OBJS) +-include $(OBJS:%.o=%.d) + +clean: + @echo "CLEAN"; rm -f $(LIBRARY) $(OBJS) *.d diff --git a/SharedGraphics/.gitignore b/SharedGraphics/.gitignore index 5761abcfdf0..6142305dc12 100644 --- a/SharedGraphics/.gitignore +++ b/SharedGraphics/.gitignore @@ -1 +1,2 @@ *.o +*.d diff --git a/Terminal/.gitignore b/Terminal/.gitignore index 1e2b6ab46c3..1029333f8dc 100644 --- a/Terminal/.gitignore +++ b/Terminal/.gitignore @@ -1,2 +1,3 @@ *.o +*.d Terminal diff --git a/Terminal/Makefile b/Terminal/Makefile index 40e66f47fec..8ccc36fc8ea 100644 --- a/Terminal/Makefile +++ b/Terminal/Makefile @@ -14,7 +14,7 @@ INCLUDE_FLAGS = -I.. -I. -I../LibC DEFINES = -DSERENITY -DSANITIZE_PTRS -DUSERLAND -CXXFLAGS = $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(USERLAND_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES) +CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(USERLAND_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES) CXX = clang LD = ld AR = ar @@ -28,6 +28,8 @@ $(APP): $(OBJS) .cpp.o: @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< -clean: - @echo "CLEAN"; rm -f $(APPS) $(OBJS) +-include $(OBJS:%.o=%.d) + +clean: + @echo "CLEAN"; rm -f $(APPS) $(OBJS) *.d diff --git a/Userland/.gitignore b/Userland/.gitignore index 61deb7d2ef9..d6ac23a0486 100644 --- a/Userland/.gitignore +++ b/Userland/.gitignore @@ -1,4 +1,5 @@ *.o +*.d id sh ps diff --git a/Userland/Makefile b/Userland/Makefile index d4b28b9fec0..863f658741f 100644 --- a/Userland/Makefile +++ b/Userland/Makefile @@ -69,7 +69,7 @@ INCLUDE_FLAGS = -I.. -I. -I../LibC DEFINES = -DSERENITY -DSANITIZE_PTRS -DUSERLAND -CXXFLAGS = $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(USERLAND_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES) +CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(USERLAND_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES) CXX = clang LD = ld AR = ar @@ -167,6 +167,8 @@ chmod: chmod.o .cpp.o: @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< -clean: - @echo "CLEAN"; rm -f $(APPS) $(OBJS) +-include $(OBJS:%.o=%.d) + +clean: + @echo "CLEAN"; rm -f $(APPS) $(OBJS) *.d diff --git a/WindowServer/.gitignore b/WindowServer/.gitignore index 5761abcfdf0..6142305dc12 100644 --- a/WindowServer/.gitignore +++ b/WindowServer/.gitignore @@ -1 +1,2 @@ *.o +*.d