--- makefiles/arch/macosx.mk	2012-12-24 12:00:26.000000000 +0800
+++ makefiles/arch/macosx.mk	2026-01-31 00:17:47.000000000 +0800
@@ -13,20 +13,21 @@
 ZLSHARED = no
 
 CCACHE = $(shell if which ccache > /dev/null; then echo "ccache"; fi) #if ccache is not installed, do not use it
-CC = $(CCACHE) gcc
-AR = ar rsu
-LD = g++ -headerpad_max_install_names
+CC ?= $(CCACHE) gcc
+CXX ?= g++
+AR := ar rsu
+LD := $(CXX)
 
-ARCH_FLAGS = -arch x86_64 -mmacosx-version-min=10.5
-CFLAGS = $(ARCH_FLAGS) -pipe -fno-exceptions -Wall -Wno-ctor-dtor-privacy -W
-LDFLAGS = $(ARCH_FLAGS)
+CFLAGS += -pipe -fno-exceptions -Wall -Wno-ctor-dtor-privacy -W
+CXXFLAGS += -pipe -fno-exceptions -Wall -Wno-ctor-dtor-privacy -W
+LDFLAGS ?=
 
-EXTERNAL_LIBS = -liconv
+EXTERNAL_LIBS += -liconv
 
 ifeq "$(UI_TYPE)" "qt4"
-  QTINCLUDE =
-  MOC = moc
-  UILIBS = -framework QtCore -framework QtGui -framework QtNetwork
+  QTINCLUDE ?=
+  MOC ?= moc
+  UILIBS += -framework QtCore -framework QtGui -framework QtNetwork
 endif
 
 RM = rm -rvf

--- fbreader/macosx/Makefile	2012-12-24 12:00:26.000000000 +0800
+++ fbreader/macosx/Makefile	2026-01-31 04:58:04.000000000 +0800
@@ -12,10 +12,3 @@
 	@install -m 0644 ../data/default/config.macosx.xml $(SHARE_FBREADER)/default/config.xml
 	@install -m 0644 ../data/default/keymap.macosx.xml $(SHARE_FBREADER)/default/keymap.xml
 	@install -m 0644 ../data/default/styles.desktop.xml $(SHARE_FBREADER)/default/styles.xml
-	@macdeployqt $(DESTDIR)$(INSTALLDIR)
-	@for fw in QtDeclarative QtScript QtSql QtSvg QtXmlPatterns; do \
-		rm -rf $(DESTDIR)$(INSTALLDIR)/Contents/Frameworks/$$fw.framework; \
-	done
-	@for plugin in accessible codecs bearer graphicssystems qmltooling; do \
-		rm -rf $(DESTDIR)$(INSTALLDIR)/Contents/PlugIns/$$plugin; \
-	done

--- makefiles/config.mk	2012-12-24 12:00:26.000000000 +0800
+++ makefiles/config.mk	2026-01-31 02:44:16.000000000 +0800
@@ -6,6 +6,7 @@
 
 include $(ROOTDIR)/makefiles/arch/$(TARGET_ARCH).mk
 
+INSTALLDIR ?= $(APPS_DIR)/FBReader.app
 BINDIR ?= $(INSTALLDIR)/bin
 LIBDIR ?= $(INSTALLDIR)/lib
 INCDIR ?= $(INSTALLDIR)/include
@@ -20,32 +21,37 @@
 XML_LIBS ?= -lexpat
 ARCHIVER_LIBS ?= -lz -lbz2
 
-CFLAGS += -DINSTALLDIR=\"$(INSTALLDIR_MACRO)\" -DBASEDIR=\"$(SHAREDIR_MACRO)\" -DLIBDIR=\"$(LIBDIR_MACRO)\" -DIMAGEDIR=\"$(IMAGEDIR_MACRO)\" -DAPPIMAGEDIR=\"$(APPIMAGEDIR_MACRO)\" -DVERSION=\"$(VERSION)\"
+CPPFLAGS += -DINSTALLDIR=\"$(INSTALLDIR_MACRO)\" -DBASEDIR=\"$(SHAREDIR_MACRO)\" -DLIBDIR=\"$(LIBDIR_MACRO)\" -DIMAGEDIR=\"$(IMAGEDIR_MACRO)\" -DAPPIMAGEDIR=\"$(APPIMAGEDIR_MACRO)\" -DVERSION=\"$(VERSION)\"
+
 ifeq "$(ZLSHARED)" "yes"
   CFLAGS += -fPIC -DZLSHARED
+  CXXFLAGS += -fPIC -DZLSHARED
 endif
 
 ifeq "$(TARGET_STATUS)" "release"
-	CFLAGS += -O3
+	OPTFLAGS += -O3
 endif
 ifeq "$(TARGET_STATUS)" "debug"
-	CFLAGS += -O0 -g
+	OPTFLAGS += -O0 -g
 endif
 ifeq "$(TARGET_STATUS)" "profile"
-	CFLAGS += -O3 -g -pg
+	OPTFLAGS += -O3 -g -pg
 	LDFLAGS += -pg
 endif
 
+CFLAGS += $(CPPFLAGS) $(OPTFLAGS)
+CXXFLAGS += $(CPPFLAGS) $(OPTFLAGS)
+
 ZINCLUDE = -I $(ROOTDIR)/zlibrary/core/include -I $(ROOTDIR)/zlibrary/text/include
 
 ZLSHARED ?= yes
 
 ifeq "$(ZLSHARED)" "yes"
