Commit e9d3b873 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Hacking makefiles. Addresses #782.

git-svn-id: file:///svn/tokudb@3793 c7de825b-a66e-492c-adef-691d508d4ae1
parent 09850cc9
...@@ -9,11 +9,11 @@ CFLAGS = $(OPTFLAGS) -Wall -W -Wcast-align -Wbad-function-cast -Wextra -Wmissing ...@@ -9,11 +9,11 @@ CFLAGS = $(OPTFLAGS) -Wall -W -Wcast-align -Wbad-function-cast -Wextra -Wmissing
CPPFLAGS = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE=500 CPPFLAGS = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE=500
LDFLAGS = -lz LDFLAGS = -lz
DIRS = newbrt DIRS = newbrt src
# src cxx utils db-benchmark-test db-benchmark-test-cxx # src cxx utils db-benchmark-test db-benchmark-test-cxx
include $(patsubst %,%/Makefile.include,$(DIRS)) include $(patsubst %,%/Makefile.include,$(DIRS))
build: $(BINS) build: $(BINS) $(LIBS)
check: $(CHECKS) check: $(CHECKS)
ifeq ($(VERBOSE),2) ifeq ($(VERBOSE),2)
...@@ -29,6 +29,19 @@ else ...@@ -29,6 +29,19 @@ else
endif endif
endif endif
ifneq ($(OSX),)
LIBRARY=$(LIBNAME).dylib
TLIBRARY=$(TLIBNAME).dylib
SHARED=-dynamiclib
RPATHNAME=-install_name @rpath/$(LIBRARY)
CFLAGS+=-fno-common
else
LIBRARY=$(LIBNAME).so
TLIBRARY=$(TLIBNAME).so
SHARED=-shared $(EXPORTMAP)
RPATHNAME=
endif
ifeq ($(CYGWIN),cygwin) ifeq ($(CYGWIN),cygwin)
else else
FPICFLAGS = -fPIC FPICFLAGS = -fPIC
......
NEWBRT_REGRESSION_TESTS = \
brt-serialize-test \
brt-test \
brt-test-cursor \
brt-test-cursor-2 \
brt-test-named-db \
brt-test0 \
brt-test1 \
brt-test2 \
brt-test3 \
brt-test4 \
brt-test5 \
cachetable-test \
cachetable-test2 \
fifo-test \
list-test \
log-test \
log-test2 \
log-test3 \
log-test4 \
log-test5 \
log-test6 \
omt-test \
test-assert \
test-brt-delete-both \
test-brt-overflow \
test-del-inorder \
test-inc-split \
test-primes \
test_oexcl \
test_toku_malloc_plain_free \
ybt-test \
# This line intentially kept commented so I can have a \ on the end of the previous line
NEWBRT_BINS = $(NEWBRT_REGRESSION_TESTS) \
benchmark-test \
brtdump \
tdb_logprint \
# This line intentially kept commented so I can have a \ on the end of the previous line
NEWBRT_HERE = $(ROOT)newbrt
NEWBRT_RBINS = $(patsubst %,$(NEWBRT_HERE)/%,$(NEWBRT_BINS))
BINS += $(NEWBRT_RBINS)
# Must include crc first
NEWBRT_FILES = \
crc \
brt-serialize \
brt-verify \
brt \
cachetable \
fifo \
fingerprint \
key \
leafentry \
log \
log_code \
memory \
mempool \
omt \
primes \
recover \
roll \
toku_assert \
ybt \
# keep this line so I can have a \ on the previous line
OFILES += $(NEWBRT_HERE)/newbrt.o
$(NEWBRT_HERE)/newbrt.o: CPPFLAGS += -I$(NEWBRT_HERE)
$(NEWBRT_HERE)/newbrt.o: $(patsubst %,$(NEWBRT_HERE)/%.c,$(NEWBRT_FILES))
$(CC) -combine $(CFLAGS) $(CPPFLAGS) $^ -c -o $@
$(NEWBRT_RBINS): $(NEWBRT_HERE)/newbrt.o
NEWBRT_NEED_HELPERS = test-inc-split test-del-inorder
$(patsubst %,$(NEWBRT_HERE)/%, $(NEWBRT_NEED_HELPERS)): $(NEWBRT_HERE)/brt-test-helpers.o
# Put the benchmarktest_256 first since it takes a long time (and we want to use parallelism in the make)
NEWBRT_CHECKS = \
benchmarktest_256 \
$(NEWBRT_REGRESSION_TESTS) \
# This line intentially kept commented so I can have a \ on the previous line
CHECKS += $(patsubst %,$(NEWBRT_HERE)/%.check, $(NEWBRT_CHECKS))
$(NEWBRT_HERE)/benchmarktest_256.check: $(NEWBRT_HERE)/benchmark-test
cd $(NEWBRT_HERE)/; $(VGRIND) ./benchmark-test $(VERBVERBOSE) --valsize 256 --verify 1
foo:
echo $(NEWBRT_HERE)/benchmarktest_256.check
$(NEWBRT_HERE)/test-assert.check: $(NEWBRT_HERE)/test-assert
@# no arguments, should err
$(VGRIND) $(NEWBRT_HERE)/test-assert > /dev/null 2>&1 ; test \($$?\)
@# one argument, not "ok" should err
@echo Expect an abort message:
($(VGRIND) $(NEWBRT_HERE)/test-assert notok) > test-assert.out 2>&1 ; test \($$?\)
@fgrep failed test-assert.out > /dev/null
@rm test-assert.out
@# one argument, "ok" should not error
$(DVGRIND) $(NEWBRT_HERE)/test-assert ok
SRC_HERE = $(ROOT)src
include $(ROOT)src/lock_tree/Makefile.include
include $(ROOT)src/range_tree/Makefile.include
include $(ROOT)src/tests/Makefile.include
OFILES += $(SRC_HERE)/lock_and_range_tree.o
$(SRC_HERE)/lock_and_range_tree.o: CPPFLAGS += -I$(LOCKTREE_HERE) -I$(LOCKTREE_HERE)/.. -I$(LOCKTREE_HERE)/../range_tree -I$(LOCKTREE_HERE)/../../include -I$(LOCKTREE_HERE)/../../newbrt
$(SRC_HERE)/lock_and_range_tree.o: $(patsubst %,$(LOCKTREE_HERE)/%.c,$(LOCKTREE_FILES)) $(patsubst %,$(RANGETREE_HERE)/%.c,$(RANGETREE_FILES))
$(CC) -combine $(CFLAGS) $(CPPFLAGS) $^ -c -o $@
SRC_FILES = ydb errors elocks lock_and_range_tree
SRC_OFILES = $(patsubst %, $(SRC_HERE)/%.o, $(SRC_FILES)) $(ROOT)newbrt/newbrt.o
LIBS += $(ROOT)lib/libtokudb.so $(ROOT)lib/libtokudb.a
$(ROOT)src/%.o: CPPFLAGS += -I$(ROOT)include -I$(ROOT)newbrt -I$(ROOT)src/lock_tree -I$(ROOT)src/range_tree
$(ROOT)lib/libtokudb.a: $(SRC_OFILES)
$(AR) rv $@ $^
$(ROOT)lib/libtokudb.so: $(SRC_OFILES)
cc $^ $(SHARED) -o $@ $(CFLAGS) -lz $(RPATHNAME)
...@@ -127,6 +127,7 @@ void toku_ydb_barf() { ...@@ -127,6 +127,7 @@ void toku_ydb_barf() {
/** Prints a note with the point where it was generated /** Prints a note with the point where it was generated
\param fmt The format string for the note to be printed */ \param fmt The format string for the note to be printed */
#if 0
void toku_ydb_notef(const char *fmt, ...) { void toku_ydb_notef(const char *fmt, ...) {
fprintf(stderr, "YDB: Note %s:%d in %s, ", __FILE__, __LINE__, __func__); fprintf(stderr, "YDB: Note %s:%d in %s, ", __FILE__, __LINE__, __func__);
va_list ap; va_list ap;
...@@ -134,4 +135,5 @@ void toku_ydb_notef(const char *fmt, ...) { ...@@ -134,4 +135,5 @@ void toku_ydb_notef(const char *fmt, ...) {
vfprintf(stderr, fmt, ap); vfprintf(stderr, fmt, ap);
va_end(ap); va_end(ap);
} }
#endif
LOCKTREE_FILES = db_id rth lth idlth locktree
LOCKTREE_HERE = $(ROOT)src/lock_tree
RANGETREE_FILES = linear log_nooverlap tokuredblack
RANGETREE_HERE = $(ROOT)src/range_tree
RANGETREE_HEADERS = rangetree rangetree-internal tokuredblack
...@@ -117,6 +117,7 @@ void toku_ydb_error_all_cases(const DB_ENV * env, ...@@ -117,6 +117,7 @@ void toku_ydb_error_all_cases(const DB_ENV * env,
BOOL include_stderrstring, BOOL include_stderrstring,
BOOL use_stderr_if_nothing_else, BOOL use_stderr_if_nothing_else,
const char *fmt, va_list ap) const char *fmt, va_list ap)
__attribute__((format (printf, 5, 0)))
__attribute__((__visibility__("default"))); // this is needed by the C++ interface. __attribute__((__visibility__("default"))); // this is needed by the C++ interface.
int toku_ydb_do_error (const DB_ENV *, int, const char *, ...); int toku_ydb_do_error (const DB_ENV *, int, const char *, ...);
......
...@@ -911,6 +911,7 @@ int txn_commit(DB_TXN * txn, u_int32_t flags) { ...@@ -911,6 +911,7 @@ int txn_commit(DB_TXN * txn, u_int32_t flags) {
} }
#endif #endif
int log_compare(const DB_LSN * a, const DB_LSN * b) __attribute__((__noreturn__));
int log_compare(const DB_LSN * a, const DB_LSN * b) { int log_compare(const DB_LSN * a, const DB_LSN * b) {
toku_ydb_lock(); toku_ydb_lock();
fprintf(stderr, "%s:%d log_compare(%p,%p)\n", __FILE__, __LINE__, a, b); fprintf(stderr, "%s:%d log_compare(%p,%p)\n", __FILE__, __LINE__, a, b);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment