union-minui/toolchain/makefile
2023-04-14 22:21:55 +02:00

29 lines
780 B
Makefile

.PHONY: shell
.PHONY: clean
TOOLCHAIN_NAME=rg35xx-toolchain-new
WORKSPACE_DIR := $(shell cd .. && pwd)
CONTAINER_NAME=$(shell docker ps -f "ancestor=$(TOOLCHAIN_NAME)" --format "{{.Names}}")
BOLD=$(shell tput bold)
NORM=$(shell tput sgr0)
.build: Dockerfile
$(info $(BOLD)Building $(TOOLCHAIN_NAME)...$(NORM))
docker build -t $(TOOLCHAIN_NAME) .
touch .build
ifeq ($(CONTAINER_NAME),)
shell: .build
$(info $(BOLD)Starting $(TOOLCHAIN_NAME)...$(NORM))
docker run -it --rm -v "$(WORKSPACE_DIR)":/root/workspace $(TOOLCHAIN_NAME) /bin/bash
else
shell:
$(info $(BOLD)Connecting to running $(TOOLCHAIN_NAME)...$(NORM))
docker exec -it $(CONTAINER_NAME) /bin/bash
endif
clean:
$(info $(BOLD)Removing $(TOOLCHAIN_NAME)...$(NORM))
docker rmi $(TOOLCHAIN_NAME)
rm -f .build