From b43081d6724578bb2842b205a9cd8311cb1acf80 Mon Sep 17 00:00:00 2001 From: Efrem Ropelato Date: Wed, 6 Nov 2024 12:23:45 +0100 Subject: [PATCH] reset Makefile --- Makefile | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 75949c9..39c27f2 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ USER=$(shell id -u -n) TIME=$(shell date) JR_HOME=jr +ifndef XDG_DATA_DIRS ifeq ($(OS), Windows_NT) detectedOS := Windows else @@ -12,16 +13,36 @@ endif ifeq ($(detectedOS), Darwin) JR_SYSTEM_DIR="$(HOME)/Library/Application Support" - JR_USER_DIR="$(HOME)/.local/share" endif -ifeq ($(detectedOS), Linux) +ifeq ($(detectedOS), Linux) JR_SYSTEM_DIR="$(HOME)/.config" - JR_USER_DIR="$(HOME)/.local/share" endif ifeq ($(detectedOS), Windows_NT) JR_SYSTEM_DIR="$(LOCALAPPDATA)" +endif +else + JR_SYSTEM_DIR=$(XDG_DATA_DIRS) +endif + +ifndef XDG_DATA_HOME +ifeq ($(OS), Windows_NT) + detectedOS := Windows +else + detectedOS := $(shell sh -c 'uname 2>/dev/null || echo Unknown') +endif + +ifeq ($(detectedOS), Darwin) + JR_USER_DIR="$(HOME)/.local/share" +endif +ifeq ($(detectedOS), Linux) + JR_USER_DIR="$(HOME)/.local/share" +endif +ifeq ($(detectedOS), Windows_NT) JR_USER_DIR="$(LOCALAPPDATA)" //@TODO endif +else + JR_USER_DIR=$(XDG_DATA_HOME) +endif hello: @echo "JR,the JSON Random Generator" @@ -89,4 +110,4 @@ install: install build/jr /usr/local/bin all: hello install-gogen generate compile -all_offline: hello generate compile +all_offline: hello generate compile \ No newline at end of file