<commit_before># -*- Mode: Makefile -*-

.DEFAULT_GOAL=build
TOKUROOT=../
INCLUDEDIRS=-I$(TOKUROOT)newbrt -I../include -I./lock_tree -I./range_tree
DEPEND_COMPILE += \
	ydb-internal.h \
	$(TOKUROOT)include/db.h \
	$(TOKUROOT)newbrt/cachetable.h \
	$(TOKUROOT)newbrt/brt.h \
#End of line
include $(TOKUROOT)toku_include/Makefile.include
CPPFLAGS+=-D_GNU_SOURCE -D_THREAD_SAFE

ifneq ($(TOKUDB_REVISION),)
CPPFLAGS += -DTOKUDB_REVISION=$(TOKUDB_REVISION)
endif

YDB=ydb.$(AEXT)
YDB_BUNDLE=ydb.bundle
TYDB=tydb.$(AEXT)
TYDB_BUNDLE=tydb.bundle

IPO_YDB       = ipo_libtokudb.$(AEXT)
NOIPO_YDB     = static_libtokudb.$(AEXT)

LIBNAME=libtokudb

LIBRARY=$(LIBNAME).$(SOEXT)

LIBRARY_S=$(LIBNAME).$(AEXT)

OBJS_RAW = \
	ydb_lib \
	ydb \
	errors \
	dlmalloc \
	loader \
	indexer \
	indexer-undo-do \
	elocks \
#\end
#OBJS automatically defined.
loader.$(OEXT): $(LOG_HEADER)

LIBRARIES=

LIBRARIES+= \
	$(LIBRARY) \
	$(LIBRARY_S) \
#Purposely here for \ at end of prev

ifeq ($(OS_CHOICE),windows)
#Does not support parallel builds for files in src.
.NOTPARALLEL:;
#Do not build the dynamic libraries.
LIBRARIES=
ifeq ($(DEBUG),0)
WINYDB = $(IPO_YDB)
else
WINYDB = $(NOIPO_YDB)
endif
LIBRARIES += $(WINYDB)
libtokudb.pdb :  $(WINYDB);
endif

INSTALL_LIBRARIES= $(patsubst %,%.install,$(LIBRARIES))
ifeq ($(OS_CHOICE),windows)
    #INSTALL_LIBRARIES += libtokudb.pdb.install #Disabled dynamic libraries
endif


.PHONY:install_libs install.% build install local build_tests

#Half Build Half Install???
build: local build_tests ;

local: buildlocktrees libs install_libs ;

build_tests: | local
	cd tests && $(MAKE) build

install_libs: $(INSTALL_LIBRARIES)
%.install: %
	if ! diff $* ../lib/$* > /dev/null 2>&1; then cp $* ../lib/; fi

.PHONY: install
install: libs install_libs ;

.PHONY: local libs buildlocktrees
libs: $(LIBRARIES) ;
$(IPO_YDB) $(NOIPO_YDB) $(LIBRARIES): | export.def

#Generate export.def
#Take everything from export.map, add snprintf and vsnprintf, and then convert into export.def format.
export.def: export.map Makefile
	echo "EXPORTS" > $@
	cat export.map | sed 's/global:$$/global:\n   snprintf;\n   usleep;/' | sed -n "s/\([a-zA-Z_0-9][a-zA-Z_0-9]*\);/\t\1 @/g;/@/ P" |sort | sed -n 'P;=' | sed '{;N;s/\n//;}' >> $@
	echo "" >> $@

buildlocktrees: $(LOCKTREE) $(RANGETREE) ;

$(YDB):  $(OBJS) 


$(LIBRARY):  $(NEWBRT) $(YDB) $(LOCKTREE) $(RANGETREE) $(DEPEND_COMPILE) $(DEPEND_LINK) 

$(LIBRARY):  LINK_FILES=ydb_lib.$(OEXT) $(YDB) $(LOCKTREE) $(RANGETREE) $(NEWBRT)

