Commit 42505a20 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Hacking makefiles. Addresses #782.

git-svn-id: file:///svn/tokudb@3813 c7de825b-a66e-492c-adef-691d508d4ae1
parent 7e32d642
# -*- Mode: Makefile -*-
# ROOT is the the name of the root of the tokudb make directory heirarchy, starting at the cwd
ROOT =
default: build
VGRIND = valgrind
OPTFLAGS = -O3
CFLAGS = $(OPTFLAGS) -Wall -W -Wcast-align -Wbad-function-cast -Wextra -Wmissing-noreturn -Wmissing-format-attribute -g3 -ggdb3 -Werror -fPIC -Wshadow -fvisibility=hidden
CPPFLAGS = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE=500
LDFLAGS = -lz
DIRS = newbrt src
# src cxx utils db-benchmark-test db-benchmark-test-cxx
include $(patsubst %,%/Makefile.include,$(DIRS))
include Makefile.include
build: $(BINS) $(LIBS)
check: $(CHECKS)
ifeq ($(VERBOSE),2)
VERBVERBOSE=-v
MAYBEATSIGN=
else
ifeq ($(VERBOSE),1)
VERBVERBOSE=-q
MAYBEATSIGN=
else
VERBVERBOSE=-q
MAYBEATSIGN=@
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)
else
FPICFLAGS = -fPIC
# valgrind is not present on cygwin
VGRIND = valgrind --quiet --error-exitcode=1 --leak-check=yes
endif
%.check: %
$(VGRIND) ./$< $(VERBVERBOSE)
check: $(patsubst %,%.checkdir,$(DIRS))
......@@ -83,13 +83,13 @@ NEWBRT_CHECKS = \
$(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.checkdir: $(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
#foo:
# echo $(NEWBRT_HERE)/benchmarktest_256.check
$(NEWBRT_HERE)/test-assert.check: $(NEWBRT_HERE)/test-assert
@# no arguments, should err
......
......@@ -20,5 +20,5 @@ $(ROOT)src/%.o: CPPFLAGS += -I$(ROOT)include -I$(ROOT)newbrt -I$(ROOT)src/lock_t
$(ROOT)lib/libtokudb.a: $(SRC_OFILES)
$(AR) rv $@ $^
$(ROOT)lib/libtokudb.so: $(SRC_OFILES)
$(ROOT)lib/libtokudb.$(LIBEXT): $(SRC_OFILES)
cc $^ $(SHARED) -o $@ $(CFLAGS) -lz $(RPATHNAME)
SRC_TESTS_HERE = $(ROOT)src/tests
SRC_TESTS_SRCS = $(sort $(wildcard $(SRC_TESTS_HERE)/*.c))
SRC_TESTS_TDB_TESTS = $(patsubst %.c,%.tdb,$(SRC_TESTS_SRCS))
SRC_TESTS_BDB_DONTRUN = bug627 test_abort1
SRC_TESTS_BDB_TESTS = $(patsubst %.c,%.bdb,$(filter-out $(patsubst %,%.c,$(SRC_TESTS_BDB_DONTRUN)),$(SRC_TEST_SRCS)))
SRC_TESTS_TDB_TESTS_THAT_SHOULD_FAIL = test_groupcommit_count
SRC_TESTS_ALL_TESTS = $(SRC_TESTS_TDB_TESTS) $(SRC_TESTS_BDB_TESTS)
SRC_TESTS_RUN_TDB_TESTS = $(patsubst %.tdb,%.tdbrun,$(SRC_TESTS_TDB_TESTS))
SRC_TESTS_RUN_BDB_TESTS = $(patsubst %.bdb,%.bdbrun,$(SRC_TESTS_BDB_TESTS))
SRC_TESTS_RUN_ALL_TESTS = $(SRC_TESTS_RUN_TDB_TESTS) $(SRC_TESTS_RUN_BDB_TESTS)
SRC_TESTS_TDB_LOADLIBES = -L$(ROOT)lib -ltokudb -Wl,-rpath,.. -lpthread
SRC_TESTS_TDB_CPPFLAGS = -I$(ROOT)include
foo:
echo $(SRC_OFILES)
echo $(ROOT)lib/libtokudb.$(LIBEXT)
src/tests.checkdir: $(SRC_TESTS_RUN_ALL_TESTS)
src/tests.builddir: $(SRC_TESTS_ALL_TESTS)
$(SRC_TESTS_ALL_TESTS): $(SRC_TESTS_HERE)/test.h
.PHONY: $(SRC_TESTS_RUN_ALL_TESTS)
%.bdbrun: %.bdb
$(MAYBEATSIGN) $(UNSETTOKUENV) ./$< $(VERBVERBOSE)
# %.tdbrun: %.tdb $(ROOT)lib/libtokudb.$(LIBEXT)
%.tdbrun: %.tdb
$(MAYBEATSIGN) $(SETTOKUENV) $(VGRIND) ./$< $(VERBVERBOSE) $(MAYBEINVERTERR)
%.bdb: %.c
$(UNSETTOKUENV) cc -DENVDIR=\"$<.bdbdir\" $(BDB_CPPFLAGS) -DUSE_BDB -DIS_TDB=0 $(CFLAGS) $< $(BDB_LDFLAGS) -ldb -o $@
%.tdb: %.c
$(SETTOKUENV) cc -DENVDIR=\"$<.tdbdir\" -DUSE_TDB -DIS_TDB=1 $(CFLAGS) $(CPPFLAGS) $(SRC_TESTS_TDB_CPPFLAGS) $(SRC_TESTS_TDB_LOADLIBES) $< -o $@
%.tdbt: %.c
$(SETTOKUENV) cc -DENVDIR=\"$<.tdbdir\" -DUSE_TDB -DIS_TDB=1 $(CFLAGS) $(CPPFLAGS) $(SRC_TESTS_TDB_CPPFLAGS) $(TDB_TRACELOADLIBES) $< -o $@
......@@ -24,9 +24,12 @@ void parse_args (int argc, const char *argv[]) {
int resultcode=0;
if (strcmp(argv[1], "-v")==0) {
verbose++;
} else if (strcmp(argv[1],"-q")==0) {
verbose--;
if (verbose<0) verbose=0;
} else if (strcmp(argv[1], "-h")==0) {
do_usage:
fprintf(stderr, "Usage:\n%s [-v|-h]\n", argv0);
fprintf(stderr, "Usage:\n%s [-v|-q] [-h]\n", argv0);
exit(resultcode);
} else {
resultcode=1;
......
......@@ -60,7 +60,7 @@ void test_autotxn(u_int32_t env_flags, u_int32_t db_flags) {
r = env->close(env, 0); assert(r==0);
}
int main (int argc, char *argv[]) {
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) {
test_autotxn(DB_AUTO_COMMIT, DB_AUTO_COMMIT);
test_autotxn(0, DB_AUTO_COMMIT);
test_autotxn(DB_AUTO_COMMIT, 0);
......
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