Commit d7ddfcac authored by Yoni Fogel's avatar Yoni Fogel

Port to OSX, removed extra dynamic libraries

range tree and locktree unit testing uses static linking now

git-svn-id: file:///svn/tokudb@2554 c7de825b-a66e-492c-adef-691d508d4ae1
parent 4bf1350f
......@@ -8,7 +8,8 @@ VISIBILITY = -fvisibility=hidden
OPTFLAGS = -O2
# GCOV_FLAGS = -fprofile-arcs -ftest-coverage
CFLAGS = -W -Wall -Werror -g3 -ggdb3 -fPIC $(OPTFLAGS) $(GCOV_FLAGS)
CFLAGS = -W -Wall -Wextra -Werror -g3 -ggdb3 -fPIC $(OPTFLAGS) $(GCOV_FLAGS)
CFLAGS += -Wbad-function-cast -Wcast-align -Waggregate-return
CPPFLAGS = -I../include -I../newbrt -I./lock_tree/ -I./range_tree/
CPPFLAGS += -D_GNU_SOURCE -D_THREAD_SAFE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
CFLAGS+= $(VISIBILITY)
......
# On OSX do:
# make OSX=OSX
LIBNAME_LINEAR = liblocktree_linear
LIBNAME_TLOG = liblocktree_tlog
LIBNAME_LOG = liblocktree_log
OPTFLAGS = -O2
ifneq ($(GCOV),)
......@@ -14,27 +10,23 @@ else
endif
VISIBILITY = -fvisibility=hidden
EXPORTMAP = -Wl,--version-script=export.map
CFLAGS = -W -Wall -Wextra -Werror -fPIC $(OPTFLAGS) -g3 -ggdb3 $(GCOV_FLAGS)
CFLAGS += -Wbad-function-cast -Wcast-align -Wconversion -Waggregate-return
CFLAGS += -Wmissing-noreturn -Wmissing-format-attribute
CFLAGS += $(VISIBILITY)
CPPFLAGS = -I. -I.. -I../range_tree -I../../include -I../../newbrt -L../range_tree
CPPFLAGS += -D_GNU_SOURCE -D_THREAD_SAFE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
ifneq ($(OSX),)
LIBEXT=dylib
SHARED=-dynamiclib
CFLAGS+=-fno-common
else
CFLAGS += $(VISIBILITY)
LIBEXT=so
SHARED=-shared $(EXPORTMAP)
endif
BINS=locktree.o rth.o lth.o
.PHONY: install logformat range_tree
install: range_tree $(LIBNAME_LINEAR).$(LIBEXT) $(LIBNAME_LINEAR).a #$(LIBNAME_TLOG).$(LIBEXT) $(LIBNAME_TLOG).a $(LIBNAME_LOG).$(LIBEXT) $(LIBNAME_LOG).a
install: range_tree $(BINS)
range_tree:
cd ../range_tree && make
......@@ -42,38 +34,13 @@ range_tree:
clean:
cd ../range_tree && make clean
rm -rf *.o
rm -rf $(LIBNAME_LINEAR).$(LIBEXT) $(LIBNAME_LINEAR).a
rm -rf $(LIBNAME_TLOG).$(LIBEXT) $(LIBNAME_TLOG).a
rm -rf $(LIBNAME_LOG).$(LIBEXT) $(LIBNAME_LOG).a
rm -rf *.gcno *.gcda *.gcov
cd tests && make clean
BINS = locktree.o rth.o lth.o
locktree.o: locktree.c locktree.h
gcc $(CFLAGS) $(CPPFLAGS) -DTOKU_LT_LINEAR -c $< -o $@
rth.o: rth.c rth.h
gcc $(CFLAGS) $(CPPFLAGS) -c $< -o $@
lth.o: lth.c lth.h
gcc $(CFLAGS) $(CPPFLAGS) -c $< -o $@
$(LIBNAME_LINEAR).$(LIBEXT): $(BINS)
cc $(CPPFLAGS) $^ $(SHARED) -o $@ $(CFLAGS) -lrangetree_linear
$(LIBNAME_LINEAR).a: $(BINS) ../range_tree/linear.o
$(AR) rv $@ $^
$(LIBNAME_TLOG).$(LIBEXT): $(BINS)
cc $(CPPFLAGS) $^ $(SHARED) -o $@ $(CFLAGS) -lrangetree_tlog
$(LIBNAME_TLOG).a: $(BINS) ../range_tree/tlog.o
$(AR) rv $@ $^
$(LIBNAME_LOG).$(LIBEXT): $(BINS)
cc $(CPPFLAGS) $^ $(SHARED) -o $@ $(CFLAGS) -lrangetree_log
$(LIBNAME_LOG).a: $(BINS) ../range_tree/log.o
$(AR) rv $@ $^
......@@ -7,23 +7,10 @@
# make VERBOSE=2
OPTFLAGS = -O0
ifneq ($(OSX),)
#Note: OSX 10.4 needs DYLD_LIBRARY_PATH. OSX 10.5 claims to support -rpath.
LIBEXT=dylib
VGRIND=
#CPPFLAGS = -Wl,-rpath,..,-rpath,../../range_tree
CPPFLAGS =
#Leopard does not appear to support -rpath fully.
SETENV=export DYLD_LIBRARY_PATH=..:../../range_tree ;
else
SETTOKUENV=
UNSETTOKUENV=
LIBEXT=so
CPPFLAGS = -Wl,-rpath,..,-rpath,../../range_tree
ifeq ($(OSX),)
VGRIND=valgrind --quiet --error-exitcode=1 --leak-check=yes
endif
LIBNAME=librt.$(LIBEXT)
ifeq ($(GCOV),GCOV)
GCOV_FLAGS = -fprofile-arcs -ftest-coverage
else
......@@ -33,7 +20,7 @@ CFLAGS = -W -Wall -Wextra -Werror $(OPTFLAGS) -g3 -ggdb3 $(GCOV_FLAGS)
CFLAGS += -Wbad-function-cast -Wcast-align -Waggregate-return
CFLAGS += -Wmissing-noreturn -Wmissing-format-attribute
CPPFLAGS += -L../ -L../../range_tree
CPPFLAGS += -I. -I../ -I../../range_tree -I../../../newbrt -I../../../include -lpthread
CPPFLAGS += -I. -I../ -I../../range_tree -I../../../newbrt -I../../../include
SRCS = $(wildcard *.c)
......@@ -100,12 +87,18 @@ endif
libs:
cd .. && make
RT_LINEAR_BINS = ../../range_tree/linear.o
RT_TLOG_BINS = ../../range_tree/tlog.o
RT_LOG_BINS = ../../range_tree/log.o
LT_BINS = ../locktree.o ../lth.o ../rth.o
%.lin: %.c ../locktree.h test.h
$(SETENV) cc -DDIR=\"dir.$<.lin\" -DTOKU_LT_LINEAR $(CPPFLAGS) $(CFLAGS) $< -lrangetree_linear -llocktree_linear -o $@
cc -DDIR=\"dir.$<.lin\" -DTOKU_LT_LINEAR $(CPPFLAGS) $(CFLAGS) $< -o $@ $(LT_BINS) $(RT_LINEAR_BINS)
%.tlog: %.c ../locktree.h test.h
$(SETENV) cc -DDIR=\"dir.$<.log\" -DTOKU_LT_TLOG $(CPPFLAGS) $(CFLAGS) $< -lrangetree_tlog -llocktree_tlog -o $@
cc -DDIR=\"dir.$<.log\" -DTOKU_LT_TLOG $(CPPFLAGS) $(CFLAGS) $< -o $@ $(LT_BINS) $(RT_TLOG_BINS)
%.log: %.c ../locktree.h test.h
$(SETENV) cc -DDIR=\"dir.$<.log\" -DTOKU_LT_LOG $(CPPFLAGS) $(CFLAGS) $< -lrangetree_log -llocktree_log -o $@
cc -DDIR=\"dir.$<.log\" -DTOKU_LT_LOG $(CPPFLAGS) $(CFLAGS) $< -o $@ $(LT_BINS) $(RT_LOG_BINS)
.PHONY: make_libs
......
# On OSX do:
# make OSX=OSX
LIBNAME_LINEAR = librangetree_linear
LIBNAME_TLOG = librangetree_tlog
LIBNAME_LOG = librangetree_log
OPTFLAGS = -O2
ifneq ($(GCOV),)
......@@ -14,38 +10,27 @@ else
endif
VISIBILITY = -fvisibility=hidden
EXPORTMAP = -Wl,--version-script=export.map
CFLAGS = -W -Wall -Wextra -Werror -fPIC $(OPTFLAGS) -g3 -ggdb3 $(GCOV_FLAGS)
CFLAGS = -W -Wall -Wextra -Werror -g3 -ggdb3 -fPIC $(OPTFLAGS) $(GCOV_FLAGS)
CFLAGS += -Wbad-function-cast -Wcast-align -Wconversion -Waggregate-return
CFLAGS += -Wmissing-noreturn -Wmissing-format-attribute
CPPFLAGS = -I../../include -I../../newbrt
CPPFLAGS += -D_GNU_SOURCE -D_THREAD_SAFE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
CFLAGS += $(VISIBILITY)
ifneq ($(OSX),)
LIBEXT=dylib
SHARED=-dynamiclib
CFLAGS+=-fno-common
else
CFLAGS += $(VISIBILITY)
LIBEXT=so
SHARED=-shared $(EXPORTMAP)
endif
.PHONY: install logformat
install: $(LIBNAME_LINEAR).$(LIBEXT) $(LIBNAME_LINEAR).a #$(LIBNAME_TLOG).$(LIBEXT) $(LIBNAME_TLOG).a $(LIBNAME_LOG).$(LIBEXT) $(LIBNAME_LOG).a
install: linear.o
clean:
rm -rf *.o *.gcno *.gcda *.gcov
rm -rf $(LIBNAME_LINEAR).$(LIBEXT) $(LIBNAME_LINEAR).a
rm -rf $(LIBNAME_TLOG).$(LIBEXT) $(LIBNAME_TLOG).a
rm -rf $(LIBNAME_LOG).$(LIBEXT) $(LIBNAME_LOG).a
cd tests && make clean
linear.o: linear.c rangetree.h
gcc $(CFLAGS) $(CPPFLAGS) -c $< -o $@
log.o: log.c rangetree.h
gcc $(CFLAGS) $(CPPFLAGS) -c $< -o $@
......@@ -53,20 +38,3 @@ log.o: log.c rangetree.h
tlog.o: tlog.c rangetree.h
gcc $(CFLAGS) $(CPPFLAGS) -c $< -o $@
$(LIBNAME_TLOG).$(LIBEXT): tlog.o
cc $(CPPFLAGS) $< $(SHARED) -o $@ $(CFLAGS)
$(LIBNAME_LOG).$(LIBEXT): log.o
cc $(CPPFLAGS) $< $(SHARED) -o $@ $(CFLAGS)
$(LIBNAME_LINEAR).$(LIBEXT): linear.o
cc $(CPPFLAGS) $< $(SHARED) -o $@ $(CFLAGS)
$(LIBNAME_TLOG).a: tlog.o
$(AR) rv $@ $<
$(LIBNAME_LOG).a: log.o
$(AR) rv $@ $<
$(LIBNAME_LINEAR).a: linear.o
$(AR) rv $@ $<
......@@ -6,28 +6,17 @@
# For very verbose output do
# make VERBOSE=2
ifneq ($(OSX),)
#Note: OSX 10.4 needs DYLD_LIBRARY_PATH. OSX 10.5 claims to support -rpath.
LIBEXT=dylib
VGRIND=
CPPFLAGS =
SETENV=export DYLD_LIBRARY_PATH=.. ;
else
SETTOKUENV=
UNSETTOKUENV=
LIBEXT=so
CPPFLAGS = -Wl,-rpath,..
ifeq ($(OSX),)
VGRIND=valgrind --quiet --error-exitcode=1 --leak-check=yes
endif
OPTFLAGS=-O0
LIBNAME=librt.$(LIBEXT)
# GCOV_FLAGS = -fprofile-arcs -ftest-coverage
CFLAGS = -W -Wall -Wextra -Werror $(OPTFLAGS) -g3 -ggdb3 $(GCOV_FLAGS)
CFLAGS += -Wbad-function-cast -Wcast-align -Wconversion -Waggregate-return
CFLAGS += -Wmissing-noreturn -Wmissing-format-attribute
CPPFLAGS += -L../ -I../ -I../../../newbrt -I../../../include -lpthread
CPPFLAGS += -I../ -I../../../newbrt -I../../../include
SRCS = $(wildcard *.c)
......@@ -84,21 +73,22 @@ endif
# The @ sign makes the make quiet. If there is an error there is enough info to tell what test failed.
%.linrun: %.lin
$(MAYBEATSIGN) $(SETENV) $(VGRIND) ./$< $(VERBVERBOSE)
$(MAYBEATSIGN) $(VGRIND) ./$< $(VERBVERBOSE)
%.logrun: %.log
$(MAYBEATSIGN) $(SETENV) $(VGRIND) ./$< $(VERBVERBOSE)
$(MAYBEATSIGN) $(VGRIND) ./$< $(VERBVERBOSE)
%.tlogrun: %.tlog
$(MAYBEATSIGN) $(SETENV) $(VGRIND) ./$< $(VERBVERBOSE)
$(MAYBEATSIGN) $(VGRIND) ./$< $(VERBVERBOSE)
libs:
cd .. && make
LINEAR_BINS = ../linear.o
TLOG_BINS = ../tlog.o
LOG_BINS = ../log.o
%.lin: %.c ../rangetree.h test.h
$(SETENV) cc -DDIR=\"dir.$<.lin\" $(CPPFLAGS) $(CFLAGS) $< -lrangetree_linear -o $@
%.log: %.c ../rangetree.h test.h
$(SETENV) cc -DDIR=\"dir.$<.log\" $(CPPFLAGS) $(CFLAGS) $< -lrangetree_log -o $@
cc -DDIR=\"dir.$<.lin\" $(CFLAGS) $(CPPFLAGS) $(CFLAGS) $< -o $@ $(LINEAR_BINS)
%.tlog: %.c ../rangetree.h test.h
$(SETENV) cc -DDIR=\"dir.$<.log\" $(CPPFLAGS) $(CFLAGS) $< -lrangetree_tlog -o $@
$(SETENV) cc -DDIR=\"dir.$<.log\" $(CPPFLAGS) $(CFLAGS) $< -o $@ $(TLOG_BINS)
%.log: %.c ../rangetree.h test.h
$(SETENV) cc -DDIR=\"dir.$<.log\" $(CPPFLAGS) $(CFLAGS) $< -o $@ $(LOG_BINS)
.PHONY: make_libs
......
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