summary refs log tree commit diff
path: root/release
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-03-12 19:47:43 +0000
committerAlyssa Ross <hi@alyssa.is>2023-03-12 19:47:43 +0000
commit4b67ce2d6571addfb6784bd461675da8deca954b (patch)
tree7fa1d6325335d8fe040cb6081a0afa1d004e3b84 /release
parente2ca1a7994adffea835b3e4f90ba1caf4f64f816 (diff)
downloadspectrum-4b67ce2d6571addfb6784bd461675da8deca954b.tar
spectrum-4b67ce2d6571addfb6784bd461675da8deca954b.tar.gz
spectrum-4b67ce2d6571addfb6784bd461675da8deca954b.tar.bz2
spectrum-4b67ce2d6571addfb6784bd461675da8deca954b.tar.lz
spectrum-4b67ce2d6571addfb6784bd461675da8deca954b.tar.xz
spectrum-4b67ce2d6571addfb6784bd461675da8deca954b.tar.zst
spectrum-4b67ce2d6571addfb6784bd461675da8deca954b.zip
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 <hi@alyssa.is>
Diffstat (limited to 'release')
-rw-r--r--release/live/Makefile10
-rw-r--r--release/live/default.nix8
2 files changed, 8 insertions, 10 deletions
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 <hi@alyssa.is>
+# SPDX-FileCopyrightText: 2021-2023 Alyssa Ross <hi@alyssa.is>
 
 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;