diff --git a/Makefile.am b/Makefile.am index af437a6..4c7605a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1 +1,5 @@ -SUBDIRS = src +SUBDIRS = opic + +nobase_include_HEADERS = \ + opic/op_malloc.h \ + opic/demomalloc.h diff --git a/configure.ac b/configure.ac index 7a0db54..5eea126 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_INIT([OPIC],[0.3]) AC_CONFIG_SRCDIR([README.md]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) -AM_CONFIG_HEADER([src/config.h]) +AM_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE([-Wall -Werror foreign]) AM_PROG_AR @@ -46,9 +46,8 @@ PKG_CHECK_MODULES([cmocka], [cmocka >= 1.0.1]) AC_CONFIG_FILES([ Makefile - src/Makefile - src/opic/Makefile - src/opic/malloc/Makefile + opic/Makefile + opic/malloc/Makefile ]) AC_OUTPUT diff --git a/src/opic/Makefile.am b/opic/Makefile.am similarity index 77% rename from src/opic/Makefile.am rename to opic/Makefile.am index 2106725..31f2997 100644 --- a/src/opic/Makefile.am +++ b/opic/Makefile.am @@ -1,7 +1,7 @@ SUBDIRS = malloc AUTOMAKE_OPTIONS = subdir-objects -AM_CPPFLAGS = -I$(top_srcdir)/src +AM_CPPFLAGS = -I$(top_srcdir) lib_LTLIBRARIES = libdemomalloc.la @@ -13,5 +13,3 @@ libdemomalloc_la_SOURCES = \ malloc/lookup_helper.c libdemomalloc_la_LIBADD = @atomic_LIBS@ - -include_HEADERS = demomalloc.h op_malloc.h diff --git a/src/opic/common/op_assert.h b/opic/common/op_assert.h similarity index 100% rename from src/opic/common/op_assert.h rename to opic/common/op_assert.h diff --git a/src/opic/common/op_atomic.h b/opic/common/op_atomic.h similarity index 100% rename from src/opic/common/op_atomic.h rename to opic/common/op_atomic.h diff --git a/src/opic/common/op_log.c b/opic/common/op_log.c similarity index 100% rename from src/opic/common/op_log.c rename to opic/common/op_log.c diff --git a/src/opic/common/op_log.h b/opic/common/op_log.h similarity index 100% rename from src/opic/common/op_log.h rename to opic/common/op_log.h diff --git a/src/opic/common/op_macros.h b/opic/common/op_macros.h similarity index 100% rename from src/opic/common/op_macros.h rename to opic/common/op_macros.h diff --git a/src/opic/common/op_utils.h b/opic/common/op_utils.h similarity index 100% rename from src/opic/common/op_utils.h rename to opic/common/op_utils.h diff --git a/src/opic/demomalloc.c b/opic/demomalloc.c similarity index 100% rename from src/opic/demomalloc.c rename to opic/demomalloc.c diff --git a/src/opic/demomalloc.h b/opic/demomalloc.h similarity index 93% rename from src/opic/demomalloc.h rename to opic/demomalloc.h index c7e308c..14ac805 100644 --- a/src/opic/demomalloc.h +++ b/opic/demomalloc.h @@ -64,7 +64,12 @@ void* OPDemoRealloc(void* addr, size_t size) void OPDemoFree(void* addr); +/* + * Somehow I cannot compile the code below on OSX. + * Since replacing malloc is not the major goal, I'll just leave it here. + */ +/* void* malloc(size_t size) __attribute__((weak, alias("OPDemoMalloc"))) __attribute__((malloc)); @@ -76,6 +81,7 @@ void* realloc(void* addr, size_t size) void free(void* addr) __attribute__((weak, alias("OPDemoFree"))); +*/ OP_END_DECLS diff --git a/src/opic/malloc/Makefile.am b/opic/malloc/Makefile.am similarity index 97% rename from src/opic/malloc/Makefile.am rename to opic/malloc/Makefile.am index 3a4da94..6533423 100644 --- a/src/opic/malloc/Makefile.am +++ b/opic/malloc/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = -I$(top_srcdir)/src +AM_CPPFLAGS = -I$(top_srcdir) AM_CFLAGS = @cmocka_CFLAGS@ TESTS = lookup_helper_test init_helper_test allocator_test \ diff --git a/src/opic/malloc/allocator.c b/opic/malloc/allocator.c similarity index 100% rename from src/opic/malloc/allocator.c rename to opic/malloc/allocator.c diff --git a/src/opic/malloc/allocator.h b/opic/malloc/allocator.h similarity index 100% rename from src/opic/malloc/allocator.h rename to opic/malloc/allocator.h diff --git a/src/opic/malloc/allocator_test.c b/opic/malloc/allocator_test.c similarity index 100% rename from src/opic/malloc/allocator_test.c rename to opic/malloc/allocator_test.c diff --git a/src/opic/malloc/deallocator.c b/opic/malloc/deallocator.c similarity index 100% rename from src/opic/malloc/deallocator.c rename to opic/malloc/deallocator.c diff --git a/src/opic/malloc/deallocator.h b/opic/malloc/deallocator.h similarity index 100% rename from src/opic/malloc/deallocator.h rename to opic/malloc/deallocator.h diff --git a/src/opic/malloc/deallocator_test.c b/opic/malloc/deallocator_test.c similarity index 100% rename from src/opic/malloc/deallocator_test.c rename to opic/malloc/deallocator_test.c diff --git a/src/opic/malloc/init_helper.c b/opic/malloc/init_helper.c similarity index 100% rename from src/opic/malloc/init_helper.c rename to opic/malloc/init_helper.c diff --git a/src/opic/malloc/init_helper.h b/opic/malloc/init_helper.h similarity index 100% rename from src/opic/malloc/init_helper.h rename to opic/malloc/init_helper.h diff --git a/src/opic/malloc/init_helper_test.c b/opic/malloc/init_helper_test.c similarity index 100% rename from src/opic/malloc/init_helper_test.c rename to opic/malloc/init_helper_test.c diff --git a/src/opic/malloc/inline_aux.h b/opic/malloc/inline_aux.h similarity index 100% rename from src/opic/malloc/inline_aux.h rename to opic/malloc/inline_aux.h diff --git a/src/opic/malloc/lookup_helper.c b/opic/malloc/lookup_helper.c similarity index 100% rename from src/opic/malloc/lookup_helper.c rename to opic/malloc/lookup_helper.c diff --git a/src/opic/malloc/lookup_helper.h b/opic/malloc/lookup_helper.h similarity index 100% rename from src/opic/malloc/lookup_helper.h rename to opic/malloc/lookup_helper.h diff --git a/src/opic/malloc/lookup_helper_test.c b/opic/malloc/lookup_helper_test.c similarity index 100% rename from src/opic/malloc/lookup_helper_test.c rename to opic/malloc/lookup_helper_test.c diff --git a/src/opic/malloc/magic.h b/opic/malloc/magic.h similarity index 100% rename from src/opic/malloc/magic.h rename to opic/malloc/magic.h diff --git a/src/opic/malloc/objdef.h b/opic/malloc/objdef.h similarity index 100% rename from src/opic/malloc/objdef.h rename to opic/malloc/objdef.h diff --git a/src/opic/malloc/op_malloc.c b/opic/malloc/op_malloc.c similarity index 100% rename from src/opic/malloc/op_malloc.c rename to opic/malloc/op_malloc.c diff --git a/src/opic/object/class_map.c b/opic/object/class_map.c similarity index 100% rename from src/opic/object/class_map.c rename to opic/object/class_map.c diff --git a/src/opic/object/class_map.h b/opic/object/class_map.h similarity index 100% rename from src/opic/object/class_map.h rename to opic/object/class_map.h diff --git a/src/opic/object/op_malloc_manager.c b/opic/object/op_malloc_manager.c similarity index 100% rename from src/opic/object/op_malloc_manager.c rename to opic/object/op_malloc_manager.c diff --git a/src/opic/object/op_object.c b/opic/object/op_object.c similarity index 100% rename from src/opic/object/op_object.c rename to opic/object/op_object.c diff --git a/src/opic/object/op_object.h b/opic/object/op_object.h similarity index 100% rename from src/opic/object/op_object.h rename to opic/object/op_object.h diff --git a/src/opic/object/op_object_def.h b/opic/object/op_object_def.h similarity index 100% rename from src/opic/object/op_object_def.h rename to opic/object/op_object_def.h diff --git a/src/opic/object/op_serializable.c b/opic/object/op_serializable.c similarity index 100% rename from src/opic/object/op_serializable.c rename to opic/object/op_serializable.c diff --git a/src/opic/object/op_serializable.h b/opic/object/op_serializable.h similarity index 100% rename from src/opic/object/op_serializable.h rename to opic/object/op_serializable.h diff --git a/src/opic/object/op_trait.c b/opic/object/op_trait.c similarity index 100% rename from src/opic/object/op_trait.c rename to opic/object/op_trait.c diff --git a/src/opic/object/op_trait.h b/opic/object/op_trait.h similarity index 100% rename from src/opic/object/op_trait.h rename to opic/object/op_trait.h diff --git a/src/opic/object/ptr_range_map.h b/opic/object/ptr_range_map.h similarity index 100% rename from src/opic/object/ptr_range_map.h rename to opic/object/ptr_range_map.h diff --git a/src/opic/object/ptr_range_map_splay.c b/opic/object/ptr_range_map_splay.c similarity index 100% rename from src/opic/object/ptr_range_map_splay.c rename to opic/object/ptr_range_map_splay.c diff --git a/src/opic/op_malloc.h b/opic/op_malloc.h similarity index 100% rename from src/opic/op_malloc.h rename to opic/op_malloc.h diff --git a/src/Makefile.am b/src/Makefile.am deleted file mode 100644 index 017b7f7..0000000 --- a/src/Makefile.am +++ /dev/null @@ -1,48 +0,0 @@ -# TODO: Can we put Makefile.am in subdir? -# https://www.gnu.org/software/automake/manual/html_node/Libtool-Convenience-Libraries.html - -SUBDIRS = opic - -# AUTOMAKE_OPTIONS = subdir-objects -# -# AM_CPPFLAGS = -I$(top_srcdir)/src -# -# lib_LTLIBRARIES = libopic.la -# libopic_la_SOURCES = \ -# opic/common/op_log.c \ -# opic/malloc/span.c \ -# opic/malloc/huge_page.c \ -# opic/malloc/op_heap.c \ -# opic/object/op_serializable.c \ -# opic/object/op_trait.c \ -# opic/object/op_object.c \ -# opic/object/op_malloc_manager.c \ -# opic/object/class_map.c \ -# opic/object/ptr_range_map_splay.c \ -# op_collection.c \ -# op_iterator.c \ -# op_linked_list.c \ -# op_list.c -# libopic_la_CFLAGS = @log4c_CFLAGS@ @PTHREAD_CFLAGS@ -# -# include_HEADERS = \ -# opic.h \ -# op_collection.h \ -# op_functional.h \ -# op_iterator.h \ -# op_linked_list.h \ -# op_list.h -# -# # TODO some of the internal headers -# # may not be needed -# nobase_include_HEADERS = \ -# opic/common/op_assert.h \ -# opic/common/op_log.h \ -# opic/common/op_macros.h \ -# opic/malloc/op_heap.h \ -# opic/malloc/huge_page.h \ -# opic/malloc/span.h \ -# opic/object/op_serializable.h \ -# opic/object/op_trait.h \ -# opic/object/op_object_def.h \ -# opic/object/op_object.h