-  CORE_LIBS = -lm -L$(ROOTDIR)/zlibrary/core -lzlcore
+	CORE_LIBS = -lm -L$(ROOTDIR)/zlibrary/core -lzlcore
 	TEXT_LIBS = -L$(ROOTDIR)/zlibrary/text -lzltext
 	ZLUI_LIB = -L$(ROOTDIR)/zlibrary/ui -lzlui
 else
-  CORE_LIBS = -lm -L$(ROOTDIR)/zlibrary/ui -L$(ROOTDIR)/zlibrary/core -lzlcore -lzlui -lzlcore $(UILIBS) $(XML_LIBS) $(ARCHIVER_LIBS)
+	CORE_LIBS = -lm -L$(ROOTDIR)/zlibrary/ui -L$(ROOTDIR)/zlibrary/core -lzlcore -lzlui -lzlcore $(UILIBS) $(XML_LIBS) $(ARCHIVER_LIBS)
 	TEXT_LIBS = -L$(ROOTDIR)/zlibrary/text -lzltext $(EXTERNAL_LIBS) -lunibreak -lfribidi
 endif
 
--- makefiles/qsubdir.mk	2012-12-24 12:00:26.000000000 +0800
+++ makefiles/qsubdir.mk	2026-01-31 02:00:04.000000000 +0800
@@ -4,7 +4,7 @@
 INCLUDE = $(QTINCLUDE) $(ZINCLUDE) $(EXTERNAL_INCLUDE)
 
 HEADERS = $(wildcard *.h)
-SOURCES =	$(wildcard *.cpp)
+SOURCES = $(wildcard *.cpp)
 OBJMOC = $(patsubst %.cpp, %.o, $(SRCMOC))
 OBJECTS = $(patsubst %.cpp, %.o, $(SOURCES))
 
@@ -12,7 +12,7 @@
 
 .cpp.o:
 	@echo -n 'Compiling $@ ...'
-	@$(CC) -MMD -c $(CFLAGS) $(INCLUDE) $<
+	$(CXX) -MMD -c $(CXXFLAGS) $(INCLUDE) $<
 	@echo ' OK'
 
 .h.moc.cpp:

--- makefiles/subdir.mk	2012-12-24 12:00:26.000000000 +0800
+++ makefiles/subdir.mk	2026-01-31 01:59:09.000000000 +0800
@@ -16,7 +16,7 @@
 	@$(CC) -MM $(CFLAGS_PRE) $(INCLUDE) $< -o `basename $< .cpp`.d
 	@$(CC) -c $(CFLAGS) $(INCLUDE) $<
 else
-	@$(CC) -MMD -c $(CFLAGS) $(INCLUDE) $<
+	$(CXX) -MMD -c $(CXXFLAGS) $(INCLUDE) $<
 endif
 	@echo ' OK'
 
@@ -26,7 +26,7 @@
 	@$(CC) -MM $(CFLAGS_PRE) $(INCLUDE) $< -o `basename $< .M`.d
 	@$(CC) -c $(CFLAGS) $(INCLUDE) $<
 else
-	@$(CC) -MMD -c $(CFLAGS) $(INCLUDE) $<
+	$(CC) -MMD -c $(CFLAGS) $(INCLUDE) $<
 endif
 	@echo ' OK'
 
@@ -36,7 +36,7 @@
 	@$(CC) -MM $(CFLAGS_PRE) $(INCLUDE) $< -o `basename $< .m`.d
 	@$(CC) -c $(CFLAGS) $(INCLUDE) $<
 else
-	@$(CC) -MMD -c $(CFLAGS) $(INCLUDE) $<
+	$(CC) -MMD -c $(CFLAGS) $(INCLUDE) $<
 endif
 	@echo ' OK'
 
--- fbreader/Makefile	2012-12-24 12:00:26.000000000 +0800
+++ fbreader/Makefile	2026-01-31 03:51:52.000000000 +0800
@@ -22,7 +22,7 @@
 		fi; \
 	done;
 	@echo -n 'Linking $(TARGET) ...'
-	@$(LD) $(LDFLAGS) -o $(TARGET) `find src -name *.o` $(TEXT_LIBS) $(CORE_LIBS) $(ZLUI_LIB) -lsqlite3
+	$(LD) $(LDFLAGS) -o $(TARGET) `find src -name *.o` $(TEXT_LIBS) $(CORE_LIBS) $(ZLUI_LIB) -lsqlite3
 	@echo ' OK'
 
 FBSHAREDIR = $(DESTDIR)$(SHAREDIR)/FBReader
@@ -62,7 +62,7 @@
 	@install -m 0644 $(wildcard data/icons/filetree/$(VARIANT)/*.*) $(DESTDIR)$(APPIMAGEDIR_REAL)
 	@install -m 0644 $(wildcard data/icons/booktree/new/*.*) $(DESTDIR)$(APPIMAGEDIR_REAL)
 	@install -m 0644 $(wildcard data/icons/*.*) $(DESTDIR)$(APPIMAGEDIR_REAL)
-	@$(MAKE) -C $(TARGET_ARCH) RESOLUTION=$(RESOLUTION) install
+	$(MAKE) -C $(TARGET_ARCH) RESOLUTION=$(RESOLUTION) install
 
 clean:
 	@for subdir in $(ALL_SUBDIRS); do \
