diff --git a/Makefile.in b/Makefile.in index 94f48699..6675b596 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) diff --git a/configure.ac b/configure.ac index eeb2a290..3b32b884 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.