<commit_before>export RUSTC = rustc
BUILDDIR = build
export RUSTFLAGS = -O -Z debug-info

POSTGRES_LIB = lib.rs
POSTGRES = $(BUILDDIR)/$(shell $(RUSTC) --crate-file-name $(POSTGRES_LIB))
POSTGRES_TEST = $(BUILDDIR)/$(shell $(RUSTC) --test --crate-file-name $(POSTGRES_LIB))
OPENSSL_DIR = submodules/rust-openssl
OPENSSL = $(OPENSSL_DIR)/$(shell $(MAKE) -s -C $(OPENSSL_DIR) print-target)
PHF_DIR = submodules/rust-phf
PHF = $(PHF_DIR)/$(shell $(MAKE) -s -C $(PHF_DIR) print-targets)

all: $(POSTGRES)

-include $(BUILDDIR)/postgres.d
-include $(BUILDDIR)/postgres_test.d

$(BUILDDIR):
	mkdir -p $@

$(BUILDDIR)/submodule-trigger: submodules/submodule-trigger | $(BUILDDIR)
	git submodule init
	git submodule update
	touch $@

$(OPENSSL): $(BUILDDIR)/submodule-trigger | $(BUILDDIR)
	$(MAKE) -C $(OPENSSL_DIR)

$(PHF): $(BUILDDIR)/submodule-trigger | $(BUILDDIR)
	$(MAKE) -C $(PHF_DIR)

$(POSTGRES): $(POSTGRES_LIB) $(OPENSSL) $(PHF) | $(BUILDDIR)
	$(RUSTC) $(RUSTFLAGS) --dep-info $(@D)/postgres.d --out-dir $(@D) \
		-L $(dir $(OPENSSL)) $(foreach file,$(PHF),-L $(dir $(file))) $<

$(POSTGRES_TEST): $(POSTGRES_LIB) $(OPENSSL) $(PHF) | $(BUILDDIR)
	$(RUSTC) $(RUSTFLAGS) --dep-info $(@D)/postgres_test.d --out-dir $(@D) \
		-L $(dir $(OPENSSL)) $(foreach file,$(PHF),-L $(dir $(file))) --test $<

check: $(POSTGRES_TEST)
	$<

clean:
	rm -rf $(BUILDDIR)

doc: $(OPENSSL) $(PHF)
	rustdoc -L $(dir $(OPENSSL)) $(foreach file,$(PHF),-L $(dir $(file))) \
		$(POSTGRES_LIB)

.PHONY: all check clean<commit_msg>Factor link args out in makefile<commit_after>export RUSTC = rustc
BUILDDIR = build
export RUSTFLAGS = -O -Z debug-info

POSTGRES_LIB = lib.rs
POSTGRES = $(BUILDDIR)/$(shell $(RUSTC) --crate-file-name $(POSTGRES_LIB))
POSTGRES_TEST = $(BUILDDIR)/$(shell $(RUSTC) --test --crate-file-name $(POSTGRES_LIB))
OPENSSL_DIR = submodules/rust-openssl
OPENSSL = $(OPENSSL_DIR)/$(shell $(MAKE) -s -C $(OPENSSL_DIR) print-target)
PHF_DIR = submodules/rust-phf
PHF = $(PHF_DIR)/$(shell $(MAKE) -s -C $(PHF_DIR) print-targets)
LINK_ARGS = -L $(dir $(OPENSSL)) $(foreach file,$(PHF),-L $(dir $(file)))

all: $(POSTGRES)

-include $(BUILDDIR)/postgres.d
-include $(BUILDDIR)/postgres_test.d

$(BUILDDIR):
	mkdir -p $@

$(BUILDDIR)/submodule-trigger: submodules/submodule-trigger | $(BUILDDIR)
	git submodule init
	git submodule update
	touch $@

$(OPENSSL): $(BUILDDIR)/submodule-trigger | $(BUILDDIR)
	$(MAKE) -C $(OPENSSL_DIR)

$(PHF): $(BUILDDIR)/submodule-trigger | $(BUILDDIR)
	$(MAKE) -C $(PHF_DIR)

$(POSTGRES): $(POSTGRES_LIB) $(OPENSSL) $(PHF) | $(BUILDDIR)
	$(RUSTC) $(RUSTFLAGS) --dep-info $(@D)/postgres.d --out-dir $(@D) \
		$(LINK_ARGS) $<

$(POSTGRES_TEST): $(POSTGRES_LIB) $(OPENSSL) $(PHF) | $(BUILDDIR)
	$(RUSTC) $(RUSTFLAGS) --dep-info $(@D)/postgres_test.d --out-dir $(@D) \
		$(LINK_ARGS) --test $<

check: $(POSTGRES_TEST)
	$<

clean:
	rm -rf $(BUILDDIR)

doc: $(OPENSSL) $(PHF)
	rustdoc $(LINK_ARGS) $(POSTGRES_LIB)

.PHONY: all check clean
{'fraction_non_alphanumeric': 0.21970209884901828, 'fraction_numerical': 0.0, 'mean_word_length': 4.8747514910536776, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, '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': '4947704', 'n_tokens_mistral': 1211, 'n_tokens_neox': 1247, 'n_words': 256}