From 20fff1a0ee436a4d8c31b65f41f12047113fc300 Mon Sep 17 00:00:00 2001
From: Will Angenent <will.angenent@gmail.com>
Date: Fri, 24 Mar 2023 19:19:33 +0000
Subject: [PATCH] Adapted Makefile to work with gentoo and MacOS

---
 Makefile | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 0e233fd..2222269 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,20 @@
+UNAME := $(shell uname)
+
+ifeq ($(UNAME),Darwin)
+	FUMOUNT=umount
+else ifeq ($(UNAME),FreeBSD)
+	FUMOUNT=sudo umount
+else
+	# Detect which version of the fusermount binary is available.
+	ifneq (, $(shell which fusermount3))
+		FUMOUNT=fusermount3 -u
+	else
+		FUMOUNT=fusermount -u
+	endif
+endif
+
 image.bin:
-	dd if=/dev/zero of=image.bin bs=1M count=1024
+	dd if=/dev/zero of=image.bin bs=1048576 count=1024
 	cargo build --release --bin redoxfs-mkfs
 	target/release/redoxfs-mkfs image.bin
 
@@ -10,12 +25,12 @@ mount: image.bin FORCE
 
 unmount: FORCE
 	sync
-	-fusermount -u image
+	-${FUMOUNT} image
 	rm -rf image
 
 clean: FORCE
 	sync
-	-fusermount -u image
+	-${FUMOUNT} image
 	rm -rf image image.bin
 	cargo clean
 
-- 
GitLab