[PATCH 1/3] Use "hardcoded" dependencies when compiler doesn't support -MM
Mike Hommey
mh+jemalloc at glandium.org
Wed May 2 12:30:51 PDT 2012
From: Mike Hommey <mh at glandium.org>
---
Makefile.in | 17 ++++++++++++++---
configure.ac | 3 +++
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 94f4869..0c8e76a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -54,6 +54,7 @@ PIC_CFLAGS = @PIC_CFLAGS@
CTARGET = @CTARGET@
LDTARGET = @LDTARGET@
MKLIB = @MKLIB@
+CC_MM = @CC_MM@
ifeq (macho, $(ABI))
TEST_LIBRARY_PATH := DYLD_FALLBACK_LIBRARY_PATH="$(objroot)lib"
@@ -136,9 +137,11 @@ build_doc: $(DOCS)
#
# Include generated dependency files.
#
+ifdef CC_MM
-include $(COBJS:%.$(O)=%.d)
-include $(CPICOBJS:%.$(O)=%.d)
-include $(CTESTOBJS:%.$(O)=%.d)
+endif
$(COBJS): $(objroot)src/%.$(O): $(srcroot)src/%.c
$(CPICOBJS): $(objroot)src/%.pic.$(O): $(srcroot)src/%.c
@@ -149,10 +152,21 @@ ifneq ($(IMPORTLIB),$(SO))
$(COBJS): CPPFLAGS += -DDLLEXPORT
endif
+ifndef CC_MM
+# 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
+endif
+
$(COBJS) $(CPICOBJS) $(CTESTOBJS): %.$(O):
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c $(CPPFLAGS) $(CTARGET) $<
+ifdef CC_MM
@$(CC) -MM $(CPPFLAGS) -MT $@ -o $(@:%.$(O)=%.d) $<
+endif
ifneq ($(SOREV),$(SO))
%.$(SO) : %.$(SOREV)
@@ -263,11 +277,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)
diff --git a/configure.ac b/configure.ac
index eeb2a29..3b32b88 100644
--- a/configure.ac
+++ b/configure.ac
@@ -227,6 +227,7 @@ CTARGET='-o $@'
LDTARGET='-o $@'
EXTRA_LDFLAGS=
MKLIB='ar crus $@'
+CC_MM=1
dnl Platform-specific settings. abi and RPATH can probably be determined
dnl programmatically, but doing so is error-prone, which makes it generally
@@ -307,6 +308,7 @@ case "${host}" in
CTARGET='-Fo$@'
LDTARGET='-Fe$@'
MKLIB='lib -nologo -out:$@'
+ CC_MM=
else
importlib="${so}"
DSO_LDFLAGS="-shared"
@@ -337,6 +339,7 @@ AC_SUBST([PIC_CFLAGS])
AC_SUBST([CTARGET])
AC_SUBST([LDTARGET])
AC_SUBST([MKLIB])
+AC_SUBST([CC_MM])
if test "x$abi" != "xpecoff"; then
dnl Heap profiling uses the log(3) function.
--
1.7.10
More information about the jemalloc-discuss
mailing list