# Copyright (c) 2013, Linaro Limited # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # * Neither the name of the Linaro nor the # names of its contributors may be used to endorse or promote products # derived from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # Top level Makefile for cortex-malloc # The main library lib_LTLIBRARIES = \ libcortex-malloc.la \ tools/mtrace_logger/libmtrace.la ## Test suite check_PROGRAMS = \ tests/tst-calloc \ tests/tst-malloc \ tests/tst-mallocfork \ tests/tst-mallocstate \ tests/tst-malloc-usable \ tests/tst-memalign \ tests/tst-posix_memalign \ tests/tst-pvalloc \ tests/tst-realloc \ tests/tst-trim1 \ tests/tst-valloc # Options for the tests tests_cflags = -I$(srcdir)/tests $(AM_CFLAGS) -D_GNU_SOURCE tests_ldadd = libcortex-malloc.la tests_tst_calloc_LDADD = $(tests_ldadd) tests_tst_calloc_CFLAGS = $(tests_cflags) tests_tst_malloc_LDADD = $(tests_ldadd) tests_tst_malloc_CFLAGS = $(tests_cflags) tests_tst_mallocfork_LDADD = $(tests_ldadd) tests_tst_mallocfork_CFLAGS = $(tests_cflags) tests_tst_mallocstate_LDADD = $(tests_ldadd) tests_tst_mallocstate_CFLAGS = $(tests_cflags) tests_tst_malloc_usable_LDADD = $(tests_ldadd) tests_tst_malloc_usable_CFLAGS = $(tests_cflags) tests_tst_memalign_LDADD = $(tests_ldadd) tests_tst_memalign_CFLAGS = $(tests_cflags) tests_tst_posix_memalign_LDADD = $(tests_ldadd) tests_tst_posix_memalign_CFLAGS = $(tests_cflags) tests_tst_pvalloc_LDADD = $(tests_ldadd) tests_tst_pvalloc_CFLAGS = $(tests_cflags) tests_tst_realloc_LDADD = $(tests_ldadd) tests_tst_realloc_CFLAGS = $(tests_cflags) tests_tst_trim1_LDADD = $(tests_ldadd) tests_tst_trim1_CFLAGS = $(tests_cflags) tests_tst_valloc_LDADD = $(tests_ldadd) tests_tst_valloc_CFLAGS = $(tests_cflags) TESTS = $(check_PROGRAMS) libmallocbench_a_SOURCES = \ benchmarks/mallocbench.c libglibc_a_SOURCES = \ reference/glibc/malloc.c \ reference/glibc/morecore.c \ reference/glibc/malloc.h libglibc_a_CFLAGS = \ -Wall -std=gnu99 -D_GNU_SOURCE -DPER_THREAD \ -Ireference/glibc/include \ -Ireference/glibc libjemalloc_a_SOURCES = \ reference/jemalloc/arena.c \ reference/jemalloc/atomic.c \ reference/jemalloc/base.c \ reference/jemalloc/bitmap.c \ reference/jemalloc/chunk.c \ reference/jemalloc/chunk_dss.c \ reference/jemalloc/chunk_mmap.c \ reference/jemalloc/ckh.c \ reference/jemalloc/ctl.c \ reference/jemalloc/extent.c \ reference/jemalloc/hash.c \ reference/jemalloc/huge.c \ reference/jemalloc/jemalloc.c \ reference/jemalloc/mb.c \ reference/jemalloc/mutex.c \ reference/jemalloc/prof.c \ reference/jemalloc/quarantine.c \ reference/jemalloc/rtree.c \ reference/jemalloc/stats.c \ reference/jemalloc/tcache.c \ reference/jemalloc/tsd.c \ reference/jemalloc/util.c libjemalloc_a_CFLAGS = \ -std=gnu99 -Wall -O3 -funroll-loops -D_GNU_SOURCE -D_REENTRANT \ -Ireference/jemalloc/include libtcmalloc_a_SOURCES = \ reference/tcmalloc/tcmalloc.cc \ reference/tcmalloc/common.cc \ reference/tcmalloc/internal_logging.cc \ reference/tcmalloc/system-alloc.cc \ reference/tcmalloc/memfs_malloc.cc \ reference/tcmalloc/central_freelist.cc \ reference/tcmalloc/page_heap.cc \ reference/tcmalloc/sampler.cc \ reference/tcmalloc/span.cc \ reference/tcmalloc/stack_trace_table.cc \ reference/tcmalloc/static_vars.cc \ reference/tcmalloc/symbolize.cc \ reference/tcmalloc/thread_cache.cc \ reference/tcmalloc/malloc_hook.cc \ reference/tcmalloc/malloc_extension.cc \ reference/tcmalloc/maybe_threads.cc \ reference/tcmalloc/base/spinlock.cc \ reference/tcmalloc/base/spinlock_internal.cc \ reference/tcmalloc/base/atomicops-internals-x86.cc \ reference/tcmalloc/base/logging.cc \ reference/tcmalloc/base/dynamic_annotations.c \ reference/tcmalloc/base/sysinfo.cc libtcmalloc_a_CXXFLAGS = \ -Ireference/tcmalloc -Ireference/tcmalloc/spinlock \ -Ireference/tcmalloc/logging -Ireference/tcmalloc/sysinfo \ -DNO_TCMALLOC_SAMPLES -DNO_HEAP_CHECK -DNDEBUG \ -DPERFTOOLS_DLL_DECL="" -DSTL_NAMESPACE="std" \ -DPRIuS="\"zu\"" -DPRIxS="\"zx\"" -DPRIdS="\"zd\"" \ -Wall -Wwrite-strings -Woverloaded-virtual \ -Wno-sign-compare \ -fno-exceptions \ -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc \ -fno-builtin-calloc -fno-builtin-cfree \ -fno-builtin-memalign -fno-builtin-posix_memalign \ -fno-builtin-valloc -fno-builtin-pvalloc libtcmalloc_a_CFLAGS = $(libtcmalloc_a_CXXFLAGS) try_none_SOURCES = try_none_LDADD = libmallocbench.a -lrt -lpthread try_this_SOURCES = try_this_LDADD = libmallocbench.a libcortex-malloc.la -lrt -lpthread try_glibc_SOURCES = try_glibc_LDADD = libmallocbench.a libglibc.a -lrt -lpthread try_jemalloc_SOURCES = try_jemalloc_LDADD = libmallocbench.a libjemalloc.a -lrt -lpthread try_tcmalloc_SOURCES = try_tcmalloc_LDADD = libmallocbench.a libtcmalloc.a -lrt -lpthread try_tcmalloc_LINK = $(CXXLINK) if HOST_X86_64 libssmalloc_a_SOURCES = \ reference/ssmalloc/ssmalloc.c libssmalloc_a_CFLAGS = \ -O3 -Wstrict-prototypes -fomit-frame-pointer -g -Wall \ -Ireference/ssmalloc/include-x86_64 try_ssmalloc_SOURCES = try_ssmalloc_LDADD = libmallocbench.a libssmalloc.a -lrt -lpthread x86_64_programs = try-ssmalloc x86_64_libraries = libssmalloc.a endif tools_mtrace_logger_libmtrace_la_SOURCES = \ tools/mtrace_logger/mtrace.c ## Benchmarks noinst_PROGRAMS = \ try-none \ try-this \ try-glibc \ try-jemalloc \ try-tcmalloc \ $(x86_64_programs) # Benchmark harness noinst_LIBRARIES = \ libmallocbench.a \ libglibc.a \ libjemalloc.a \ libtcmalloc.a \ $(x86_64_libraries) # Main library libcortex_malloc_la_SOURCES = \ src/malloc.c libcortex_malloc_la_LDFLAGS = -version-info 1:0:0 -lpthread AM_CFLAGS = \ -std=gnu99 -Wall -Wextra \ -Wall -Wwrite-strings -Wstrict-prototypes \ -fno-stack-protector -U_FORTIFY_SOURCE \ -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc \ -fno-builtin-calloc -fno-builtin-cfree \ -fno-builtin-memalign -fno-builtin-posix_memalign \ -fno-builtin-valloc -fno-builtin-pvalloc $(AM_CPPFLAGS) EXTRA_DIST = \ tests/test-skeleton.c \ autogen.sh