<commit_before>UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
	IN_DOCKER := true
endif

ifneq ($(IN_DOCKER),)
	build_args := --build-arg BLDR_REPO=$(BLDR_REPO)
	run_args := -e BLDR_REPO=$(BLDR_REPO)
	ifneq (${http_proxy},)
		build_args := $(build_args) --build-arg http_proxy="${http_proxy}"
		run_args := $(run_args) -e http_proxy="${http_proxy}"
	endif
	ifneq (${https_proxy},)
		build_args := $(build_args) --build-arg https_proxy="${https_proxy}"
		run_args := $(run_args) -e https_proxy="${https_proxy}"
	endif

	dimage := habitat/devshell
	docker_cmd := env http_proxy= https_proxy= docker
	compose_cmd := env http_proxy= https_proxy= docker-compose
	common_run := $(compose_cmd) run --rm $(run_args)
	run := $(common_run) shell
	docs_host := ${DOCKER_HOST}
	docs_run := $(common_run) -p 9633:9633 shell
else
	run :=
	docs_host := 127.0.0.1
	docs_run :=
endif

.PHONY: help all shell serve-docs test unit functional clean image docs gpg
.DEFAULT_GOAL := all

all: image ## builds the project's Rust components
	$(run) sh -c 'cd components/hab && cargo build'
	$(run) sh -c 'cd components/sup && cargo build'
	$(run) sh -c 'cd components/depot && cargo build'

test: image ## tests the project's Rust components
	$(run) sh -c 'cd components/core && cargo test'
	$(run) sh -c 'cd components/depot-core && cargo test'
	$(run) sh -c 'cd components/depot-client && cargo test'
	$(run) sh -c 'cd components/sup && cargo test '
	$(run) sh -c 'cd components/depot && cargo test'

unit: image ## executes the components' unit test suites
	$(run) sh -c 'cd components/core && cargo test --lib'
	$(run) sh -c 'cd components/depot-core && cargo test --lib'
	$(run) sh -c 'cd components/depot-client && cargo test --lib'
	$(run) sh -c 'cd components/sup && cargo test --lib'
	$(run) sh -c 'cd components/depot && cargo test --lib'

functional: image ## executes the components' functional test suites
	$(run) sh -c 'cd components/sup && cargo test --test functional'
	$(run) sh -c 'cd components/depot && cargo test --test server'

clean: ## cleans up the project tree
	$(run) sh -c 'cd components/core && cargo clean'
	$(run) sh -c 'cd components/depot-core && cargo clean'
	$(run) sh -c 'cd components/depot-client && cargo clean'
	$(run) sh -c 'cd components/sup && cargo clean'
	$(run) sh -c 'cd components/depot && cargo clean'

help:
	@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

shell: image ## launches a development shell<commit_msg>Update Makefile `bin` as the default target & augment `all`.<commit_after>UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
	IN_DOCKER := true
endif

ifneq ($(IN_DOCKER),)
	build_args := --build-arg BLDR_REPO=$(BLDR_REPO)
	run_args := -e BLDR_REPO=$(BLDR_REPO)
	ifneq (${http_proxy},)
		build_args := $(build_args) --build-arg http_proxy="${http_proxy}"
		run_args := $(run_args) -e http_proxy="${http_proxy}"
	endif
	ifneq (${https_proxy},)
		build_args := $(build_args) --build-arg https_proxy="${https_proxy}"
		run_args := $(run_args) -e https_proxy="${https_proxy}"
	endif

	dimage := habitat/devshell
	docker_cmd := env http_proxy= https_proxy= docker
	compose_cmd := env http_proxy= https_proxy= docker-compose
	common_run := $(compose_cmd) run --rm $(run_args)
	run := $(common_run) shell
	docs_host := ${DOCKER_HOST}
	docs_run := $(common_run) -p 9633:9633 shell
else
	run :=
	docs_host := 127.0.0.1
	docs_run :=
endif

.PHONY: help all bin shell serve-docs test unit functional clean image docs gpg
.DEFAULT_GOAL := bin

bin: image ## builds the project's main binaries
	$(run) sh -c 'cd components/hab && cargo build'
	$(run) sh -c 'cd components/sup && cargo build'
	$(run) sh -c 'cd components/depot && cargo build'

all: image ## builds all the project's Rust components
	$(run) sh -c 'cd components/core && cargo build'
	$(run) sh -c 'cd components/depot-core && cargo build'
	$(run) sh -c 'cd components/depot-client && cargo build'
	$(run) sh -c 'cd components/common && cargo build'
	$(MAKE) bin

test: image ## tests the project's Rust components
	$(run) sh -c 'cd components/core && cargo test'
	$(run) sh -c 'cd components/depot-core && cargo test'
	$(run) sh -c 'cd components/depot-client && cargo test'
	$(run) sh -c 'cd components/sup && cargo test '
	$(run) sh -c 'cd components/depot && cargo test'

unit: image ## executes the components' unit test suites
	$(run) sh -c 'cd components/core && cargo test --lib'
	$(run) sh -c 'cd components/depot-core && cargo test --lib'
	$(run) sh -c 'cd components/depot-client && cargo test --lib'
	$(run) sh -c 'cd components/sup && cargo test --lib'
	$(run) sh -c 'cd components/depot && cargo test --lib'

functional: image ## executes the components' functional test suites
	$(run) sh -c 'cd components/sup && cargo test --test functional'
	$(run) sh -c 'cd components/depot && cargo test --test server'

clean: ## cleans up the project tree
	$(run) sh -c 'cd components/common && cargo clean'
	$(run) sh -c 'cd components/core && cargo clean'
	$(run) sh -c 'cd components/depot-client && cargo clean'
	$(run) sh -c 'cd components/depot-core && cargo clean'
	$(run) sh -c 'cd components/depot && cargo clean'
	$(run) sh -c 'cd components/hab && cargo clean'
	$(run) sh -c 'cd components/sup && cargo clean'

help:
	@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

shell: image ## launches a development shell
{'fraction_non_alphanumeric': 0.17205271709694892, 'fraction_numerical': 0.009749052175482938, 'mean_word_length': 4.115420129270545, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '3759017', 'n_tokens_mistral': 2044, 'n_tokens_neox': 1954, 'n_words': 644}