#Skip all BDB tests for CYGWIN+ICC
ifeq ($(CYGWIN),)
$(LIBRARY_S):  $(patsubst %.$(AEXT),%.bundle, $(YDB) $(LOCKTREE) $(RANGETREE) $(NEWBRT) $(LIBPORTABILITY))
else ifneq ($(CC),icc)
$(LIBRARY_S):  $(YDB)  $(LOCKTREE) $(RANGETREE) $(NEWBRT) $(LIBPORTABILITY)
else
$(LIBRARY) $(LIBRARY_S):
	echo "Dynamic tokudb in windows is deprecated"
	test 1 = 0
#$(LIBRARY_S):  $(LIBRARY)  ;
#$(LIBRARY_S):  $(YDB)  $(LOCKTREE) $(RANGETREE) $(NEWBRT) $(LIBPORTABILITY)
#$(TLIBRARY_S): $(TYDB) $(LOCKTREE) $(RANGETREE) $(NEWBRT) $(LIBPORTABILITY)
endif

$(NOIPO_YDB): $(YDB) $(LOCKTREE) $(RANGETREE) $(NEWBRT)
	xilib /out:$@ $^

ipo_libtokudb.obj: $(YDB_BUNDLE) $(LOCKTREE_BUNDLE) $(RANGETREE_BUNDLE) $(NEWBRT_BUNDLE)
	$(CC) $(CFLAGS) $(CPPFLAGS) -Qipo-c $(filter %.$(OEXT),$^) $(patsubst %.bundle, %.bundle/*.$(OEXT), $(filter-out %.$(OEXT),$^))
	mv ipo_out.obj $@

$(IPO_YDB): ipo_libtokudb.obj
	xilib /out:$@ $^
<commit_msg>#3054 fix the ydb makefile deps refs[t:3054]<commit_after># -*- Mode: Makefile -*-

.DEFAULT_GOAL=build
TOKUROOT=../
INCLUDEDIRS=-I$(TOKUROOT)newbrt -I../include -I./lock_tree -I./range_tree
DEPEND_COMPILE += \
	ydb-internal.h \
	$(TOKUROOT)include/db.h \
	$(TOKUROOT)newbrt/cachetable.h \
	$(TOKUROOT)newbrt/brt.h \
#End of line
include $(TOKUROOT)toku_include/Makefile.include
CPPFLAGS+=-D_GNU_SOURCE -D_THREAD_SAFE

ifneq ($(TOKUDB_REVISION),)
CPPFLAGS += -DTOKUDB_REVISION=$(TOKUDB_REVISION)
endif

YDB=ydb.$(AEXT)
YDB_BUNDLE=ydb.bundle
TYDB=tydb.$(AEXT)
TYDB_BUNDLE=tydb.bundle

IPO_YDB       = ipo_libtokudb.$(AEXT)
NOIPO_YDB     = static_libtokudb.$(AEXT)

LIBNAME=libtokudb

LIBRARY=$(LIBNAME).$(SOEXT)

LIBRARY_S=$(LIBNAME).$(AEXT)

OBJS_RAW = \
	ydb_lib \
	ydb \
	errors \
	dlmalloc \
	loader \
	indexer \
	indexer-undo-do \
	elocks \
#\end
#OBJS automatically defined.
loader.$(OEXT): $(LOG_HEADER)
ydb.$(OEXT): $(LOG_HEADER)

LIBRARIES=

LIBRARIES+= \
	$(LIBRARY) \
	$(LIBRARY_S) \
#Purposely here for \ at end of prev

ifeq ($(OS_CHOICE),windows)
#Does not support parallel builds for files in src.
.NOTPARALLEL:;
#Do not build the dynamic libraries.
LIBRARIES=
ifeq ($(DEBUG),0)
WINYDB = $(IPO_YDB)
else
WINYDB = $(NOIPO_YDB)
endif
LIBRARIES += $(WINYDB)
libtokudb.pdb :  $(WINYDB);
endif

INSTALL_LIBRARIES= $(patsubst %,%.install,$(LIBRARIES))
ifeq ($(OS_CHOICE),windows)
    #INSTALL_LIBRARIES += libtokudb.pdb.install #Disabled dynamic libraries
endif


.PHONY:install_libs install.% build install local build_tests

#Half Build Half Install???
build: local build_tests ;

local: buildlocktrees libs install_libs ;

build_tests: | local
	cd tests && $(MAKE) build

install_libs: $(INSTALL_LIBRARIES)
%.install: %
	if ! diff $* ../lib/$* > /dev/null 2>&1; then cp $* ../lib/; fi

.PHONY: install
install: libs install_libs ;

.PHONY: local libs buildlocktrees
libs: $(LIBRARIES) ;
$(IPO_YDB) $(NOIPO_YDB) $(LIBRARIES): | export.def

#Generate export.def
#Take everything from export.map, add snprintf and vsnprintf, and then convert into export.def format.
export.def: export.map Makefile
	echo "EXPORTS" > $@
	cat export.map | sed 's/global:$$/global:\n   snprintf;\n   usleep;/' | sed -n "s/\([a-zA-Z_0-9][a-zA-Z_0-9]*\);/\t\1 @/g;/@/ P" |sort | sed -n 'P;=' | sed '{;N;s/\n//;}' >> $@
	echo "" >> $@

buildlocktrees: $(LOCKTREE) $(RANGETREE) ;

$(YDB):  $(OBJS) 


$(LIBRARY):  $(YDB) $(LOCKTREE) $(RANGETREE) $(NEWBRT) $(DEPEND_COMPILE) $(DEPEND_LINK) 

$(LIBRARY):  LINK_FILES=ydb_lib.$(OEXT) $(YDB) $(LOCKTREE) $(RANGETREE) $(NEWBRT)

#Skip all BDB tests for CYGWIN+ICC
ifeq ($(CYGWIN),)
$(LIBRARY_S):  $(patsubst %.$(AEXT),%.bundle, $(YDB) $(LOCKTREE) $(RANGETREE) $(NEWBRT) $(LIBPORTABILITY))
else ifneq ($(CC),icc)
$(LIBRARY_S):  $(YDB)  $(LOCKTREE) $(RANGETREE) $(NEWBRT) $(LIBPORTABILITY)
else
$(LIBRARY) $(LIBRARY_S):
	echo "Dynamic tokudb in windows is deprecated"
	test 1 = 0
#$(LIBRARY_S):  $(LIBRARY)  ;
#$(LIBRARY_S):  $(YDB)  $(LOCKTREE) $(RANGETREE) $(NEWBRT) $(LIBPORTABILITY)
#$(TLIBRARY_S): $(TYDB) $(LOCKTREE) $(RANGETREE) $(NEWBRT) $(LIBPORTABILITY)
endif

$(NOIPO_YDB): $(YDB) $(LOCKTREE) $(RANGETREE) $(NEWBRT)
	xilib /out:$@ $^

ipo_libtokudb.obj: $(YDB_BUNDLE) $(LOCKTREE_BUNDLE) $(RANGETREE_BUNDLE) $(NEWBRT_BUNDLE)
	$(CC) $(CFLAGS) $(CPPFLAGS) -Qipo-c $(filter %.$(OEXT),$^) $(patsubst %.bundle, %.bundle/*.$(OEXT), $(filter-out %.$(OEXT),$^))
	mv ipo_out.obj $@

$(IPO_YDB): ipo_libtokudb.obj
	xilib /out:$@ $^

{'fraction_non_alphanumeric': 0.19504373177842566, 'fraction_numerical': 0.004081632653061225, 'mean_word_length': 4.90447504302926, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7504735', 'n_tokens_mistral': 3081, 'n_tokens_neox': 2986, 'n_words': 598}