From 7d23b4886018299ea53abf65031a31652d527a28 Mon Sep 17 00:00:00 2001 From: timmoth Date: Sun, 29 Sep 2024 18:45:58 +0100 Subject: [PATCH] Updated makefile (bench 8431417) --- Makefile | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 77a7232..c54deb7 100644 --- a/Makefile +++ b/Makefile @@ -4,12 +4,10 @@ ifndef EXE EXE = Sapling endif -ifndef CC - CC = dotnet -endif - ifeq ($(OS),Windows_NT) - ifeq ($(PROCESSOR_ARCHITEW6432),AMD64) + ifeq ($(PROCESSOR_ARCHITECTURE),AMD64) + RUNTIME=win-x64 + else ifeq ($(PROCESSOR_ARCHITEW6432),AMD64) RUNTIME=win-x64 else RUNTIME=win-x86 @@ -26,17 +24,24 @@ else else ifneq ($(filter arm%,$(UNAME_P)),) RUNTIME=linux-arm endif - else ifneq ($(filter arm%,$(UNAME_P)),) - RUNTIME=osx-arm64 - else - RUNTIME=osx-x64 + else ifeq ($(UNAME_S),Darwin) + ifneq ($(filter arm%,$(UNAME_P)),) + RUNTIME=osx-arm64 + else + RUNTIME=osx-x64 + endif endif endif +# Extract the output directory from the EXE path (everything before the last slash) +OUTPUT_DIR := $(dir $(EXE)) -ifdef EXE - OUTPUT_DIR=./ -endif +# Extract the filename from the EXE path (everything after the last slash, without extension) +ASSEMBLY_NAME := $(notdir $(basename $(EXE))) +# Create the output directory if it doesn't exist publish: - dotnet publish Sapling/Sapling.csproj -c Release --runtime ${RUNTIME} --self-contained -p:Optimized=true -p:DeterministicBuild=true -p:AssemblyName=$(EXE) -p:DebugType=embedded -o '${OUTPUT_DIR}' + @if [ ! -d "$(OUTPUT_DIR)" ]; then mkdir -p $(OUTPUT_DIR); fi + dotnet publish Sapling/Sapling.csproj -c Release --runtime $(RUNTIME) --self-contained \ + -p:PublishSingleFile=true -p:DeterministicBuild=true \ + -p:AssemblyName=$(ASSEMBLY_NAME) -p:DebugType=embedded -o $(OUTPUT_DIR)