🎯 Add help make target

This commit is contained in:
Ben Chatelain 2022-07-04 17:29:28 -06:00
parent f3ef215900
commit dc4b5f55e2

View file

@ -3,7 +3,6 @@
# mas
#
################################################################################
#
# Variables
@ -33,46 +32,60 @@ PLATFORM = $(ARCH)-apple-macosx
EXECUTABLE_DIRECTORY = ./.build/${PLATFORM}/debug
endif
################################################################################
#
# Help
#
.DEFAULT_GOAL := help
.PHONY: help
help: MAKEFILE_FMT = " \033[36m%-25s\033[0m%s\n"
help: ## (default) Displays this message
@echo "Ditto main Makefile."
@echo ""
@echo "Targets:"
@grep -E '^[a-zA-Z0-9_-]*:.*?##' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?##"}; {printf $(MAKEFILE_FMT), $$1, $$2}'
@echo ""
@echo "Parameters:"
@grep -E '^[A-Z0-9_-]* ?\?=.*?##' $(MAKEFILE_LIST) | awk 'BEGIN {FS = " ?\\?=.*?##"}; {printf $(MAKEFILE_FMT), $$1, $$2}'
: # Hacky way to display a newline ##
################################################################################
#
# Targets
#
# Prints versions of tools used by this Makefile.
.PHONY: version
version:
version: ## Prints versions of tools used by this Makefile.
xcodebuild -version
swiftenv version
swift --version
swift package tools-version
.PHONY: init
init:
init: ## Installs tools.
- swiftenv install $(SWIFT_VERSION)
swiftenv local $(SWIFT_VERSION)
.PHONY: bootstrap
bootstrap:
bootstrap: ## Installs tools.
script/bootstrap
.PHONY: clean
clean:
clean: ## Cleans built products.
script/clean
.PHONY: distclean
distclean: clean
.PHONY: updateHeaders
updateHeaders:
updateHeaders: ## Updates private headers.
script/update_headers
.PHONY: build
build:
build: ## Builds the project.
script/build
.PHONY: test
test: build
test: build ## Runs tests.
script/test
# make run ARGS="asdf"
@ -81,54 +94,53 @@ run: build
${EXECUTABLE_DIRECTORY}/${CMD_NAME} $(ARGS)
.PHONY: install
install:
install: ## Installs the project.
script/install $(PREFIX)
.PHONY: uninstall
uninstall:
uninstall: ## Uninstalls the project.
script/uninstall
.PHONY: format
format:
format: ## Formats source code.
script/format
.PHONY: lint
lint:
lint: ## Lints source code.
script/lint
.PHONY: danger
danger:
danger: ## Runs danger.
script/danger
# Builds bottles
.PHONY: bottles
bottles:
bottles: ## Builds bottles.
script/bottle
# Alias for bottles
.PHONY: bottle
bottle: bottles
bottle: bottles ## Alias for bottles
.PHONY: package
package: build
package: build ## Packages the project.
script/package
.PHONY: packageInstall
packageInstall: package
packageInstall: package ## Installs the package.
script/package_install
.PHONY: describe
describe:
describe: ## Describes the Swift package.
swift package describe
.PHONY: resolve
resolve:
resolve: ## Resolves SwiftPM dependencies.
swift package resolve
.PHONY: dependencies
dependencies: resolve
dependencies: resolve ## Lists SwiftPM dependencies.
swift package show-dependencies
.PHONY: update
update: resolve
update: resolve ## Updates SwiftPM dependencies.
swift package update