[PATCH 4/7] Use "hardcoded" dependencies instead of having the compiler generate them

Mike Hommey mh+jemalloc at glandium.org
Mon Apr 30 03:38:28 PDT 2012


From: Mike Hommey <mh at glandium.org>

The main reason is that MSVC doesn't have flags to generate these
dependencies. It is possible to generate them with the output from the
showincludes flag, but it also requires to wrap the compiler, and filter
its output on a message that changes depending on the system locale.

Considering all c files include jemalloc_internal.h, and that this file
includes all others headers, it's just simpler to set dependencies in
stone. The generated dependencies were all the same anyways.
---
 Makefile.in |   18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 7685f15..a351a1f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -124,23 +124,22 @@ build_doc_html: $(DOCS_HTML)
 build_doc_man: $(DOCS_MAN3)
 build_doc: $(DOCS)
 
-#
-# Include generated dependency files.
-#
--include $(COBJS:%.$(O)=%.d)
--include $(CPICOBJS:%.$(O)=%.d)
--include $(CTESTOBJS:%.$(O)=%.d)
-
 $(COBJS): $(objroot)src/%.$(O): $(srcroot)src/%.c
 $(CPICOBJS): $(objroot)src/%.pic.$(O): $(srcroot)src/%.c
 $(CPICOBJS): CFLAGS += $(PIC_CFLAGS)
 $(CTESTOBJS): $(objroot)test/%.$(O): $(srcroot)test/%.c
 $(CTESTOBJS): CPPFLAGS += -I$(objroot)test
 
+# Dependencies
+HEADER_DIRS = $(srcroot)include/jemalloc/internal \
+	$(objroot)include/jemalloc $(objroot)include/jemalloc/internal
+HEADERS = $(wildcard $(foreach dir,$(HEADER_DIRS),$(dir)/*.h))
+$(COBJS) $(CPICOBJS) $(CTESTOBJS): $(HEADERS)
+$(CTESTOBJS): $(objroot)test/jemalloc_test.h
+
 $(COBJS) $(CPICOBJS) $(CTESTOBJS): %.$(O):
 	@mkdir -p $(@D)
 	$(CC) $(CFLAGS) -c $(CPPFLAGS) -o $@ $<
-	@$(CC) -MM $(CPPFLAGS) -MT $@ -o $(@:%.$(O)=%.d) $<
 
 ifneq ($(SOREV),$(SO))
 %.$(SO) : %.$(SOREV)
@@ -250,11 +249,8 @@ check: tests
 clean:
 	rm -f $(COBJS)
 	rm -f $(CPICOBJS)
-	rm -f $(COBJS:%.$(O)=%.d)
-	rm -f $(CPICOBJS:%.$(O)=%.d)
 	rm -f $(CTESTOBJS:%.$(O)=%$(EXE))
 	rm -f $(CTESTOBJS)
-	rm -f $(CTESTOBJS:%.$(O)=%.d)
 	rm -f $(CTESTOBJS:%.$(O)=%.out)
 	rm -f $(DSOS) $(STATIC_LIBS)
 
-- 
1.7.10




More information about the jemalloc-discuss mailing list