From dcf8f7ba1c6c932b3cab208ee4b39a8f274d44e7 Mon Sep 17 00:00:00 2001
From: barracuda156 <vital.had@gmail.com>
Date: Sun, 2 Jul 2023 18:56:01 +0800
Subject: [PATCH 1/2] Simplify target for Darwin

--- src/GNUmakefile	2023-07-04 12:48:37.000000000 +0800
+++ src/GNUmakefile	2023-07-05 18:05:36.000000000 +0800
@@ -20,9 +20,9 @@
       install: $(UNAME_S)-sunw-$(UNAME_P)-install
 	@echo "To use Hoard, execute this command: export LD_PRELOAD=$(DESTDIR)$(PREFIX)/libhoard.so"
     else
-      $(UNAME_S)-gcc-$(UNAME_P): Heap-Layers
-      all: Heap-Layers $(UNAME_S)-gcc-$(UNAME_P)
-      install: $(UNAME_S)-gcc-$(UNAME_P)-install
+      $(UNAME_S): Heap-Layers
+      all: Heap-Layers $(UNAME_S)
+      install: $(UNAME_S)-install
         ifeq ($(UNAME_S),Darwin)
 	  @echo "To use Hoard, execute this command: export DYLD_INSERT_LIBRARIES=$(DESTDIR)$(PREFIX)/libhoard.dylib"
         else
@@ -56,9 +56,7 @@
 	@echo Linux-gcc-aarch64
 	@echo Linux-gcc-x86
 	@echo Linux-gcc-x86_64
-	@echo Darwin-gcc-i386
-	@echo Darwin-gcc-arm
-	@echo Darwin-gcc-powerpc
+	@echo Darwin
 	@echo SunOS-sunw-sparc
 	@echo SunOS-sunw-i386
 	@echo SunOS-gcc-sparc
@@ -67,7 +65,7 @@
 	@echo generic-gcc
 	@echo windows
 
-.PHONY: Darwin-gcc-i386 Darwin-gcc-arm Darwin-gcc-powerpc debian freebsd netbsd Linux-gcc-x86 Linux-gcc-x86-debug SunOS-sunw-sparc SunOS-sunw-i386 SunOS-gcc-sparc generic-gcc Linux-gcc-arm Linux-gcc-aarch64 Linux-gcc-x86_64 Linux-gcc-unknown windows windows-debug clean test release
+.PHONY: Darwin debian freebsd netbsd Linux-gcc-x86 Linux-gcc-x86-debug SunOS-sunw-sparc SunOS-sunw-i386 SunOS-gcc-sparc generic-gcc Linux-gcc-arm Linux-gcc-aarch64 Linux-gcc-x86_64 Linux-gcc-unknown windows windows-debug clean test release
 
 #
 # Source files
@@ -111,7 +109,7 @@
 DEBIAN_COMPILE = $(CXX) -g -O3 -fPIC -DNDEBUG -I. -Iinclude -Iinclude/util -Iinclude/hoard -Iinclude/superblocks -IHeap-Layers -D_REENTRANT=1 -shared source/libhoard.cpp source/unixtls.cpp Heap-Layers/wrappers/wrapper.cpp -Bsymbolic -o libhoard.so -lpthread -lstdc++ -ldl
 
 # -ftls-model=local-dynamic
-MACOS_COMPILE = $(CXX) -ftls-model=initial-exec -ftemplate-depth=1024 -arch x86_64 -arch arm64 -pipe -g $(CPPFLAGS) $(INCLUDES) -D_REENTRANT=1 -compatibility_version 1 -current_version 1 -D'CUSTOM_PREFIX(x)=xx\#\#x' $(MACOS_SRC) -dynamiclib -install_name $(DESTDIR)$(PREFIX)/libhoard.dylib -o libhoard.dylib -ldl -lpthread
+MACOS_COMPILE = $(CXX) -ftls-model=initial-exec -ftemplate-depth=1024 @ARCHFLAGS@ -pipe -g $(CPPFLAGS) $(INCLUDES) -D_REENTRANT=1 -compatibility_version 1 -current_version 1 -D'CUSTOM_PREFIX(x)=xx\#\#x' $(MACOS_SRC) -dynamiclib -install_name $(DESTDIR)$(PREFIX)/libhoard.dylib -o libhoard.dylib -ldl -lpthread
 
 MACOS_COMPILE_DEBUG = $(CXX) -std=c++14 -D_FORTIFY_SOURCE=2 -fstack-protector -ftrapv -fno-builtin-malloc -ftemplate-depth=1024 -arch x86_64 -arch arm64 -pipe -g -O0 -Wall $(INCLUDES) -D_REENTRANT=1 -compatibility_version 1 -current_version 1 -D'CUSTOM_PREFIX(x)=xx\#\#x' $(MACOS_SRC) -dynamiclib -o libhoard.dylib -ldl -lpthread
 
@@ -177,22 +175,10 @@
 	cl /analyze /analyze:stacksize131072 $(WIN_INCLUDES) $(WIN_DEBUG_DEFINES) $(WIN_DEBUG_FLAGS) "source\libhoard.cpp" "Heap-Layers\wrappers\winwrapper.cpp" "source\wintls.cpp" /GL /link /DLL /subsystem:console /OUT:libhoard.dll
 	cl $(WIN_INCLUDES) $(WIN_DEBUG_DEFINES) $(WIN_DEBUG_FLAGS) /c "source\uselibhoard.cpp"
 
-Darwin-gcc-i386:
+Darwin:
 	$(MACOS_COMPILE)
 
-Darwin-gcc-i386-install: Darwin-gcc-i386
-	cp libhoard.dylib $(DESTDIR)$(PREFIX)
-
-Darwin-gcc-arm:
-	$(MACOS_COMPILE)
-
-Darwin-gcc-arm-install: Darwin-gcc-arm
-	cp libhoard.dylib $(DESTDIR)$(PREFIX)
-
-Darwin-gcc-powerpc:
-	$(MACOS_COMPILE_PPC)
-
-Darwin-gcc-powerpc-install: Darwin-gcc-powerpc
+Darwin-install: Darwin
 	cp libhoard.dylib $(DESTDIR)$(PREFIX)
 
 generic-gcc: