[Setup] Non Apple platforms #13

Merged
javier merged 14 commits from setup/linux-support into main 2023-04-28 17:37:09 +00:00
Showing only changes of commit 58a3fc9ff7 - Show all commits

51
Makefile Normal file
View File

@ -0,0 +1,51 @@
# --- IMPORTS ---
# Imports environment variables.
environment_vars ?= .env
include $(environment_vars)
export $(shell sed 's/=.*//' $(environment_vars))
# --- ARGUMENTS ---
override tag?=${DOCKER_IMAGE_TAG}
override platform?=${DOCKER_IMAGE_PLATFORM}
override config?=${SWIFT_BUILD_CONFIGURATION}
# --- BUILDING ---
build: build-image remove-image ## Build this package against a Swift docker instance.
build-image:
@docker run \
--rm \
--volume ${PWD}:${DOCKER_VOLUME_TARGET} \
--workdir ${DOCKER_VOLUME_TARGET} \
--platform ${platform} \
${DOCKER_IMAGE_NAME}:${tag} \
swift build --configuration ${config}
remove-image:
@docker rmi ${DOCKER_IMAGE_NAME}:${tag}
# --- HOUSEKEEPING ---
remove-images: ## Remove all outstanding Swift docker images.
@docker images --all | grep ${DOCKER_IMAGE_NAME} | awk '{print $$3}' | xargs docker rmi --force
clean: ## Clean the build artifacts for the package.
@swift package clean
reset: ## Reset the build folder for the package.
@swift package reset
# --- HELP ---
# Outputs 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)
.DEFAULT_GOAL := help