2022-12-05 12:55:44 +01:00
|
|
|
# If the first argument is "dump"...
|
|
|
|
ifeq (dump,$(firstword $(MAKECMDGOALS)))
|
|
|
|
# use the rest as arguments for "dump"
|
2022-12-05 12:58:58 +01:00
|
|
|
DUMP_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
|
2022-12-05 12:55:44 +01:00
|
|
|
# ...and turn them into do-nothing targets
|
2022-12-05 12:58:58 +01:00
|
|
|
$(eval $(DUMP_ARGS):;@:)
|
2022-12-05 12:55:44 +01:00
|
|
|
endif# If the first argument is "dump"...
|
|
|
|
|
2022-12-05 12:58:58 +01:00
|
|
|
# If the first argument is "dump"...
|
|
|
|
ifeq (test,$(firstword $(MAKECMDGOALS)))
|
|
|
|
# use the rest as arguments for "dump"
|
|
|
|
TEST_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
|
|
|
|
# ...and turn them into do-nothing targets
|
|
|
|
$(eval $(TEST_ARGS):;@:)
|
|
|
|
endif# If the first argument is "dump"...
|
2022-12-05 12:55:44 +01:00
|
|
|
|
|
|
|
.PHONY: help
|
|
|
|
|
|
|
|
help:
|
|
|
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
|
|
|
|
|
|
|
lint: ## lint code for formatting issues.
|
|
|
|
cargo fmt --all -- --check
|
|
|
|
cargo clippy
|
|
|
|
|
|
|
|
fix: ## fix linting problems.
|
|
|
|
cargo fmt
|
|
|
|
cargo clippy --fix --allow-dirty --allow-staged
|
|
|
|
|
|
|
|
dump: ## dump AST for given files.
|
2022-12-05 12:58:58 +01:00
|
|
|
cargo run --bin php-parser-rs -- $(DUMP_ARGS)
|
2022-12-05 12:55:44 +01:00
|
|
|
|
|
|
|
snapshot: ## dump a snapshot for intergration tests.
|
|
|
|
cargo run --bin snapshot
|
|
|
|
|
2022-12-05 12:58:58 +01:00
|
|
|
test: ## run integration tests.
|
2022-12-05 12:55:44 +01:00
|
|
|
BUILD_INTEGRATION_TESTS="1" cargo build
|
2022-12-05 12:58:58 +01:00
|
|
|
cargo test --all $(TEST_ARGS) -- --skip third_party
|
2022-12-05 12:55:44 +01:00
|
|
|
|
|
|
|
test-third-party: ## run integration tests against third-party libraries.
|
|
|
|
BUILD_INTEGRATION_TESTS="1" cargo build
|
|
|
|
cargo test third_party
|