Makefile improved a lot

This commit is contained in:
Bruce Leidl 2018-02-05 11:17:22 -05:00
parent 55458be1c3
commit a624f3dc91
2 changed files with 25 additions and 9 deletions

View File

@ -1,17 +1,29 @@
.PHONY: docker-image docker-shell .PHONY: help docker-image docker-shell citadel-image citadel-kernel user-rootfs
BASE_DIR = $(shell pwd) BASE_DIR = $(shell pwd)
BASE_BINDMOUNT = type=bind,source=$(BASE_DIR),target=/home/builder/citadel BASE_BINDMOUNT = type=bind,source=$(BASE_DIR),target=/home/builder/citadel
DOCKER_RUN = docker run -it --mount $(BASE_BINDMOUNT) citadel-builder
DOCKER_RUN_PRIV = docker run -it --privileged --mount $(BASE_BINDMOUNT) citadel-builder
all: docker-image docker-shell #
# https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
#
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
docker-image: docker-image: ## Create docker builder image. You need to run this one time before running anything else.
docker build -t citadel-builder scripts/docker docker build -t citadel-builder scripts/docker
docker-shell: docker-shell: ## Open an interactive shell in the docker build container configured for running bitbake commands.
docker run -it --mount $(BASE_BINDMOUNT) citadel-builder $(DOCKER_RUN)
user-rootfs: citadel-image: ## Build citadel-image with bitbake
$(DOCKER_RUN) bash -c "source setup-build-env && bitbake citadel-image"
citadel-kernel: ## Build citadel-kernel with bitbake
$(DOCKER_RUN) bash -c "source setup-build-env && bitbake citadel-kernel"
user-rootfs: ## Build user-rootfs tarball with debootstrap and configuration scripts
mkdir -p build/debootstrap mkdir -p build/debootstrap
docker run -it --privileged --mount $(BASE_BINDMOUNT) citadel-builder sudo scripts/build-user-rootfs-stage-one | tee build/debootstrap/build-user-rootfs.log $(DOCKER_RUN_PRIV) sudo scripts/build-user-rootfs-stage-one | tee build/debootstrap/build-user-rootfs.log

View File

@ -35,6 +35,10 @@ Docker will realize that the Dockerfile has not changed and do nothing.
$ make docker-image $ make docker-image
To list available make targets, run `make help` or just `make` as this is the default target:
$ make help
To run a shell inside the docker build container: To run a shell inside the docker build container:
$ make docker-shell $ make docker-shell
@ -43,7 +47,7 @@ The shell will run in the build directory and be configured to run build command
To build a full citadel image: To build a full citadel image:
$ bitbake citadel-image $ make citadel-image
The build will take several hours the first time, but for later builds the build system will use cached artifacts stored The build will take several hours the first time, but for later builds the build system will use cached artifacts stored
in `citadel/build/sstate-cache` for components that have not changed and new builds will usually only take a few minutes. in `citadel/build/sstate-cache` for components that have not changed and new builds will usually only take a few minutes.