2007-08-09 13:35:23 +00:00
# On cygwin do:
# make CYGWIN=cygwin check
2007-12-22 20:56:20 +00:00
# For verbose output do
# make VERBOSE=1
# For very verbose output do
# make VERBOSE=2
2013-04-16 23:57:20 -04:00
# For CIL do
# make CIL=1
2007-07-13 19:37:47 +00:00
# GCOV_FLAGS = -fprofile-arcs -ftest-coverage
2008-03-06 16:35:18 +00:00
# PROF_FLAGS = -pg
2008-05-07 00:46:02 +00:00
OPTFLAGS = -O3
2007-08-09 13:35:23 +00:00
2007-12-22 20:56:20 +00:00
i f e q ( $( VERBOSE ) , 2 )
VERBVERBOSE = -v
MAYBEATSIGN =
e l s e
ifeq ( $( VERBOSE) ,1)
VERBVERBOSE = -q
MAYBEATSIGN =
else
VERBVERBOSE = -q
MAYBEATSIGN = @
endif
e n d i f
2013-04-16 23:57:21 -04:00
#CFLAG default options
WERROR = -Werror
2013-04-16 23:57:23 -04:00
WALL = -Wall -Wextra -Wcast-align -Wbad-function-cast
2013-04-16 23:57:21 -04:00
FORMAT = -Wmissing-format-attribute
VISIBILITY = -fvisibility= hidden
2007-08-09 13:35:23 +00:00
FPICFLAGS = -fPIC
2013-04-16 23:57:21 -04:00
SHADOW = -Wshadow
SYMBOLS = -g3 -ggdb3
PORTABILITY =
SKIP_WARNING =
COMBINE_C = -combine -c
LINK_FILES = -lz -lpthread
2013-04-16 23:57:21 -04:00
C99 = -std= c99
2013-04-16 23:57:21 -04:00
#Tools
VGRIND = valgrind --quiet --error-exitcode= 1 --leak-check= yes
i f e q ( $( CC ) , i c c )
#icc only:
2013-04-16 23:57:25 -04:00
OPTFLAGS = -O3 -ip
2013-04-16 23:57:21 -04:00
COMBINE_C = -ipo-c
FORMAT = #No argument for extra format warnings.
WALL = -Wall -Wcheck # '-Wextra' becomes '-Wcheck' in icc
SYMBOLS = -g -debug all -inline-debug-info
PORTABILITY = -diag-enable port-win
ifneq ( $( CYGWIN) ,)
#Cygwin
ICC_NOWARN = -Qdiag-disable:
else
#Linux
ICC_NOWARN = -diag-disable #Need the space
endif
SKIP_WARNING += $( ICC_NOWARN) 177 # Don't complain about static variables that are not used.
#SKIP_WARNING += $(ICC_NOWARN)188 # Don't complain about enumerated type mixed with another type.
SKIP_WARNING += $( ICC_NOWARN) 589 # Don't complain about goto into a block that skips initializing variables. GCC catches the actual uninitialized variables.
SKIP_WARNING += $( ICC_NOWARN) 869 # Don't complain about unused variables (since we defined __attribute__ to be nothing.)
SKIP_WARNING += $( ICC_NOWARN) 981 # Don't complain about "operands are evaluated in unspecified order". This seems to be generated whenever more than one argument to a function or operand is computed by function call.
SKIP_WARNING += $( ICC_NOWARN) 1324 # Don't complain about rdtsc clobbering its registers more than once.
2007-08-09 13:35:23 +00:00
e n d i f
2013-04-16 23:57:21 -04:00
i f n e q ( $( CYGWIN ) , )
#Cygwin (Windows) Must override some settings
CYG_ADD_LIBZ = /usr/lib/libz.a
VGRIND = #No Valgrind in cygwin
FPICFLAGS = #FPIC is default and not allowed as an option.
VISIBILITY = #Not supported
SHADOW = #Not supported
ifeq ( $( CC) ,icc)
#Cygwin icc only
C99 = -Qstd= c99
OPTFLAGS = -Ox -Qip -Qipo2
COMBINE_C = -Qipo-c
WERROR = -WX # Windows icc version of -Werror
SYMBOLS = -Zi -debug:all -Qinline-debug-info
PORTABILITY =
LINK_FILES = #Not supported
SKIP_WARNING += $( ICC_NOWARN) 1786 # Don't complain about 'read/write/other standards' being deprecated
else
#Cygwin gcc only
FORMAT = -Wno-format
endif
2013-04-16 23:57:19 -04:00
e n d i f
2013-04-16 23:57:21 -04:00
CFLAGS = $( WALL) $( WERROR) $( FORMAT) $( VISIBILITY) $( FPICFLAGS) $( SHADOW)
CFLAGS += $( OPTFLAGS) $( GCOV_FLAGS) $( PROF_FLAGS)
CFLAGS += $( SYMBOLS) $( SKIP_WARNING) $( C99)
LDFLAGS = $( OPTFLAGS) $( SYMBOLS) $( GCOV_FLAGS) $( PROF_FLAGS) $( LINK_FILES)
2013-04-16 23:57:20 -04:00
# Need XOPEN_SOURCE=600 to get strtoll()
CPPFLAGS += -D_FILE_OFFSET_BITS= 64 -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE= 600
2007-08-09 13:35:23 +00:00
2008-05-08 20:30:33 +00:00
# Add -Wconversion
2008-04-04 18:22:01 +00:00
2007-08-25 21:58:25 +00:00
i f d e f B R T _ F A N O U T
CPPFLAGS += -DBRT_FANOUT= $( BRT_FANOUT)
e n d i f
2013-04-16 23:57:20 -04:00
i f e q ( $( CIL ) , 1 )
CC = ../../cil/cil-1.3.6/bin/cilly --merge --keepmerged
e n d i f
2007-08-01 02:37:21 +00:00
# When debugging, try: valgrind --show-reachable=yes --leak-check=full ./brt-test
2008-05-08 20:30:33 +00:00
BINS = brtdump \
tdb_logprint \
# Intentionally left blank
2007-07-13 19:37:47 +00:00
2008-05-08 20:30:33 +00:00
build default : bins libs tdb -recover tdb_logprint $( TEST_OFILES )
cd tests; $( MAKE) build
2007-08-24 18:38:11 +00:00
2008-05-08 14:31:05 +00:00
BRT_SOURCES = \
2013-04-16 23:57:18 -04:00
block_allocator \
2008-07-09 12:00:26 +00:00
bread \
2008-05-08 14:31:05 +00:00
brt-serialize \
brt-verify \
brt \
cachetable \
fifo \
fingerprint \
key \
leafentry \
log \
log_code \
memory \
2008-07-11 22:00:06 +00:00
memarena \
2008-05-08 14:31:05 +00:00
mempool \
omt \
recover \
roll \
toku_assert \
ybt \
2008-07-27 22:16:49 +00:00
x1764 \
2008-07-24 21:23:40 +00:00
trace_mem \
2013-04-16 23:57:17 -04:00
threadpool \
2008-04-04 18:03:03 +00:00
# keep this line so I can ha vea \ on the previous line
2013-04-16 23:57:20 -04:00
i f e q ( $( CIL ) , 1 )
OFILES = $( patsubst %,%.o,$( BRT_SOURCES) )
e l s e
OFILES = newbrt.o
e n d i f
2008-05-08 20:30:33 +00:00
TEST_OFILES = brt-test-helpers.o
2008-04-04 18:03:03 +00:00
2008-05-08 14:31:05 +00:00
HFILES = $( wildcard *.h)
BRT_C_FILES = $( patsubst %,%.c,$( BRT_SOURCES) )
2013-04-16 23:57:20 -04:00
i f e q ( $( CIL ) , 1 )
2013-04-16 23:57:19 -04:00
e l s e
2008-05-08 14:31:05 +00:00
newbrt.o : $( BRT_C_FILES ) $( HFILES )
2013-04-16 23:57:21 -04:00
$( CC) $( COMBINE_C) $( CFLAGS) $( CPPFLAGS) $( BRT_C_FILES) -o $@
2013-04-16 23:57:19 -04:00
e n d i f
2013-04-16 23:57:19 -04:00
2008-05-08 07:16:26 +00:00
tdb_logprint.o : log -internal .h brttypes .h log .h kv -pair .h log_header .h
2013-04-16 23:57:20 -04:00
tdb_logprint : $( OFILES ) $( CYG_ADD_LIBZ )
2007-11-23 18:27:50 +00:00
2008-05-08 07:16:26 +00:00
recover.o : log_header .h log -internal .h log .h brttypes .h kv -pair .h memory .h key .h cachetable .h
2013-04-16 23:57:20 -04:00
tdb-recover : $( OFILES ) $( CYG_ADD_LIBZ )
2008-01-11 03:09:14 +00:00
2008-07-09 12:00:26 +00:00
roll.o : log_header .h log -internal .h log .h brttypes .h kv -pair .h memory .h key .h cachetable .h omt .h bread .h
2007-11-14 22:32:53 +00:00
2008-04-21 04:22:45 +00:00
log_code.o : log_header .h wbuf .h log -internal .h rbuf .h
2008-03-12 17:55:11 +00:00
log_header.h : log_code .c
@echo generated log_code.c so log_header.c was also generated
log_code.c : logformat
2007-11-22 07:13:08 +00:00
./logformat
2013-04-16 23:57:20 -04:00
libs : $( OFILES ) $( CYG_ADD_LIBZ )
2007-07-13 19:37:47 +00:00
bins : $( BINS )
2008-04-03 20:24:47 +00:00
# Put the benchmarktest_256 first since it takes the longest (and we want to use parallelism in the make)
2008-02-07 16:35:39 +00:00
2008-03-06 21:46:57 +00:00
# Put check_benchmarktest_256 first because it is long-running (and therefore on the critical path, so get it started)
2008-05-08 20:30:33 +00:00
check : bins
cd tests; $( MAKE) check
2007-07-13 19:37:47 +00:00
2007-08-25 21:58:25 +00:00
check-fanout :
let BRT_FANOUT = 4; \
while [ $$ BRT_FANOUT -le 16 ] ; do \
2008-08-18 19:53:39 +00:00
$( MAKE) clean; $( MAKE) check BRT_FANOUT = $$ BRT_FANOUT; \
2007-08-25 21:58:25 +00:00
let BRT_FANOUT = BRT_FANOUT+1; \
done
2013-04-16 23:57:23 -04:00
BRT_INTERNAL_H_INCLUDES = brt-internal.h cachetable.h fifo.h omt.h brt.h brt-search.h brttypes.h ybt.h log.h ../include/db.h kv-pair.h memory.h mempool.h leafentry.h log_header.h
2008-04-04 18:03:03 +00:00
brt-test-helpers.o : $( BRT_INTERNAL_H_INCLUDES ) toku_assert .h
2013-04-16 23:57:21 -04:00
logformat : logformat .c
2007-11-14 17:58:38 +00:00
brt-serialize-test.o : $( BRT_INTERNAL_H_INCLUDES )
2013-04-16 23:57:23 -04:00
$(OFILES) : $( BRT_INTERNAL_H_INCLUDES )
2008-05-08 14:31:05 +00:00
test_toku_malloc_plain_free : newbrt .o
2007-07-13 19:37:47 +00:00
2007-10-05 14:46:49 +00:00
cachetable-test.o : cachetable .h memory .h
2013-04-16 23:57:20 -04:00
cachetable-test : $( OFILES ) $( CYG_ADD_LIBZ )
2007-07-13 19:37:47 +00:00
2007-09-12 18:12:31 +00:00
cachetable-test2.o : cachetable .h memory .h
2013-04-16 23:57:20 -04:00
cachetable-test2 : $( OFILES ) $( CYG_ADD_LIBZ )
2007-09-12 18:12:31 +00:00
2008-05-08 14:31:05 +00:00
test-assert : newbrt .o
2008-01-17 19:35:12 +00:00
2013-04-16 23:57:20 -04:00
brtdump : $( OFILES ) $( CYG_ADD_LIBZ )
2008-01-18 16:01:25 +00:00
2008-05-08 14:31:05 +00:00
test_oexcl : test_oexcl .o newbrt .o
2008-02-08 03:17:38 +00:00
2007-12-06 20:52:23 +00:00
checko2 :
2008-05-07 00:46:02 +00:00
i f e q ( $( OPTFLAGS ) , - O 3 )
2007-12-06 20:52:23 +00:00
@echo OPTFLAGS = $( OPTFLAGS) ok
e l s e
@echo OPTFLAGS = $( OPTFLAGS) bad; exit 1
e n d i f
2008-05-12 10:58:07 +00:00
clean : clean -local clean -tests
clean-tests :
cd tests; $( MAKE) clean
clean-local :
2008-04-03 20:24:47 +00:00
rm -rf $( BINS) *.o *.bb *.bbg *.da *.gcov *.gcno *.gcda
2008-01-02 11:37:16 +00:00
rm -rf test_oexcl.c.tmp *.brt
2013-04-16 23:57:21 -04:00
rm -rf *.obj *.pdb *.ilk *.exe
2013-04-16 23:57:22 -04:00
rm -rf log_code.c log_header.h logformat
2007-07-13 19:37:47 +00:00
2008-01-22 19:30:02 +00:00
# After doing (cd ../src/tests;make test_log5.recover), run these. The files should have no differences.
testdump : brtdump
./brtdump ../src/tests/dir.test_log5.c.tdb.recover/foo.db > dump.r && ./brtdump ../src/tests/dir.test_log5.c.tdb/foo.db > dump.o && diff dump.o dump.r
2007-07-13 19:37:47 +00:00
TAGS : ../*/*.c ../*/*.h
etags ../*/*.c ../*/*.h
2013-04-16 23:57:20 -04:00
ofiles : $( OFILES )