<commit_before>ENABLE_FEATURES ?= default

DEPS_PATH = $(CURDIR)/tmp
BIN_PATH = $(CURDIR)/bin
GOROOT ?= $(DEPS_PATH)/go

.PHONY: all

all: format build test

dev:
	@export ENABLE_FEATURES=dev && make

build:
	cargo build --features ${ENABLE_FEATURES}

run:
	cargo run --features ${ENABLE_FEATURES}

release:
	cargo build --release --bin tikv-server

test:
	# Default Mac OSX `ulimit -n` is 256, too small. 
	ulimit -n 2000 && LOG_LEVEL=DEBUG RUST_BACKTRACE=1 cargo test --features ${ENABLE_FEATURES} -- --nocapture 

bench:
	# Default Mac OSX `ulimit -n` is 256, too small. 
	ulimit -n 4096 && LOG_LEVEL=ERROR RUST_BACKTRACE=1 cargo bench --features ${ENABLE_FEATURES} -- --nocapture 
	ulimit -n 4096 && RUST_BACKTRACE=1 cargo run --release --bin bench-tikv --features ${ENABLE_FEATURES}

format:
	@cargo fmt -- --write-mode diff | grep "Diff at line" > /dev/null && cargo fmt -- --write-mode overwrite | grep -v "found TODO" || exit 0
	@rustfmt --write-mode diff tests/tests.rs benches/benches.rs | grep "Diff at line" > /dev/null && rustfmt --write-mode overwrite tests/tests.rs benches/benches.rs | grep -v "found TODO" || exit 0

check_req:
	DEPS_PATH=$(DEPS_PATH) GOROOT=$(GOROOT) ./scripts/check_req.sh

rocksdb: 
	DEPS_PATH=$(DEPS_PATH) ./scripts/build_rocksdb.sh

$(BIN_PATH)/pd-server: 
	@DEPS_PATH=$(DEPS_PATH) BIN_PATH=$(BIN_PATH) PATH=$(PATH):$(GOROOT)/bin GOROOT=$(GOROOT) ./scripts/build_pd.sh

pd: $(BIN_PATH)/pd-server

$(BIN_PATH)/tidb-server: 
	@DEPS_PATH=$(DEPS_PATH) BIN_PATH=$(BIN_PATH) PATH=$(PATH):$(GOROOT)/bin GOROOT=$(GOROOT) ./scripts/build_tidb.sh

tidb: $(BIN_PATH)/tidb-server
<commit_msg>Make build release and copy to bin (#887)<commit_after>ENABLE_FEATURES ?= default

DEPS_PATH = $(CURDIR)/tmp
BIN_PATH = $(CURDIR)/bin
GOROOT ?= $(DEPS_PATH)/go

default: release

.PHONY: all

all: format build test

dev:
	@export ENABLE_FEATURES=dev && make all

build:
	cargo build --features ${ENABLE_FEATURES}

run:
	cargo run --features ${ENABLE_FEATURES}

release:
	cargo build --release --bin tikv-server
	@mkdir -p bin 
	cp -f ./target/release/tikv-server ./bin

test:
	# Default Mac OSX `ulimit -n` is 256, too small. 
	ulimit -n 2000 && LOG_LEVEL=DEBUG RUST_BACKTRACE=1 cargo test --features ${ENABLE_FEATURES} -- --nocapture 

bench:
	# Default Mac OSX `ulimit -n` is 256, too small. 
	ulimit -n 4096 && LOG_LEVEL=ERROR RUST_BACKTRACE=1 cargo bench --features ${ENABLE_FEATURES} -- --nocapture 
	ulimit -n 4096 && RUST_BACKTRACE=1 cargo run --release --bin bench-tikv --features ${ENABLE_FEATURES}

format:
	@cargo fmt -- --write-mode diff | grep "Diff at line" > /dev/null && cargo fmt -- --write-mode overwrite | grep -v "found TODO" || exit 0
	@rustfmt --write-mode diff tests/tests.rs benches/benches.rs | grep "Diff at line" > /dev/null && rustfmt --write-mode overwrite tests/tests.rs benches/benches.rs | grep -v "found TODO" || exit 0

check_req:
	DEPS_PATH=$(DEPS_PATH) GOROOT=$(GOROOT) ./scripts/check_req.sh

rocksdb: 
	DEPS_PATH=$(DEPS_PATH) ./scripts/build_rocksdb.sh

$(BIN_PATH)/pd-server: 
	@DEPS_PATH=$(DEPS_PATH) BIN_PATH=$(BIN_PATH) PATH=$(PATH):$(GOROOT)/bin GOROOT=$(GOROOT) ./scripts/build_pd.sh

pd: $(BIN_PATH)/pd-server

$(BIN_PATH)/tidb-server: 
	@DEPS_PATH=$(DEPS_PATH) BIN_PATH=$(BIN_PATH) PATH=$(PATH):$(GOROOT)/bin GOROOT=$(GOROOT) ./scripts/build_tidb.sh

tidb: $(BIN_PATH)/tidb-server

{'fraction_non_alphanumeric': 0.15720263000597728, 'fraction_numerical': 0.014644351464435146, 'mean_word_length': 4.2052877138413685, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1098046', 'n_tokens_mistral': 1338, 'n_tokens_neox': 1289, 'n_words': 315}