-include ../src/make-helper-functions.mk
+include helper.mk
# Genereting the build dependencies for debian packages to be built requires
# the repos of those packages to be checked out. Always cloning them
-include ../src/make-helper-functions.mk
+include helper.mk
include $(GENERATED_DEPENDENCIES_FILE)
-UEXEC=../build/bin/uexec
+UEXEC = $(project_root)/build/bin/uexec
all: $(patsubst %,bin/$(BUILDER_PLATFORM)/$(DISTRO)/$(RELEASE)/%/.build,$(PACKAGES_TO_BUILD))
repo: $(addprefix repo//,$(PACKAGES_TO_BUILD))
build-env/$(DISTRO)/$(RELEASE)/rootfs: build-env/.dir | $(DEBOOTSTRAP_SCRIPT) $(UEXEC)
set -ex; \
mkdir -p "$@.tmp"; \
- exec 8>"$@.lock"; \
+ exec 8>".$@.lock"; \
flock 8; \
if [ -d "$@" ]; then exit 0; fi; \
uexec rm -rf "$@.tmp"; \
clean-repo: $(addprefix clean-repo//,$(PACKAGES_TO_BUILD))
update-repo: $(addprefix update-repo//,$(PACKAGES_TO_BUILD))
+buildenv: build-env/$(DISTRO)/$(RELEASE)/rootfs
+
clean-buildenv: | $(UEXEC)
uexec rm -rf "build-env/$(DISTRO)/$(RELEASE)"
rmdir "build-env/$(DISTRO)/" || true
+PLATFORM_AGNOSTIC_TARGETS += clean-fs-all clean-image-all
+
include src/make-helper-functions.mk
all: bin/$(IMAGE_NAME)
export PROMPT_COMMAND='if [ -z "$$PS_SET" ]; then PS_SET=1; PS1="(buildenv) $$PS1"; fi'; \
$(USER_SHELL)
-%/.dir:
- mkdir -p "$(dir $@)"
- touch "$@"
-
-build/$(IMAGE_NAME)/deb/%.deb: | build/$(IMAGE_NAME)/deb/.dir
+build/$(DISTRO)-$(RELEASE)/deb/%.deb: | build/$(DISTRO)-$(RELEASE)/deb/.dir
getdeb.sh "$@"
-$(DEBOOTSTRAP_SCRIPT): build/$(IMAGE_NAME)/deb/debootstrap.deb
+$(DEBOOTSTRAP_SCRIPT): build/$(DISTRO)-$(RELEASE)/deb/debootstrap.deb
set -ex; \
- exec 8>"build/.$(IMAGE_NAME).lock"; \
+ exec 8>"build/.debootstrap-$(DISTRO)-$(RELEASE).lock"; \
flock 8; \
if [ -e "$@" ]; then exit 0; fi; \
- rm -rf "build/$(IMAGE_NAME)/debootstrap_script/"; \
- mkdir -p "build/$(IMAGE_NAME)/debootstrap_script/"; \
- cd "build/$(IMAGE_NAME)/debootstrap_script/"; \
- ar x ../deb/debootstrap.deb; \
+ rm -rf "$$X_DEBOOTSTRAP_DIR"; \
+ mkdir -p "$$X_DEBOOTSTRAP_DIR"; \
+ debootstrap_deb="$$(realpath "build/$$DISTRO-$$RELEASE/deb/debootstrap.deb")"; \
+ cd "$$X_DEBOOTSTRAP_DIR"; \
+ ar x "$$debootstrap_deb"; \
tar xzf data.tar.*;
[ -e "$@" ]
touch "$@"
rmdir build/ 2>/dev/null || true
clean-build-all: clean-image-all clean-fs-all
- $(MAKE) -C platform clean-build
- $(MAKE) -C kernel clean-build
+ $(MAKE) -C platform clean-build-all
+ $(MAKE) -C kernel clean-build-all
$(MAKE) -C chroot-build-helper clean-build-all
rm -rf build/
include ../src/make-helper-functions.mk
-all repo update-repo clean-repo clean-build clean-build-all: force
+all repo update-repo clean-repo clean-build: force
make -C $(BUILDER_PLATFORM) $@
+clean-build-all: force
+ for BUILDER_PLATFORM in */; do $(MAKE) BUILDER_PLATFORM="$$BUILDER_PLATFORM" -C "$$BUILDER_PLATFORM" clean-build-all; done
+
%: always
make -C $(BUILDER_PLATFORM) $@
CONF = user_config_override
-ifndef TO
+X_DEBOOTSTRAP_DIR = $(project_root)/build/$(DISTRO)-$(RELEASE)/debootstrap_script/
+DEBOOTSTRAP_SCRIPT = $(X_DEBOOTSTRAP_DIR)/usr/share/debootstrap/scripts/$(RELEASE)
+
+PLATFORM_AGNOSTIC_TARGETS += config-set//% config-unset//% config-after-update//%
+PLATFORM_AGNOSTIC_TARGETS += mirror//% chroot//% %/.dir
+PLATFORM_AGNOSTIC_TARGETS += $(project_root)/build/$(DISTRO)-$(RELEASE)/%
+PLATFORM_AGNOSTIC_TARGETS += build/$(DISTRO)-$(RELEASE)/%
+PLATFORM_AGNOSTIC_TARGETS += $(project_root)/build/bin/%
+PLATFORM_AGNOSTIC_TARGETS += build/bin/%
+PLATFORM_AGNOSTIC_TARGETS += $(DEBOOTSTRAP_SCRIPT)
+PLATFORM_AGNOSTIC_TARGETS += config-list
+PLATFORM_AGNOSTIC_TARGETS += generate_make_build_dependencies_for_debs
+PLATFORM_AGNOSTIC_TARGETS += clean-build-all
+
+ifndef BUILDER_PLATFORM
+ifneq (,$(MAKECMDGOALS))
+ifeq (,$(filter-out $(PLATFORM_AGNOSTIC_TARGETS),$(MAKECMDGOALS)))
+BUILDER_PLATFORM=none
+endif
+endif
+endif
+
ifndef BUILDER_PLATFORM
KNOWN_BOARDS=$(shell basename -a "$(project_root)/config/default/"b-*/ | sed 's|^b-||')
$(error "$(newline)Please specify a board. Pass BOARD= to make, or set it in the config using `make config-set//BOARD TO=my-board`.$(newline)Availabe boards are: $(KNOWN_BOARDS)$(newline)")
endif
-endif
include $(project_root)/src/repositories.mk
export DEBIAN_FRONTEND=noninteractive
-ifndef TO
+ifneq ($(BUILDER_PLATFORM),none)
include $(project_root)/platform/$(BUILDER_PLATFORM)/platform.mk
endif
-export X_DEBOOTSTRAP_DIR = $(project_root)/build/$(IMAGE_NAME)/debootstrap_script/
-export DEBOOTSTRAP_SCRIPT = $(X_DEBOOTSTRAP_DIR)/usr/share/debootstrap/scripts/$(RELEASE)
+export X_DEBOOTSTRAP_DIR
+export DEBOOTSTRAP_SCRIPT
define repodir
repo/$(shell printf '%s\n' "$(repo-source@$(1))" | sed 's / ∕ g').git
config-unset//%:
V="$(patsubst config-unset//%,%,$@)"; \
sed -i "/^$$V[ ]*=/d" "$(project_root)/config/$(CONF)"
- @ $(MAKE) --no-print-directory OLD_VALUE="$($(patsubst config-unset//%,%,$@))" "config-after-update@$(patsubst config-unset//%,%,$@)"
+ @ $(MAKE) --no-print-directory OLD_VALUE="$($(patsubst config-unset//%,%,$@))" "config-after-update//$(patsubst config-unset//%,%,$@)"
clean-all: clean-repo clean-build
clean-all-all: clean-repo clean-build-all