Restructure source tree.

This commit is contained in:
Jason Evans 2010-02-11 14:45:59 -08:00
parent fe5faa2cc5
commit 376b1529a3
43 changed files with 102 additions and 116 deletions

View File

@ -11,13 +11,12 @@ SHELL := /bin/sh
CC := @CC@ CC := @CC@
# Configuration parameters. # Configuration parameters.
BINDIR := @BINDIR@
INCLUDEDIR := @INCLUDEDIR@ INCLUDEDIR := @INCLUDEDIR@
LIBDIR := @LIBDIR@ LIBDIR := @LIBDIR@
MANDIR := @MANDIR@ MANDIR := @MANDIR@
# Build parameters. # Build parameters.
CPPFLAGS := @CPPFLAGS@ -I@srcroot@src -I@objroot@src CPPFLAGS := @CPPFLAGS@ -I@srcroot@include -I@objroot@include
CFLAGS := @CFLAGS@ -fPIC -DPIC CFLAGS := @CFLAGS@ -fPIC -DPIC
ifeq (macho, @abi@) ifeq (macho, @abi@)
CFLAGS += -dynamic CFLAGS += -dynamic
@ -33,16 +32,14 @@ endif
REV := 0 REV := 0
# Lists of files. # Lists of files.
CHDRS := @objroot@src/jemalloc@install_suffix@.h \ CHDRS := @objroot@include/jemalloc@install_suffix@.h \
@objroot@src/jemalloc_defs@install_suffix@.h @objroot@include/jemalloc_defs@install_suffix@.h
CSRCS := @srcroot@src/jemalloc.c @srcroot@src/jemalloc_arena.c \ CSRCS := @srcroot@src/jemalloc.c @srcroot@src/arena.c @srcroot@src/base.c \
@srcroot@src/jemalloc_base.c @srcroot@src/jemalloc_chunk.c \ @srcroot@src/chunk.c @srcroot@src/chunk_dss.c \
@srcroot@src/jemalloc_chunk_dss.c @srcroot@src/jemalloc_chunk_mmap.c \ @srcroot@src/chunk_mmap.c @srcroot@src/chunk_swap.c @srcroot@src/ckh.c \
@srcroot@src/jemalloc_chunk_swap.c @srcroot@src/ckh.c \ @srcroot@src/ctl.c @srcroot@src/extent.c @srcroot@src/hash.c \
@srcroot@src/jemalloc_ctl.c @srcroot@src/jemalloc_extent.c \ @srcroot@src/huge.c @srcroot@src/mb.c @srcroot@src/mutex.c \
@srcroot@src/hash.c @srcroot@src/jemalloc_huge.c @srcroot@src/mb.c \ @srcroot@src/prof.c @srcroot@src/stats.c @srcroot@src/tcache.c
@srcroot@src/jemalloc_mutex.c @srcroot@src/prof.c \
@srcroot@src/jemalloc_stats.c @srcroot@src/jemalloc_tcache.c
DSOS := @objroot@lib/libjemalloc@install_suffix@.so.$(REV) \ DSOS := @objroot@lib/libjemalloc@install_suffix@.so.$(REV) \
@objroot@lib/libjemalloc@install_suffix@.so \ @objroot@lib/libjemalloc@install_suffix@.so \
@objroot@lib/libjemalloc@install_suffix@_pic.a @objroot@lib/libjemalloc@install_suffix@_pic.a
@ -59,6 +56,7 @@ all: $(DSOS)
-include $(CSRCS:@srcroot@%.c=@objroot@%.d) -include $(CSRCS:@srcroot@%.c=@objroot@%.d)
@objroot@src/%.o: @srcroot@src/%.c @objroot@src/%.o: @srcroot@src/%.c
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c $(CPPFLAGS) -o $@ $< $(CC) $(CFLAGS) -c $(CPPFLAGS) -o $@ $<
@$(SHELL) -ec "$(CC) -MM $(CPPFLAGS) $< | sed \"s/\($(subst /,\/,$(notdir $(basename $@)))\)\.o\([ :]*\)/$(subst /,\/,$(strip $(dir $@)))\1.o \2/g\" > $(@:%.o=%.d)" @$(SHELL) -ec "$(CC) -MM $(CPPFLAGS) $< | sed \"s/\($(subst /,\/,$(notdir $(basename $@)))\)\.o\([ :]*\)/$(subst /,\/,$(strip $(dir $@)))\1.o \2/g\" > $(@:%.o=%.d)"
@ -68,20 +66,11 @@ $(DSOS): $(CSRCS:@srcroot@%.c=@objroot@%.o)
ln -sf libjemalloc@install_suffix@.so.$(REV) lib/libjemalloc@install_suffix@.so ln -sf libjemalloc@install_suffix@.so.$(REV) lib/libjemalloc@install_suffix@.so
ar crus @objroot@lib/libjemalloc@install_suffix@_pic.a $+ ar crus @objroot@lib/libjemalloc@install_suffix@_pic.a $+
@objroot@bin/%@install_suffix@: @objroot@src/%.o
@mkdir -p $(@D)
$(CC) -o $@ $< $(LDFLAGS) $(LIBS)
install: install:
install -d $(BINDIR) install -d $(INCLUDEDIR)/jemalloc
@for b in $(BINS); do \
echo "install -m 755 $$b $(BINDIR)"; \
install -m 755 $$b $(BINDIR); \
done
install -d $(INCLUDEDIR)
@for h in $(CHDRS); do \ @for h in $(CHDRS); do \
echo "install -m 644 $$h $(INCLUDEDIR)"; \ echo "install -m 644 $$h $(INCLUDEDIR)/jemalloc"; \
install -m 644 $$h $(INCLUDEDIR); \ install -m 644 $$h $(INCLUDEDIR)/jemalloc; \
done done
install -d $(LIBDIR) install -d $(LIBDIR)
install -m 755 @objroot@lib/libjemalloc@install_suffix@.so.$(REV) $(LIBDIR) install -m 755 @objroot@lib/libjemalloc@install_suffix@.so.$(REV) $(LIBDIR)
@ -96,9 +85,6 @@ done
check: check:
clean: clean:
rm -f $(BINS)
rm -f $(BINS:@objroot@bin/%=@objroot@src/%.o)
rm -f $(BINS:@objroot@bin/%=@objroot@src/%.d)
rm -f $(CSRCS:@srcroot@%.c=@objroot@%.o) rm -f $(CSRCS:@srcroot@%.c=@objroot@%.o)
rm -f $(CSRCS:@srcroot@%.c=@objroot@%.d) rm -f $(CSRCS:@srcroot@%.c=@objroot@%.d)
rm -f $(DSOS) rm -f $(DSOS)

View File

@ -263,22 +263,22 @@ install_suffix="$INSTALL_SUFFIX"
AC_SUBST([install_suffix]) AC_SUBST([install_suffix])
cfgoutputs_in="Makefile doc/jemalloc.3.in" cfgoutputs_in="Makefile doc/jemalloc.3.in"
cfgoutputs_in="${cfgoutputs_in} src/jemalloc.h.in" cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc.h.in"
cfgoutputs_in="${cfgoutputs_in} src/internal/jemalloc_internal.h.in" cfgoutputs_in="${cfgoutputs_in} include/jemalloc/internal/jemalloc_internal.h.in"
cfgoutputs_out="Makefile doc/jemalloc${install_suffix}.3" cfgoutputs_out="Makefile doc/jemalloc${install_suffix}.3"
cfgoutputs_out="${cfgoutputs_out} src/jemalloc${install_suffix}.h" cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc${install_suffix}.h"
cfgoutputs_out="${cfgoutputs_out} src/internal/jemalloc_internal.h" cfgoutputs_out="${cfgoutputs_out} include/jemalloc/internal/jemalloc_internal.h"
cfgoutputs_tup="Makefile doc/jemalloc${install_suffix}.3:doc/jemalloc.3.in" cfgoutputs_tup="Makefile doc/jemalloc${install_suffix}.3:doc/jemalloc.3.in"
cfgoutputs_tup="${cfgoutputs_tup} src/jemalloc${install_suffix}.h:src/jemalloc.h.in" cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc${install_suffix}.h:include/jemalloc/jemalloc.h.in"
cfgoutputs_tup="${cfgoutputs_tup} src/internal/jemalloc_internal.h" cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/internal/jemalloc_internal.h"
cfghdrs_in="src/jemalloc_defs.h.in" cfghdrs_in="include/jemalloc/jemalloc_defs.h.in"
cfghdrs_out="src/jemalloc_defs${install_suffix}.h" cfghdrs_out="include/jemalloc/jemalloc_defs${install_suffix}.h"
cfghdrs_tup="src/jemalloc_defs${install_suffix}.h:src/jemalloc_defs.h.in" cfghdrs_tup="include/jemalloc/jemalloc_defs${install_suffix}.h:include/jemalloc/jemalloc_defs.h.in"
dnl Do not compile with debugging by default. dnl Do not compile with debugging by default.
AC_ARG_ENABLE([debug], AC_ARG_ENABLE([debug],

View File

@ -57,7 +57,7 @@
.Sy libjemalloc@install_suffix@ .Sy libjemalloc@install_suffix@
.Sh SYNOPSIS .Sh SYNOPSIS
.In stdlib.h .In stdlib.h
.In jemalloc@install_suffix@.h .In jemalloc/jemalloc@install_suffix@.h
.Ft void * .Ft void *
.Fn @jemalloc_prefix@malloc "size_t size" .Fn @jemalloc_prefix@malloc "size_t size"
.Ft void * .Ft void *

View File

@ -56,6 +56,6 @@ bool chunk_boot(void);
#endif /* JEMALLOC_H_INLINES */ #endif /* JEMALLOC_H_INLINES */
/******************************************************************************/ /******************************************************************************/
#include "internal/jemalloc_chunk_swap.h" #include "jemalloc/internal/chunk_swap.h"
#include "internal/jemalloc_chunk_dss.h" #include "jemalloc/internal/chunk_dss.h"
#include "internal/jemalloc_chunk_mmap.h" #include "jemalloc/internal/chunk_mmap.h"

View File

@ -31,9 +31,9 @@
#include <dlfcn.h> #include <dlfcn.h>
#endif #endif
#include "internal/rb.h" #include "jemalloc/internal/rb.h"
#include "internal/qr.h" #include "jemalloc/internal/qr.h"
#include "internal/ql.h" #include "jemalloc/internal/ql.h"
extern void (*JEMALLOC_P(malloc_message))(void *w4opaque, const char *p1, extern void (*JEMALLOC_P(malloc_message))(void *w4opaque, const char *p1,
const char *p2, const char *p3, const char *p4); const char *p2, const char *p3, const char *p4);
@ -169,39 +169,39 @@ extern void (*JEMALLOC_P(malloc_message))(void *w4opaque, const char *p1,
#define PAGE_CEILING(s) \ #define PAGE_CEILING(s) \
(((s) + PAGE_MASK) & ~PAGE_MASK) (((s) + PAGE_MASK) & ~PAGE_MASK)
#include "internal/prn.h" #include "jemalloc/internal/prn.h"
#include "internal/mb.h" #include "jemalloc/internal/mb.h"
#include "internal/ckh.h" #include "jemalloc/internal/ckh.h"
#include "internal/jemalloc_stats.h" #include "jemalloc/internal/stats.h"
#include "internal/jemalloc_ctl.h" #include "jemalloc/internal/ctl.h"
#include "internal/jemalloc_mutex.h" #include "jemalloc/internal/mutex.h"
#include "internal/jemalloc_extent.h" #include "jemalloc/internal/extent.h"
#include "internal/jemalloc_arena.h" #include "jemalloc/internal/arena.h"
#include "internal/jemalloc_base.h" #include "jemalloc/internal/base.h"
#include "internal/jemalloc_chunk.h" #include "jemalloc/internal/chunk.h"
#include "internal/jemalloc_huge.h" #include "jemalloc/internal/huge.h"
#include "internal/jemalloc_tcache.h" #include "jemalloc/internal/tcache.h"
#include "internal/hash.h" #include "jemalloc/internal/hash.h"
#include "internal/prof.h" #include "jemalloc/internal/prof.h"
#undef JEMALLOC_H_TYPES #undef JEMALLOC_H_TYPES
/******************************************************************************/ /******************************************************************************/
#define JEMALLOC_H_STRUCTS #define JEMALLOC_H_STRUCTS
#include "internal/prn.h" #include "jemalloc/internal/prn.h"
#include "internal/mb.h" #include "jemalloc/internal/mb.h"
#include "internal/ckh.h" #include "jemalloc/internal/ckh.h"
#include "internal/jemalloc_stats.h" #include "jemalloc/internal/stats.h"
#include "internal/jemalloc_ctl.h" #include "jemalloc/internal/ctl.h"
#include "internal/jemalloc_mutex.h" #include "jemalloc/internal/mutex.h"
#include "internal/jemalloc_extent.h" #include "jemalloc/internal/extent.h"
#include "internal/jemalloc_arena.h" #include "jemalloc/internal/arena.h"
#include "internal/jemalloc_base.h" #include "jemalloc/internal/base.h"
#include "internal/jemalloc_chunk.h" #include "jemalloc/internal/chunk.h"
#include "internal/jemalloc_huge.h" #include "jemalloc/internal/huge.h"
#include "internal/jemalloc_tcache.h" #include "jemalloc/internal/tcache.h"
#include "internal/hash.h" #include "jemalloc/internal/hash.h"
#include "internal/prof.h" #include "jemalloc/internal/prof.h"
#undef JEMALLOC_H_STRUCTS #undef JEMALLOC_H_STRUCTS
/******************************************************************************/ /******************************************************************************/
@ -250,35 +250,35 @@ arena_t *arenas_extend(unsigned ind);
arena_t *choose_arena_hard(void); arena_t *choose_arena_hard(void);
#endif #endif
#include "internal/prn.h" #include "jemalloc/internal/prn.h"
#include "internal/mb.h" #include "jemalloc/internal/mb.h"
#include "internal/ckh.h" #include "jemalloc/internal/ckh.h"
#include "internal/jemalloc_stats.h" #include "jemalloc/internal/stats.h"
#include "internal/jemalloc_ctl.h" #include "jemalloc/internal/ctl.h"
#include "internal/jemalloc_mutex.h" #include "jemalloc/internal/mutex.h"
#include "internal/jemalloc_extent.h" #include "jemalloc/internal/extent.h"
#include "internal/jemalloc_arena.h" #include "jemalloc/internal/arena.h"
#include "internal/jemalloc_base.h" #include "jemalloc/internal/base.h"
#include "internal/jemalloc_chunk.h" #include "jemalloc/internal/chunk.h"
#include "internal/jemalloc_huge.h" #include "jemalloc/internal/huge.h"
#include "internal/jemalloc_tcache.h" #include "jemalloc/internal/tcache.h"
#include "internal/hash.h" #include "jemalloc/internal/hash.h"
#include "internal/prof.h" #include "jemalloc/internal/prof.h"
#undef JEMALLOC_H_EXTERNS #undef JEMALLOC_H_EXTERNS
/******************************************************************************/ /******************************************************************************/
#define JEMALLOC_H_INLINES #define JEMALLOC_H_INLINES
#include "internal/prn.h" #include "jemalloc/internal/prn.h"
#include "internal/mb.h" #include "jemalloc/internal/mb.h"
#include "internal/ckh.h" #include "jemalloc/internal/ckh.h"
#include "internal/jemalloc_stats.h" #include "jemalloc/internal/stats.h"
#include "internal/jemalloc_ctl.h" #include "jemalloc/internal/ctl.h"
#include "internal/jemalloc_mutex.h" #include "jemalloc/internal/mutex.h"
#include "internal/jemalloc_extent.h" #include "jemalloc/internal/extent.h"
#include "internal/jemalloc_base.h" #include "jemalloc/internal/base.h"
#include "internal/jemalloc_chunk.h" #include "jemalloc/internal/chunk.h"
#include "internal/jemalloc_huge.h" #include "jemalloc/internal/huge.h"
#ifndef JEMALLOC_ENABLE_INLINE #ifndef JEMALLOC_ENABLE_INLINE
void malloc_write4(const char *p1, const char *p2, const char *p3, void malloc_write4(const char *p1, const char *p2, const char *p3,
@ -367,10 +367,10 @@ choose_arena(void)
} }
#endif #endif
#include "internal/jemalloc_tcache.h" #include "jemalloc/internal/tcache.h"
#include "internal/jemalloc_arena.h" #include "jemalloc/internal/arena.h"
#include "internal/hash.h" #include "jemalloc/internal/hash.h"
#include "internal/prof.h" #include "jemalloc/internal/prof.h"
#ifndef JEMALLOC_ENABLE_INLINE #ifndef JEMALLOC_ENABLE_INLINE
void *imalloc(size_t size); void *imalloc(size_t size);

View File

@ -1,5 +1,5 @@
#define JEMALLOC_ARENA_C_ #define JEMALLOC_ARENA_C_
#include "internal/jemalloc_internal.h" #include "jemalloc/internal/jemalloc_internal.h"
/******************************************************************************/ /******************************************************************************/
/* Data. */ /* Data. */

View File

@ -1,5 +1,5 @@
#define JEMALLOC_BASE_C_ #define JEMALLOC_BASE_C_
#include "internal/jemalloc_internal.h" #include "jemalloc/internal/jemalloc_internal.h"
/******************************************************************************/ /******************************************************************************/
/* Data. */ /* Data. */

View File

@ -1,5 +1,5 @@
#define JEMALLOC_CHUNK_C_ #define JEMALLOC_CHUNK_C_
#include "internal/jemalloc_internal.h" #include "jemalloc/internal/jemalloc_internal.h"
/******************************************************************************/ /******************************************************************************/
/* Data. */ /* Data. */

View File

@ -1,5 +1,5 @@
#define JEMALLOC_CHUNK_DSS_C_ #define JEMALLOC_CHUNK_DSS_C_
#include "internal/jemalloc_internal.h" #include "jemalloc/internal/jemalloc_internal.h"
#ifdef JEMALLOC_DSS #ifdef JEMALLOC_DSS
/******************************************************************************/ /******************************************************************************/
/* Data. */ /* Data. */

View File

@ -1,5 +1,5 @@
#define JEMALLOC_CHUNK_MMAP_C_ #define JEMALLOC_CHUNK_MMAP_C_
#include "internal/jemalloc_internal.h" #include "jemalloc/internal/jemalloc_internal.h"
/******************************************************************************/ /******************************************************************************/
/* Data. */ /* Data. */

View File

@ -1,5 +1,5 @@
#define JEMALLOC_CHUNK_SWAP_C_ #define JEMALLOC_CHUNK_SWAP_C_
#include "internal/jemalloc_internal.h" #include "jemalloc/internal/jemalloc_internal.h"
#ifdef JEMALLOC_SWAP #ifdef JEMALLOC_SWAP
/******************************************************************************/ /******************************************************************************/
/* Data. */ /* Data. */

View File

@ -35,7 +35,7 @@
* *
******************************************************************************/ ******************************************************************************/
#define CKH_C_ #define CKH_C_
#include "internal/jemalloc_internal.h" #include "jemalloc/internal/jemalloc_internal.h"
/******************************************************************************/ /******************************************************************************/
/* Function prototypes for non-inline static functions. */ /* Function prototypes for non-inline static functions. */

View File

@ -1,5 +1,5 @@
#define JEMALLOC_CTL_C_ #define JEMALLOC_CTL_C_
#include "internal/jemalloc_internal.h" #include "jemalloc/internal/jemalloc_internal.h"
/******************************************************************************/ /******************************************************************************/
/* Data. */ /* Data. */

View File

@ -1,5 +1,5 @@
#define JEMALLOC_EXTENT_C_ #define JEMALLOC_EXTENT_C_
#include "internal/jemalloc_internal.h" #include "jemalloc/internal/jemalloc_internal.h"
/******************************************************************************/ /******************************************************************************/

View File

@ -1,2 +1,2 @@
#define HASH_C_ #define HASH_C_
#include "internal/jemalloc_internal.h" #include "jemalloc/internal/jemalloc_internal.h"

View File

@ -1,5 +1,5 @@
#define JEMALLOC_HUGE_C_ #define JEMALLOC_HUGE_C_
#include "internal/jemalloc_internal.h" #include "jemalloc/internal/jemalloc_internal.h"
/******************************************************************************/ /******************************************************************************/
/* Data. */ /* Data. */

View File

@ -90,7 +90,7 @@
*/ */
#define JEMALLOC_C_ #define JEMALLOC_C_
#include "internal/jemalloc_internal.h" #include "jemalloc/internal/jemalloc_internal.h"
/******************************************************************************/ /******************************************************************************/
/* Data. */ /* Data. */

View File

@ -1,2 +1,2 @@
#define MB_C_ #define MB_C_
#include "internal/jemalloc_internal.h" #include "jemalloc/internal/jemalloc_internal.h"

View File

@ -1,5 +1,5 @@
#define JEMALLOC_MUTEX_C_ #define JEMALLOC_MUTEX_C_
#include "internal/jemalloc_internal.h" #include "jemalloc/internal/jemalloc_internal.h"
/******************************************************************************/ /******************************************************************************/
/* Data. */ /* Data. */

View File

@ -1,5 +1,5 @@
#define JEMALLOC_PROF_C_ #define JEMALLOC_PROF_C_
#include "internal/jemalloc_internal.h" #include "jemalloc/internal/jemalloc_internal.h"
#ifdef JEMALLOC_PROF #ifdef JEMALLOC_PROF
/******************************************************************************/ /******************************************************************************/

View File

@ -1,5 +1,5 @@
#define JEMALLOC_STATS_C_ #define JEMALLOC_STATS_C_
#include "internal/jemalloc_internal.h" #include "jemalloc/internal/jemalloc_internal.h"
#define CTL_GET(n, v, t) do { \ #define CTL_GET(n, v, t) do { \
size_t sz = sizeof(t); \ size_t sz = sizeof(t); \

View File

@ -1,5 +1,5 @@
#define JEMALLOC_TCACHE_C_ #define JEMALLOC_TCACHE_C_
#include "internal/jemalloc_internal.h" #include "jemalloc/internal/jemalloc_internal.h"
#ifdef JEMALLOC_TCACHE #ifdef JEMALLOC_TCACHE
/******************************************************************************/ /******************************************************************************/
/* Data. */ /* Data. */