2025-10-07 22:32:54 +00:00
|
|
|
## ===----------------------------------------------------------------------===
|
|
|
|
|
##
|
|
|
|
|
## This source file is part of the Amiibo Service open source project
|
|
|
|
|
##
|
2026-03-22 23:39:48 +00:00
|
|
|
## Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
2025-10-07 22:32:54 +00:00
|
|
|
## Licensed under Apache license v2.0
|
|
|
|
|
##
|
|
|
|
|
## See LICENSE for license information
|
|
|
|
|
## See CONTRIBUTORS for the list of Amiibo Service project authors
|
|
|
|
|
##
|
|
|
|
|
## SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
##
|
|
|
|
|
## ===----------------------------------------------------------------------===
|
2024-09-14 22:26:39 +00:00
|
|
|
|
2024-09-07 07:46:59 +00:00
|
|
|
# ENVIRONMENT VARIABLES
|
|
|
|
|
|
|
|
|
|
environment ?= .env
|
|
|
|
|
|
|
|
|
|
include $(environment)
|
|
|
|
|
export $(shell sed 's/=.*//' $(environment))
|
|
|
|
|
|
2025-09-10 19:47:45 +00:00
|
|
|
# LIBRARY
|
2024-09-07 07:46:59 +00:00
|
|
|
|
2025-09-18 15:03:07 +00:00
|
|
|
lib-build: ## Builds the library
|
2024-09-07 07:46:59 +00:00
|
|
|
@swift build
|
|
|
|
|
|
2025-09-18 15:03:07 +00:00
|
|
|
lib-release: ## Releases the library
|
|
|
|
|
@swift build -c release
|
|
|
|
|
|
|
|
|
|
lib-test: ## Runs the unit tests for the library
|
2025-09-10 19:47:45 +00:00
|
|
|
@swift test \
|
|
|
|
|
--disable-xctest \
|
|
|
|
|
--enable-code-coverage \
|
|
|
|
|
--enable-swift-testing \
|
|
|
|
|
--parallel
|
2024-09-07 07:46:59 +00:00
|
|
|
|
2025-09-10 19:47:45 +00:00
|
|
|
# SWIFT PACKAGE MANAGER
|
2024-09-07 07:46:59 +00:00
|
|
|
|
2025-09-10 19:47:45 +00:00
|
|
|
pkg-clean: ## Deletes built SPM artifacts of the package
|
|
|
|
|
@swift package clean
|
|
|
|
|
|
|
|
|
|
pkg-reset: ## Resets the complete SPM cache/build folder of the package
|
2024-09-07 07:46:59 +00:00
|
|
|
@swift package reset
|
|
|
|
|
|
2025-09-10 19:47:45 +00:00
|
|
|
pkg-pristine: pkg-clean pkg-reset ## Deletes all built artifacts, caches, and documentations of the package
|
2025-10-01 23:19:14 +00:00
|
|
|
@rm -drf $(DOCC_ARCHIVE_OUTPUT)
|
2025-09-10 19:47:45 +00:00
|
|
|
@rm -drf $(DOCC_GITHUB_OUTPUT)
|
|
|
|
|
|
|
|
|
|
pkg-outdated: ## Lists the SPM package dependencies that can be updated
|
|
|
|
|
@swift package update --dry-run
|
|
|
|
|
|
|
|
|
|
pkg-update: ## Updates the SPM package dependencies
|
2024-09-07 07:46:59 +00:00
|
|
|
@swift package update
|
2025-09-09 17:30:19 +00:00
|
|
|
|
|
|
|
|
# DOCUMENTATION
|
|
|
|
|
|
2025-10-01 23:19:14 +00:00
|
|
|
doc-generate: doc-generate-archive doc-generate-github ## Generates the library documentation for both Github and Xcode
|
|
|
|
|
|
|
|
|
|
doc-generate-archive: ## Generates the library documentation archive for Xcode
|
|
|
|
|
@swift package \
|
|
|
|
|
--allow-writing-to-directory $(DOCC_ARCHIVE_OUTPUT) \
|
|
|
|
|
generate-documentation \
|
|
|
|
|
--target $(SPM_LIBRARY_TARGET) \
|
|
|
|
|
--include-extended-types \
|
|
|
|
|
--enable-inherited-docs \
|
|
|
|
|
--output-path $(DOCC_ARCHIVE_OUTPUT)
|
2025-09-09 17:30:19 +00:00
|
|
|
|
|
|
|
|
doc-generate-github: ## Generates the library documentation for Github
|
|
|
|
|
@swift package \
|
|
|
|
|
--allow-writing-to-directory $(DOCC_GITHUB_OUTPUT) \
|
|
|
|
|
generate-documentation \
|
|
|
|
|
--target $(SPM_LIBRARY_TARGET) \
|
|
|
|
|
--disable-indexing \
|
|
|
|
|
--transform-for-static-hosting \
|
2025-10-01 23:19:14 +00:00
|
|
|
--include-extended-types \
|
|
|
|
|
--enable-inherited-docs \
|
2025-09-09 17:30:19 +00:00
|
|
|
--hosting-base-path $(DOCC_GITHUB_BASE_PATH) \
|
|
|
|
|
--output-path $(DOCC_GITHUB_OUTPUT)
|
|
|
|
|
|
|
|
|
|
doc-preview: ## Previews the library documentation in Safari
|
|
|
|
|
@open -a safari $(DOCC_PREVIEW_URL)
|
|
|
|
|
@swift package \
|
|
|
|
|
--disable-sandbox \
|
|
|
|
|
preview-documentation \
|
2025-10-01 23:19:14 +00:00
|
|
|
--target $(SPM_LIBRARY_TARGET) \
|
|
|
|
|
--include-extended-types \
|
|
|
|
|
--enable-inherited-docs
|
2025-09-09 17:30:19 +00:00
|
|
|
|
|
|
|
|
# IDE
|
|
|
|
|
|
2025-09-10 19:47:45 +00:00
|
|
|
ide-xcode: ## Opens this package with Xcode
|
2025-09-09 17:30:19 +00:00
|
|
|
@open -a Xcode Package.swift
|
|
|
|
|
|
2025-09-10 19:47:45 +00:00
|
|
|
ide-vscode: ## Opens this package with Visual Studio Code
|
2025-09-09 17:30:19 +00:00
|
|
|
@code .
|
2024-09-07 07:46:59 +00:00
|
|
|
|
|
|
|
|
# HELP
|
|
|
|
|
|
|
|
|
|
# Output the documentation for each of the defined tasks when `help` is called.
|
|
|
|
|
# Reference: https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
|
|
|
|
|
.PHONY: help
|
|
|
|
|
|
|
|
|
|
help: ## Prints the written documentation for all the defined tasks
|
|
|
|
|
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
|
|
|
|
|
2024-09-14 22:26:39 +00:00
|
|
|
.DEFAULT_GOAL := help
|