From 7a372616bf627dec0c27e985f352694a7ef4619d Mon Sep 17 00:00:00 2001 From: Patrick Gaskin Date: Mon, 3 Aug 2020 15:36:25 -0400 Subject: [PATCH] Added NM_CONFIG_DIR option to the Makefile (closes #68) This should not be used in most cases, as it will break compatibility with existing mods which depend on adding a config to NM. This option is meant as a better option than find/replace for people who do private builds of NM for themselves and want to change the config dir. It will also affect the path used for installing the documentation and shown in the default menu item. --- Makefile | 12 +++++++++++- res/doc | 11 +++++------ src/config.c | 2 +- src/config.h | 8 ++++---- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 557dad5..f271eaa 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ override LIBRARY := src/libnm.so override SOURCES += src/action.c src/action_c.c src/action_cc.cc src/config.c src/generator.c src/generator_c.c src/kfmon.c src/nickelmenu.cc src/util.c override CFLAGS += -Wall -Wextra -Werror -fvisibility=hidden override CXXFLAGS += -Wall -Wextra -Werror -Wno-missing-field-initializers -isystemlib -fvisibility=hidden -fvisibility-inlines-hidden -override KOBOROOT += res/doc:/mnt/onboard/.adds/nm/doc +override KOBOROOT += res/doc:$(NM_CONFIG_DIR)/doc override SKIPCONFIGURE += strip strip: @@ -16,4 +16,14 @@ ifeq ($(NM_UNINSTALL_CONFIGDIR),1) override CPPFLAGS += -DNM_UNINSTALL_CONFIGDIR endif +ifeq ($(NM_CONFIG_DIR),) +override NM_CONFIG_DIR := /mnt/onboard/.adds/nm +endif + +ifneq ($(NM_CONFIG_DIR),/mnt/onboard/.adds/nm) +$(info -- Warning: NM_CONFIG_DIR is set to a non-default value; this will cause issues with other mods using it!) +endif + +override CPPFLAGS += -DNM_CONFIG_DIR='"$(NM_CONFIG_DIR)"' -DNM_CONFIG_DIR_DISP='"$(patsubst /mnt/onboard/%,KOBOeReader/%,$(NM_CONFIG_DIR))"' + include NickelHook/NickelHook.mk diff --git a/res/doc b/res/doc index ee501f6..889f2b0 100644 --- a/res/doc +++ b/res/doc @@ -7,10 +7,9 @@ # it has a lot of error checking, and a failsafe mechanism which automatically # uninstalls it as a last resort. # -# Place your configuration files in this folder (/mnt/onboard/.adds/nm). They -# can be named anything, and should consist of multiple lines either starting -# with # for a comment, or in one of the the following formats (spaces around -# fields are ignored): +# Place your configuration files in this folder. They can be named anything, and +# should consist of multiple lines either starting with # for a comment, or in +# one of the the following formats (spaces around fields are ignored): # # menu_item::