mirror of
https://github.com/mas-cli/mas
synced 2024-11-21 19:23:01 +00:00
1acd684ab1
Partial #638 Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
158 lines
3.4 KiB
Makefile
158 lines
3.4 KiB
Makefile
#
|
||
# 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: brew_release_validate
|
||
brew_release_validate: ## Validates Homebrew mas formula.
|
||
script/brew_release_validate
|