lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | # Makefile for uClibc |
| 2 | # |
| 3 | # Copyright (C) 2002-2003 NEC Electronics Corporation |
| 4 | # Copyright (C) 2002-2003 Miles Bader <miles@gnu.org> |
| 5 | # Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org> |
| 6 | # |
| 7 | # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. |
| 8 | # |
| 9 | |
| 10 | subdirs += libc/stdlib/malloc |
| 11 | |
| 12 | CSRC := malloc.c calloc.c free.c realloc.c memalign.c \ |
| 13 | heap_alloc.c heap_alloc_at.c heap_free.c |
| 14 | |
| 15 | # Turn on malloc debugging if requested |
| 16 | ifeq ($(UCLIBC_MALLOC_DEBUGGING),y) |
| 17 | CSRC += malloc_debug.c heap_debug.c |
| 18 | CFLAGS += -DMALLOC_DEBUGGING -DHEAP_DEBUGGING |
| 19 | ifeq ($(UCLIBC_UCLINUX_BROKEN_MUNMAP),y) |
| 20 | CFLAGS += -DMALLOC_MMB_DEBUGGING |
| 21 | endif |
| 22 | endif |
| 23 | |
| 24 | STDLIB_MALLOC_DIR := $(top_srcdir)libc/stdlib/malloc |
| 25 | STDLIB_MALLOC_OUT := $(top_builddir)libc/stdlib/malloc |
| 26 | |
| 27 | STDLIB_MALLOC_SRC := $(patsubst %.c,$(STDLIB_MALLOC_DIR)/%.c,$(CSRC)) |
| 28 | STDLIB_MALLOC_OBJ := $(patsubst %.c,$(STDLIB_MALLOC_OUT)/%.o,$(CSRC)) |
| 29 | |
| 30 | libc-$(MALLOC) += $(STDLIB_MALLOC_OBJ) |
| 31 | |
| 32 | objclean-y += CLEAN_libc/stdlib/malloc |
| 33 | |
| 34 | CLEAN_libc/stdlib/malloc: |
| 35 | $(do_rm) $(addprefix $(STDLIB_MALLOC_OUT)/*., o os) |
| 36 | |
| 37 | malloc.o free.o realloc.o memalign.o: malloc.h |
| 38 | # Depend on uClinux_config.h to cache changes in __UCLIBC_MALLOC_DEBUGGING__ |
| 39 | $(STDLIB_MALLOC_OBJ): $(STDLIB_MALLOC_DIR)/heap.h $(top_builddir)include/bits/uClibc_config.h |