forked from s0ckz/trimui-smart-pro-toolchain
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
34 lines (29 loc) · 848 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
.PHONY: shell
.PHONY: clean
TOOLCHAIN_NAME=trimui-smart-pro-toolchain
WORKSPACE_DIR := $(shell pwd)/workspace
WORKSPACE_VOLUME := /home/toolchain/workspace
TOOL=
DOCKER := $(shell command -v docker 2> /dev/null)
PODMAN := $(shell command -v podman 2> /dev/null)
.check:
ifdef DOCKER
TOOL=docker
else ifdef PODMAN
TOOL=podman
else
$(error "Docker or Podman must be installed!")
endif
.build: .check Dockerfile
mkdir -p ./workspace
$(TOOL) build -t $(TOOLCHAIN_NAME) .
touch .build
shell: .check .build
ifdef PODMAN
$(TOOL) run -it --rm -v /"$(WORKSPACE_DIR)":"$(WORKSPACE_VOLUME)":z $(TOOLCHAIN_NAME) bash
else
$(TOOL) run -it --rm --name="$(TOOLCHAIN_NAME)" -v /"$(WORKSPACE_DIR)":"$(WORKSPACE_VOLUME)" $(TOOLCHAIN_NAME) bash
endif
clean: .check
$(TOOL) rmi $(TOOLCHAIN_NAME)
rm -f .build