forked from edemirkan/rg35xx-batocera-toolchain
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
35 lines (28 loc) · 917 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
.PHONY: shell
.PHONY: clean
TOOLCHAIN_NAME=aveferrum/rg35xx-batocera-toolchain:v0.5
WORKSPACE_DIR := $(shell pwd)/workspace
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))
mkdir -p ./workspace
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
push:
$(info $(BOLD)Pushing $(TOOLCHAIN_NAME)...$(NORM))
docker push $(TOOLCHAIN_NAME)