mas/Makefile
Ross Goldberg 9f9923ea57
Makefile: Mirror bash by using ${…} & $(…) for all variables & command substitutions, respectively.
Partial #638

Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
2024-11-15 13:19:06 -05:00

166 lines
3.5 KiB
Makefile
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#
# Makefile
# mas
#
################################################################################
#
# Variables
#
CMD_NAME = mas
SHELL = /bin/sh
PREFIX ?= $(shell brew --prefix)
SWIFT_VERSION = 5.7.1
# set EXECUTABLE_DIRECTORY according to your specific environment
# run swift build and see where the output executable is created
# OS specific differences
ifeq ($(shell uname), Darwin)
PLATFORM = $(shell uname -m)-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 "mas Makefile"
@echo ""
@echo "Targets:"
@grep -E '^[a-zA-Z0-9_-]*:.*?##' ${MAKEFILE_LIST} | awk 'BEGIN {FS = ":.*?##"}; {printf ${MAKEFILE_FMT}, $$1, $$2}'
: # Hacky way to display a newline ##
################################################################################
#
# Info Targets
#
.PHONY: version
version: ## Prints versions of tools used by this Makefile.
xcodebuild -version
swiftenv version
swift --version
swift package tools-version
.PHONY: init
init: ## Installs tools.
- swiftenv install ${SWIFT_VERSION}
swiftenv local ${SWIFT_VERSION}
################################################################################
#
# 👢 Bootstrap
#
.PHONY: bootstrap
bootstrap: ## Installs tools.
script/bootstrap -f
.PHONY: bootstrap-update
bootstrap-update: ## Upgrades and installs tools.
script/bootstrap
################################################################################
#
# 👩🏻‍💻 Development Targets
#
.PHONY: clean
clean: ## Cleans built products.
script/clean
.PHONY: lint
lint: ## Lints source code.
script/lint
.PHONY: format
format: ## Formats source code.
script/format
.PHONY: build
build: ## Builds the project.
script/build
.PHONY: test
test: build ## Runs tests.
script/test
# make run ARGS="asdf"
.PHONY: run
run: build
${EXECUTABLE_DIRECTORY}/${CMD_NAME} ${ARGS}
.PHONY: update-headers
update-headers: ## Updates private macOS headers.
script/update_headers
################################################################################
#
# 🕊️ Swift Package Targets
#
.PHONY: describe
describe: ## Describes the Swift package.
swift package describe
.PHONY: resolve
resolve: ## Resolves SwiftPM dependencies.
swift package resolve
.PHONY: dependencies
dependencies: resolve ## Lists SwiftPM dependencies.
swift package show-dependencies
.PHONY: update
update: resolve ## Updates SwiftPM dependencies.
swift package update
################################################################################
#
# 🚀 Release Targets
#
.PHONY: build-universal
build-universal: ## Builds a "fat" universal binary.
script/build --universal
.PHONY: install
install: build ## Installs the binary.
script/install ${PREFIX}
.PHONY: install-universal
install-universal: build-universal ## Installs a universal binary.
script/install --universal
.PHONY: uninstall
uninstall: ## Uninstalls the binary.
script/uninstall
.PHONY: package
package: build ## Packages the project.
script/package
.PHONY: package-install
package-install: package ## Installs the package.
script/package_install
.PHONY: bottle
bottle: ## Builds Homebrew bottles.
script/bottle
.PHONY: brew_formula_update
brew_formula_update: ## Updates homebrew-core formula.
script/brew_formula_update
.PHONY: brew_release_validate
brew_release_validate: ## Builds Homebrew bottle for the current system.
script/brew_release_validate