[PATCH] libtracefs: avoid pointless extra DEP stage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Call the compiler only once per source file.
Reduces build time from 0.85 to 0.75 seconds for me.

Signed-off-by: Jan Engelhardt <jengelh@xxxxxxx>
---
 scripts/utils.mk |  4 ++--
 src/Makefile     | 14 ++------------
 2 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/scripts/utils.mk b/scripts/utils.mk
index 5f43de1..b8a32a3 100644
--- a/scripts/utils.mk
+++ b/scripts/utils.mk
@@ -53,12 +53,12 @@ endif
 
 do_fpic_compile =					\
 	($(print_fpic_compile)				\
-	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(EXT) -fPIC $< -o $@)
+	$(CC) -MMD -MP -c $(CPPFLAGS) $(CFLAGS) $(EXT) -fPIC $< -o $@)
 
 do_compile =							\
 	($(if $(GENERATE_PIC), $(do_fpic_compile),		\
 	 $(print_compile)					\
-	 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(EXT) $< -o $@))
+	 $(CC) -MMD -MP -c $(CPPFLAGS) $(CFLAGS) $(EXT) $< -o $@))
 
 do_app_build =						\
 	($(print_app_build)				\
diff --git a/src/Makefile b/src/Makefile
index 645d518..3cd4263 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -48,24 +48,14 @@ sqlhist-lex.c: sqlhist.l sqlhist.tab.c
 $(bdir)/%.o: %.c
 	$(Q)$(call do_fpic_compile)
 
-$(DEPS): $(bdir)/.%.d: %.c
-	$(Q)$(CC) -M -MT $(bdir)/$*.o $(CPPFLAGS) $(CFLAGS) $< > $@
-
-$(OBJS): $(bdir)/%.o : $(bdir)/.%.d
-
 tracefs-sqlhist.o: sqlhist.tab.h
 
 $(OBJS): | $(bdir)
-$(DEPS): | $(bdir)
 
 clean:
-	$(Q)$(call do_clean,$(OBJS) .*.d)
+	$(Q)$(call do_clean,$(OBJS) *.d)
 
-dep_includes := $(wildcard $(DEPS))
-
-ifneq ($(dep_includes),)
-  include $(dep_includes)
-endif
+-include *.d
 
 $(bdir)/tracefs-sqlhist.o tracefs-sqlhist.o: sqlhist.tab.h
 
-- 
2.36.1




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux