From e351e26e1fb36cd062aacfba531dd08497685f1e Mon Sep 17 00:00:00 2001 From: Jorge Luis Perez Date: Mon, 1 Apr 2024 10:55:31 -0300 Subject: [PATCH] Add building targets using Docker --- Makefile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Makefile b/Makefile index 22950ba..fe72c84 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,9 @@ SHELL := /bin/bash +WORKSPACE := $(shell pwd) +IMAGE := chip8-devcontainer +USER := $(shell id -u) +GROUP := $(shell id -g) + .PHONY: help clean lint format test doc build run bump build-windows help: @@ -37,6 +42,16 @@ build-windows: ## Build for Windows @cp target/x86_64-pc-windows-gnu/release/chip8-cli.exe build/windows/chip8.exe @cp target/x86_64-pc-windows-gnu/release/SDL2.dll build/windows +build-linux-with-docker: ## Build for Windows with Docker + @docker build . -f .devcontainer/Dockerfile -t $(IMAGE) + @docker run --rm -v $(WORKSPACE):/workspace -w /workspace $(IMAGE) make build + @docker run --rm -v $(WORKSPACE):/workspace -w /workspace $(IMAGE) chown -R $(USER):$(GROUP) build target + +build-windows-with-docker: ## Build for Windows with Docker + @docker build . -f .devcontainer/Dockerfile -t $(IMAGE) + @docker run --rm -v $(WORKSPACE):/workspace -w /workspace $(IMAGE) make build-windows + @docker run --rm -v $(WORKSPACE):/workspace -w /workspace $(IMAGE) chown -R $(USER):$(GROUP) build target + all: clean lint format test doc build ## Build bump: ## Bump version