forked from gsmecher/pyxsi
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.docker-boilerplate
27 lines (23 loc) · 1005 Bytes
/
Makefile.docker-boilerplate
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
.PHONY: $(MAKECMDGOALS) dockerenv
# Learn where the git repository lives, and what subdirectory we're working in.
REPO_ROOT := $(shell git rev-parse --show-toplevel)
REPO_SUBDIR := $(shell git rev-parse --show-prefix)
DOCKERSTAMP := $(REPO_ROOT)/.dockerenv-$(shell hostname)
DOCKERNAME := pyxsi-docker
# Use Docker to build the document per the rest of this Makefile.
$(MAKECMDGOALS) default: $(DOCKERSTAMP)
@echo Moving inside Docker...
@docker run \
-u $(shell id -u):$(shell id -g) \
-v $(REPO_ROOT):/root \
-v $(XILINX_VIVADO):$(XILINX_VIVADO) \
-v $(XILINX_HLS):$(XILINX_HLS) \
-v $(XILINX_VITIS):$(XILINX_VITIS) \
-e XILINX_VIVADO -e XILINX_HLS -e XILINX_VITIS \
$(DOCKERNAME) \
make -C /root/$(REPO_SUBDIR) $(MAKECMDGOALS)
# We need to re-build the Docker image anytime Dockerfile changes, or if we
# haven't done this before.
$(DOCKERSTAMP) dockerenv: $(REPO_ROOT)/Dockerfile
docker build -t $(DOCKERNAME) $(REPO_ROOT)
touch $(DOCKERSTAMP)