From: Anton Blanchard Date: Wed, 20 May 2020 05:01:42 +0000 (+1000) Subject: Add Makefile command line variables to enable docker and podman X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6326efaca421a0eb1e91cb70f9c7b324812c6dd0;p=microwatt.git Add Makefile command line variables to enable docker and podman Instead of having to edit the Makefile, we can now do: make DOCKER=1 make PODMAN=1 Signed-off-by: Anton Blanchard --- diff --git a/Makefile b/Makefile index cf8f14a..b9fe088 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,29 @@ -GHDL=ghdl +GHDL ?= ghdl GHDLFLAGS=--std=08 --work=unisim CFLAGS=-O2 -Wall # We need a version of GHDL built with either the LLVM or gcc backend. # Fedora provides this, but other distros may not. Another option is to use # the Docker image. -# -# Uncomment one of these to build with Docker or podman -#DOCKER=docker -DOCKER=podman -# -# Uncomment these lines to build with Docker/podman +DOCKER ?= 0 +PODMAN ?= 0 + +ifeq ($(DOCKER), 1) +DOCKERBIN=docker +USE_DOCKER=1 +endif + +ifeq ($(PODMAN), 1) +DOCKERBIN=podman +USE_DOCKER=1 +endif + +ifeq ($(USE_DOCKER), 1) PWD = $(shell pwd) DOCKERARGS = run --rm -v $(PWD):/src:z -w /src -GHDL = $(DOCKER) $(DOCKERARGS) ghdl/ghdl:buster-llvm-7 ghdl -CC = $(DOCKER) $(DOCKERARGS) ghdl/ghdl:buster-llvm-7 gcc +GHDL = $(DOCKERBIN) $(DOCKERARGS) ghdl/ghdl:buster-llvm-7 ghdl +CC = $(DOCKERBIN) $(DOCKERARGS) ghdl/ghdl:buster-llvm-7 gcc +endif all = core_tb icache_tb dcache_tb multiply_tb dmi_dtm_tb divider_tb \ rotator_tb countzero_tb wishbone_bram_tb soc_reset_tb diff --git a/README.md b/README.md index 98f2140..e11e56f 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ cd ../../../ appears not to). ghdl with the LLVM backend is likely easier to build. If building ghdl from scratch is too much for you, the microwatt Makefile - supports using Docker or podman images. Read through the Makefile for details. + supports using Docker or Podman. - Next build microwatt: @@ -45,6 +45,17 @@ cd ../../../ git clone https://github.com/antonblanchard/microwatt cd microwatt make +``` + + To build using Docker: +``` +make DOCKER=1 +``` + + and to build using Podman: + +``` +make PODMAN=1 ``` - Link in the micropython image: