mas/Makefile

159 lines
3.4 KiB
Makefile
Raw Normal View History

2020-05-29 05:09:24 +00:00
#
# Makefile
# mas
#
################################################################################
#
# Variables
#
CMD_NAME = mas
SHELL = /bin/sh
2023-11-25 23:59:53 +00:00
PREFIX ?= $(shell brew --prefix)
2020-05-29 05:09:24 +00:00
SWIFT_VERSION = 5.7.1
2020-05-29 05:09:24 +00:00
# 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
2020-05-29 05:09:24 +00:00
EXECUTABLE_DIRECTORY = ./.build/${PLATFORM}/debug
endif
2022-07-04 23:29:28 +00:00
################################################################################
#
# Help
#
.DEFAULT_GOAL := help
.PHONY: help
help: MAKEFILE_FMT = " \033[36m%-25s\033[0m%s\n"
help: ## (default) Displays this message
2022-09-22 01:27:32 +00:00
@echo "mas Makefile"
2022-07-04 23:29:28 +00:00
@echo ""
@echo "Targets:"
@grep -E '^[a-zA-Z0-9_-]*:.*?##' ${MAKEFILE_LIST} | awk 'BEGIN {FS = ":.*?##"}; {printf ${MAKEFILE_FMT}, $$1, $$2}'
2022-07-04 23:29:28 +00:00
: # Hacky way to display a newline ##
2020-05-29 05:09:24 +00:00
################################################################################
#
# Info Targets
2020-05-29 05:09:24 +00:00
#
.PHONY: version
2022-07-04 23:29:28 +00:00
version: ## Prints versions of tools used by this Makefile.
2020-05-29 05:09:24 +00:00
xcodebuild -version
2021-03-20 15:58:29 +00:00
swiftenv version
2020-05-29 05:09:24 +00:00
swift --version
2021-05-07 18:39:13 +00:00
swift package tools-version
2020-05-29 05:09:24 +00:00
.PHONY: init
2022-07-04 23:29:28 +00:00
init: ## Installs tools.
- swiftenv install ${SWIFT_VERSION}
swiftenv local ${SWIFT_VERSION}
2020-05-29 05:09:24 +00:00
################################################################################
#
# 👢 Bootstrap
#
2020-05-29 05:09:24 +00:00
.PHONY: bootstrap
2022-07-04 23:29:28 +00:00
bootstrap: ## Installs tools.
script/bootstrap -f
.PHONY: bootstrap-update
bootstrap-update: ## Upgrades and installs tools.
2020-05-29 05:09:24 +00:00
script/bootstrap
################################################################################
#
# 👩🏻‍💻 Development Targets
#
2020-05-29 05:09:24 +00:00
.PHONY: clean
2022-07-04 23:29:28 +00:00
clean: ## Cleans built products.
2020-05-29 05:09:24 +00:00
script/clean
.PHONY: lint
lint: ## Lints source code.
script/lint
.PHONY: format
format: ## Formats source code.
script/format
2020-05-29 05:09:24 +00:00
.PHONY: build
2022-07-04 23:29:28 +00:00
build: ## Builds the project.
2020-05-29 05:09:24 +00:00
script/build
.PHONY: test
2022-07-04 23:29:28 +00:00
test: build ## Runs tests.
2020-05-29 05:09:24 +00:00
script/test
# make run ARGS="asdf"
.PHONY: run
run: build
${EXECUTABLE_DIRECTORY}/${CMD_NAME} ${ARGS}
2020-05-29 05:09:24 +00:00
2024-02-19 06:08:13 +00:00
.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
2020-05-29 05:09:24 +00:00
.PHONY: install
install: build ## Installs the binary.
script/install ${PREFIX}
2020-05-29 05:09:24 +00:00
2023-11-29 03:25:43 +00:00
.PHONY: install-universal
install-universal: build-universal ## Installs a universal binary.
script/install --universal
2020-05-29 05:09:24 +00:00
.PHONY: uninstall
uninstall: ## Uninstalls the binary.
2020-05-29 05:09:24 +00:00
script/uninstall
.PHONY: package
2022-07-04 23:29:28 +00:00
package: build ## Packages the project.
2020-05-29 05:09:24 +00:00
script/package
2024-02-19 06:16:30 +00:00
.PHONY: package-install
package-install: package ## Installs the package.
2020-05-29 05:09:24 +00:00
script/package_install
2024-02-19 06:31:03 +00:00
.PHONY: brew_release_validate
brew_release_validate: ## Validates Homebrew mas formula.
2024-02-19 06:31:03 +00:00
script/brew_release_validate