On Fri, Mar 21, 2025 at 4:56 AM Robert Dubner <rdub...@symas.com> wrote: > > I seek benediction. Failing that, I ask for advice. > > This patch makes it possible for me to set the environment variable > 'CXXFLAGS_FOR_TARGET="-ggdb -O0"' at configure time, and end up with a > debuggable libgcobol.so. > > Is this a correct way to gain that capability?
In principle the recursive make invocation should set CXXFLAGS=$(CXXFLAGS_FOR_TARGET) already: maybe-all-target-libgcobol: TARGET-target-libgcobol=all maybe-all-target-libgcobol: all-target-libgcobol all-target-libgcobol: configure-target-libgcobol @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/libgcobol && \ $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS) \ $(TARGET-target-libgcobol)) and EXTRA_TARGET_FLAGS includes 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \ Some Makefile.am have sth like the following (but not libgomp for example): # Work around what appears to be a GNU make handling MAKEFLAGS # values defined in terms of make variables, as is the case for CC and # friends when we are called from the top level Makefile. AM_MAKEFLAGS = \ "AR_FLAGS=$(AR_FLAGS)" \ "CC_FOR_BUILD=$(CC_FOR_BUILD)" \ "CC_FOR_TARGET=$(CC_FOR_TARGET)" \ "CFLAGS=$(CFLAGS)" \ "CXXFLAGS=$(CXXFLAGS)" \ "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \ "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \ "GOC_FOR_TARGET=$(GOC_FOR_TARGET)" \ "GOC=$(GOC)" \ "GOCFLAGS=$(GOCFLAGS)" \ "INSTALL=$(INSTALL)" \ "INSTALL_DATA=$(INSTALL_DATA)" \ "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \ "LDFLAGS=$(LDFLAGS)" \ "LIBCFLAGS=$(LIBCFLAGS)" \ "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \ "MAKE=$(MAKE)" \ "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \ "PICFLAG=$(PICFLAG)" \ "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \ "SHELL=$(SHELL)" \ "RUNTESTFLAGS=$(RUNTESTFLAGS)" \ "exec_prefix=$(exec_prefix)" \ "infodir=$(infodir)" \ "libdir=$(libdir)" \ "includedir=$(includedir)" \ "prefix=$(prefix)" \ "tooldir=$(tooldir)" \ "gxx_include_dir=$(gxx_include_dir)" \ "AR=$(AR)" \ "AS=$(AS)" \ "LD=$(LD)" \ "RANLIB=$(RANLIB)" \ "NM=$(NM)" \ "NM_FOR_BUILD=$(NM_FOR_BUILD)" \ "NM_FOR_TARGET=$(NM_FOR_TARGET)" \ "DESTDIR=$(DESTDIR)" \ "WERROR=$(WERROR)" > If not, then how? > > If so, then OK for trunk? > > Thanks all. > > From c03774e34bde193da7f80eea53b49915e311df0d Mon Sep 17 00:00:00 2001 > From: Bob Dubner mailto:rdub...@symas.com > Date: Thu, 20 Mar 2025 23:44:12 -0400 > Subject: [PATCH] cobol: Make CXXFLAGS_FOR_TARGET available to the > libgcobol > build. > > By setting "CXXFLAGS_FOR_TARGET=-ggdb -O0", a debuggable version > of libgcobol.so is created. > > libgcobol > > * Makefile.am: Incorporate AM_CXXFLAGS = $(CXXFLAGS_FOR_TARGET). > * Makefile.in: Regenerated. > --- > libgcobol/Makefile.am | 2 ++ > libgcobol/Makefile.in | 1 + > 2 files changed, 3 insertions(+) > > diff --git a/libgcobol/Makefile.am b/libgcobol/Makefile.am > index eddf209807e6..2bd634f30d4c 100644 > --- a/libgcobol/Makefile.am > +++ b/libgcobol/Makefile.am > @@ -52,6 +52,8 @@ libgcobol_la_LINK = $(LIBTOOL) --mode=link --tag=CXX > $(CXX) \ > > WARN_CFLAGS = -W -Wall -Wwrite-strings > > +AM_CXXFLAGS =$(CXXFLAGS_FOR_TARGET) > + > # not defined: DEFS, MAX_ERRORS, LTLDFLAGS > ALL_CXXFLAGS = -I. -I$(srcdir) $(AM_CPPFLAGS) $(DEFS) \ > $(XCFLAGS) $(AM_CXXFLAGS) $(WARN_CFLAGS) $(MAX_ERRORS) \ > diff --git a/libgcobol/Makefile.in b/libgcobol/Makefile.in > index a6096d2a64aa..6f3ef0750114 100644 > --- a/libgcobol/Makefile.in > +++ b/libgcobol/Makefile.in > @@ -425,6 +425,7 @@ libgcobol_la_LINK = $(LIBTOOL) --mode=link --tag=CXX > $(CXX) \ > $(LTLDFLAGS) > > WARN_CFLAGS = -W -Wall -Wwrite-strings > +AM_CXXFLAGS = $(CXXFLAGS_FOR_TARGET) > > # not defined: DEFS, MAX_ERRORS, LTLDFLAGS > ALL_CXXFLAGS = -I. -I$(srcdir) $(AM_CPPFLAGS) $(DEFS) \ > -- > 2.34.1 >