adtoolsBuilder/Makefile

93 lines
3.7 KiB
Makefile

REPOSPATH ?= ./repos
REPO ?= walkero/adtoolsbuilder
TAG ?= adtools-build
WORKSPACE ?= -w /opt/adtools
NAME ?= adtools-build
VOLUMES ?= -v "${PWD}/native-gcc":/gcc
.PHONY: help build buildnc shell gcc6 gcc8 gcc10 gcc11 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 without"
@echo " using caching"
@echo "shell - Create a container with the latest Docker image and get into it."
@echo " Not suitable to compile adtools"
@echo "gcc6 - Create a container with the latest Docker image and get into it"
@echo " to compile adtools with GCC 6."
@echo "gcc8 - Create a container with the latest Docker image and get into it"
@echo " to compile adtools with GCC 8."
@echo "gcc10 - Create a container with the latest Docker image and get into it"
@echo " to compile adtools with GCC 10."
@echo "gcc11 - Create a container with the latest Docker image and get into it"
@echo " to compile adtools with GCC 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 ""
# TODO: Add a check for the execsg_private_sdk folder
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
gcc6:
docker run -it --rm --name $(NAME)-6 $(WORKSPACE) \
-v "${PWD}/native-gcc/6":/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 .env6 $(REPO):$(TAG) /bin/bash
gcc8:
docker run -it --rm --name $(NAME)-8 $(WORKSPACE) \
-v "${PWD}/native-gcc/8":/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 .env8 $(REPO):$(TAG) /bin/bash
gcc10:
docker run -it --rm --name $(NAME)-10 $(WORKSPACE) \
-v "${PWD}/native-gcc/10":/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 .env10 $(REPO):$(TAG) /bin/bash
gcc11:
docker run -it --rm --name $(NAME)-11 $(WORKSPACE) \
-v "${PWD}/native-gcc/11":/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 .env11 $(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)