From: Amelia Coutard <eliottulio.coutard@gmail.com>
Date: Mon, 27 Feb 2023 00:39:56 +0000 (+0100)
Subject: Edited Makefile a bit to make it cleaner
X-Git-Url: https://git.ameliathe1st.gay/?a=commitdiff_plain;h=e88462459cd1f3fb51cedefdce0fc30b79d15f5e;p=voyage-au-centre-des-fichiers.git

Edited Makefile a bit to make it cleaner
---

diff --git a/Makefile b/Makefile
index 4501196..12e0e94 100644
--- a/Makefile
+++ b/Makefile
@@ -16,8 +16,8 @@ CXXFLAGS := $(CXXFLAGS) -Wall -Wextra -Werror -std=c++20 \
 LDFLAGS ?= -O2
 LDFLAGS := $(LDFLAGS) -Wall -Wextra -Werror -std=c++20 -ffreestanding
 
-TO_ISO :=
-TO_CLEAN :=
+TO_ISO := isodir/boot/grub/grub.cfg
+TO_CLEAN := isodir amycros.iso
 
 include **/module.mk
 
@@ -25,9 +25,11 @@ build: amycros.iso
 qemu: build
 	qemu-system-x86_64 -cdrom amycros.iso -serial stdio -cpu qemu64,pdpe1gb -no-reboot $(QEMUFLAGS)
 clean:
-	-rm -rf $(TO_CLEAN) isodir amycros.iso
+	-rm -rf $(TO_CLEAN)
 
-amycros.iso: $(TO_ISO) grub.cfg
-	mkdir -p isodir/boot/grub
-	install -m 644 grub.cfg isodir/boot/grub/grub.cfg
+amycros.iso: $(TO_ISO)
 	grub-mkrescue -o "$@" isodir
+
+isodir/boot/grub/grub.cfg: grub.cfg
+	mkdir -p "$(@D)"
+	install -m 644 "$<" "$@"