From b622f1db1e2d1d55f789dae3afc2667aef8d0ec6 Mon Sep 17 00:00:00 2001
From: Fred Wright <fw@fwright.net>
Date: Mon, 18 Nov 2024 15:30:25 -0800
Subject: [PATCH] Makefile: Add DEBUG and OPT options.

The OPT value (default -Os) is included in compile commands, and the
DEBUG value is included in both compile and link commands.

TESTED:
Both default and debug settings work.
---
 Makefile | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index bd587a7..53958d5 100644
--- a/Makefile
+++ b/Makefile
@@ -63,14 +63,16 @@ POSTINSTALL      = install_name_tool
 FORCE_ARCH      ?=
 ARCHFLAGS       ?=
 LIPO            ?= lipo
-XCFLAGS         ?= -Os -Wall -Wno-deprecated-declarations
+DEBUG           ?=
+OPT             ?= -Os
+XCFLAGS         ?= $(DEBUG) $(OPT) -Wall -Wno-deprecated-declarations
 ALLCFLAGS       := $(ARCHFLAGS) $(XCFLAGS) $(CFLAGS)
 DLIBCFLAGS      ?= -fPIC
 SLIBCFLAGS      ?=
-XCXXFLAGS       ?= -Os -Wall
+XCXXFLAGS       ?= $(DEBUG) $(OPT) -Wall
 ALLCXXFLAGS     := $(ARCHFLAGS) $(XCXXFLAGS) $(CXXFLAGS)
-LD              ?= ld
-LDFLAGS         ?=
+LD              ?= /usr/bin/ld
+LDFLAGS         ?= $(DEBUG)
 ALLLDFLAGS      := $(ARCHFLAGS) $(LDFLAGS)
 TEST_ARGS       ?=
 
-- 
GitLab