adtoolsBuilder/Makefile

67 lines
2.5 KiB
Makefile

REPOSPATH ?= ./repos
REPO ?= walkero/adtoolsbuilder
TAG ?= adtools-build
WORKSPACE ?= -w /opt/adtools
NAME ?= adtools-build
VOLUMES ?= -v "${PWD}/native-gcc":/gcc
GCC ?= 8
.PHONY: help build buildnc shell compile clonerepos pullrepos clean
default: help
help:
@echo "This make file helps on building the Docker image and starting containers"
@echo "where adtools can get build."
@echo "The available parameters can be seen below:"
@echo ""
@echo "build - Build the Docker image"
@echo "buildnc - Pull the latest repos' code and build the Docker image"
@echo " without using caching"
@echo "shell - Create a container with the latest Docker image and get"
@echo " into it. Not suitable to compile adtools"
@echo "compile [GCC=x] - Create a container with the latest Docker image and get"
@echo " into it to compile adtools with GCC 8 (default) or the"
@echo " defined one by GCC argument. Possible values 6/8/9/10/11."
@echo "clonerepos - Clone the necessary repositories under repos folder."
@echo "pullrepos - Pull the latest code for the projects under repos folder."
@echo "clean - Remove the docker container, if this still exists."
@echo ""
@echo "Since the SDK 53.34 is used, there is a need of the latest ExecSG private SDK"
@echo "which should be placed manually under repos folder. So the path should be:"
@echo "repos/execsg_private_sdk/SDK/..."
@echo ""
build:
docker build -t $(REPO):$(TAG) \
--build-arg REPOS_PATH=$(REPOSPATH) .
buildnc: pullrepos
docker build --no-cache -t $(REPO):$(TAG) \
--build-arg REPOS_PATH=$(REPOSPATH) .
shell:
docker run -it --rm --name $(NAME) $(WORKSPACE) $(VOLUMES) $(REPO):$(TAG) /bin/bash
compile:
docker run -it --rm --name $(NAME)-$(GCC) $(WORKSPACE) \
-v "${PWD}/native-gcc/$(GCC)":/gcc \
-v "${PWD}/files/native-build/makefile-SDK53.34":/opt/adtools/native-build/makefile \
-v "${PWD}/files/gcc-build":/opt/adtools/gcc-build \
--env-file .env$(GCC) $(REPO):$(TAG) /bin/bash
clonerepos:
git clone https://github.com/sba1/adtools $(REPOSPATH)/adtools
git clone https://github.com/bminor/binutils-gdb $(REPOSPATH)/binutils-gdb
git clone https://github.com/coreutils/coreutils $(REPOSPATH)/coreutils
git clone https://github.com/coreutils/gnulib $(REPOSPATH)/gnulib
pullrepos:
git -C $(REPOSPATH)/adtools pull
git -C $(REPOSPATH)/binutils-gdb pull
git -C $(REPOSPATH)/coreutils pull
git -C $(REPOSPATH)/gnulib pull
clean:
-docker rm -f $(NAME)