summaryrefslogtreecommitdiff
path: root/libc/stdlib/malloc/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'libc/stdlib/malloc/Makefile')
-rw-r--r--libc/stdlib/malloc/Makefile14
1 files changed, 12 insertions, 2 deletions
diff --git a/libc/stdlib/malloc/Makefile b/libc/stdlib/malloc/Makefile
index 97527621b..d722d1dc3 100644
--- a/libc/stdlib/malloc/Makefile
+++ b/libc/stdlib/malloc/Makefile
@@ -27,6 +27,16 @@ include $(TOPDIR)Rules.mak
# calloc.c can be found at uClibc/libc/stdlib/calloc.c
CSRC = malloc.c free.c realloc.c memalign.c \
heap_alloc.c heap_alloc_at.c heap_free.c
+
+# Turn on malloc debugging if requested
+ifeq ($(UCLIBC_MALLOC_DEBUGGING),y)
+CSRC += malloc_debug.c heap_debug.c
+CFLAGS += -DMALLOC_DEBUGGING -DHEAP_DEBUGGING
+ifeq ($(UCLIBC_UCLINUX_BROKEN_MUNMAP),y)
+CFLAGS += -DMALLOC_MMB_DEBUGGING
+endif
+endif
+
COBJS=$(patsubst %.c,%.o, $(CSRC))
OBJS=$(COBJS)
@@ -37,10 +47,10 @@ $(LIBC): ar-target
ar-target: $(OBJS)
$(AR) $(ARFLAGS) $(LIBC) $(OBJS)
-$(COBJS): %.o : %.c
+# Depend on uClinux_config.h to cache changes in __UCLIBC_MALLOC_DEBUGGING__
+$(COBJS): %.o : %.c ../../../include/bits/uClibc_config.h
$(CC) $(CFLAGS) -c $< -o $@
$(STRIPTOOL) -x -R .note -R .comment $*.o
clean:
rm -f *.[oa] *~ core
-