Use "hardcoded" dependencies when compiler doesn't support -MM

This commit is contained in:
Mike Hommey 2012-05-02 21:30:51 +02:00 committed by Jason Evans
parent 3597e91482
commit 79c4bca7d1
2 changed files with 17 additions and 0 deletions

View File

@ -54,6 +54,7 @@ PIC_CFLAGS = @PIC_CFLAGS@
CTARGET = @CTARGET@ CTARGET = @CTARGET@
LDTARGET = @LDTARGET@ LDTARGET = @LDTARGET@
MKLIB = @MKLIB@ MKLIB = @MKLIB@
CC_MM = @CC_MM@
ifeq (macho, $(ABI)) ifeq (macho, $(ABI))
TEST_LIBRARY_PATH := DYLD_FALLBACK_LIBRARY_PATH="$(objroot)lib" TEST_LIBRARY_PATH := DYLD_FALLBACK_LIBRARY_PATH="$(objroot)lib"
@ -136,9 +137,11 @@ build_doc: $(DOCS)
# #
# Include generated dependency files. # Include generated dependency files.
# #
ifdef CC_MM
-include $(COBJS:%.$(O)=%.d) -include $(COBJS:%.$(O)=%.d)
-include $(CPICOBJS:%.$(O)=%.d) -include $(CPICOBJS:%.$(O)=%.d)
-include $(CTESTOBJS:%.$(O)=%.d) -include $(CTESTOBJS:%.$(O)=%.d)
endif
$(COBJS): $(objroot)src/%.$(O): $(srcroot)src/%.c $(COBJS): $(objroot)src/%.$(O): $(srcroot)src/%.c
$(CPICOBJS): $(objroot)src/%.pic.$(O): $(srcroot)src/%.c $(CPICOBJS): $(objroot)src/%.pic.$(O): $(srcroot)src/%.c
@ -149,10 +152,21 @@ ifneq ($(IMPORTLIB),$(SO))
$(COBJS): CPPFLAGS += -DDLLEXPORT $(COBJS): CPPFLAGS += -DDLLEXPORT
endif 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): $(COBJS) $(CPICOBJS) $(CTESTOBJS): %.$(O):
@mkdir -p $(@D) @mkdir -p $(@D)
$(CC) $(CFLAGS) -c $(CPPFLAGS) $(CTARGET) $< $(CC) $(CFLAGS) -c $(CPPFLAGS) $(CTARGET) $<
ifdef CC_MM
@$(CC) -MM $(CPPFLAGS) -MT $@ -o $(@:%.$(O)=%.d) $< @$(CC) -MM $(CPPFLAGS) -MT $@ -o $(@:%.$(O)=%.d) $<
endif
ifneq ($(SOREV),$(SO)) ifneq ($(SOREV),$(SO))
%.$(SO) : %.$(SOREV) %.$(SO) : %.$(SOREV)

View File

@ -227,6 +227,7 @@ CTARGET='-o $@'
LDTARGET='-o $@' LDTARGET='-o $@'
EXTRA_LDFLAGS= EXTRA_LDFLAGS=
MKLIB='ar crus $@' MKLIB='ar crus $@'
CC_MM=1
dnl Platform-specific settings. abi and RPATH can probably be determined dnl Platform-specific settings. abi and RPATH can probably be determined
dnl programmatically, but doing so is error-prone, which makes it generally dnl programmatically, but doing so is error-prone, which makes it generally
@ -307,6 +308,7 @@ case "${host}" in
CTARGET='-Fo$@' CTARGET='-Fo$@'
LDTARGET='-Fe$@' LDTARGET='-Fe$@'
MKLIB='lib -nologo -out:$@' MKLIB='lib -nologo -out:$@'
CC_MM=
else else
importlib="${so}" importlib="${so}"
DSO_LDFLAGS="-shared" DSO_LDFLAGS="-shared"
@ -337,6 +339,7 @@ AC_SUBST([PIC_CFLAGS])
AC_SUBST([CTARGET]) AC_SUBST([CTARGET])
AC_SUBST([LDTARGET]) AC_SUBST([LDTARGET])
AC_SUBST([MKLIB]) AC_SUBST([MKLIB])
AC_SUBST([CC_MM])
if test "x$abi" != "xpecoff"; then if test "x$abi" != "xpecoff"; then
dnl Heap profiling uses the log(3) function. dnl Heap profiling uses the log(3) function.