From 4b67ce2d6571addfb6784bd461675da8deca954b Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sun, 12 Mar 2023 19:47:43 +0000 Subject: Build make targets directly into destinations Our image Makefiles are either used for interactive development in a nix-shell, or as part of a Nix build of Spectrum. In neither of these cases is the two step "make; make install" process useful like it is for packages, because one image from Spectrum somewhere on the development system isn't something it ever makes sense to do. By removing the separation between building and installing, and creating the final output directly in its destination, we can save some copies of very large files, which should save seconds in each build, even for the smaller components. Signed-off-by: Alyssa Ross --- release/live/Makefile | 10 ++++++---- release/live/default.nix | 8 ++------ 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'release') diff --git a/release/live/Makefile b/release/live/Makefile index 4eeeaa6..8dfba28 100644 --- a/release/live/Makefile +++ b/release/live/Makefile @@ -1,9 +1,11 @@ # SPDX-License-Identifier: EUPL-1.2+ -# SPDX-FileCopyrightText: 2021-2022 Alyssa Ross +# SPDX-FileCopyrightText: 2021-2023 Alyssa Ross include ../../lib/common.mk -build/live.img: ../../scripts/format-uuid.sh ../../scripts/make-gpt.sh build/boot.fat build/rootfs.verity.superblock build/rootfs.verity.roothash $(ROOT_FS) $(EXT_FS) +dest = build/live.img + +$(dest): ../../scripts/format-uuid.sh ../../scripts/make-gpt.sh build/boot.fat build/rootfs.verity.superblock build/rootfs.verity.roothash $(ROOT_FS) $(EXT_FS) ../../scripts/make-gpt.sh $@.tmp \ build/boot.fat:c12a7328-f81f-11d2-ba4b-00a0c93ec93b \ build/rootfs.verity.superblock:2c7357ed-ebd2-46d9-aec1-23d437ec2bf5:$$(../../scripts/format-uuid.sh "$$(dd if=build/rootfs.verity.roothash bs=32 skip=1 count=1 status=none)") \ @@ -47,7 +49,7 @@ clean: rm -rf build .PHONY: clean -run: build/live.img +run: $(dest) $(QEMU_KVM) -m 4G \ -cpu host \ -machine q35,kernel-irqchip=split \ @@ -57,5 +59,5 @@ run: build/live.img -device qemu-xhci \ -device usb-storage,drive=drive1,removable=true \ -drive file=$(OVMF_CODE),format=raw,if=pflash,readonly=true \ - -drive file=build/live.img,id=drive1,format=raw,if=none,readonly=true + -drive file=$(dest),id=drive1,format=raw,if=none,readonly=true .PHONY: run diff --git a/release/live/default.nix b/release/live/default.nix index 3ba399d..7ab7a22 100644 --- a/release/live/default.nix +++ b/release/live/default.nix @@ -35,13 +35,9 @@ stdenvNoCC.mkDerivation { SYSTEMD_BOOT_EFI = "${systemd}/lib/systemd/boot/efi/systemd-boot${efiArch}.efi"; EFINAME = "BOOT${toUpper efiArch}.EFI"; - buildFlags = [ "build/live.img" ]; + buildFlags = [ "dest=$(out)" ]; - installPhase = '' - runHook preInstall - mv build/live.img $out - runHook postInstall - ''; + dontInstall = true; enableParallelBuilding = true; -- cgit 1.4.1