https://gcc.gnu.org/g:d1fd9da39abc4e0430fed46d14ebd2360324f8b8

commit r15-8258-gd1fd9da39abc4e0430fed46d14ebd2360324f8b8
Author: Matthias Klose <d...@ubuntu.com>
Date:   Tue Mar 18 16:12:37 2025 +0100

    Build and install gcobol driver for the cross build
    
    gcc/cobol/
    
    2025-03-18  Matthias Klose  <d...@ubuntu.com>
    
            * Make-lang.in (GCOBC_TARGET_INSTALL_NAME, gcobol-cross): New.
            (cobol.all.cross): Depend on gcobol-cross.
            (cobol.install-common): Adjust install for the cross build.
            (cobol.uninstall): Use *_INSTALL_NAME for uninstall.

Diff:
---
 gcc/cobol/Make-lang.in | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/gcc/cobol/Make-lang.in b/gcc/cobol/Make-lang.in
index eccc1c43f23b..5b61ae912192 100644
--- a/gcc/cobol/Make-lang.in
+++ b/gcc/cobol/Make-lang.in
@@ -38,6 +38,7 @@ GCOBOL_INSTALL_NAME := $(shell echo gcobol|sed 
'$(program_transform_name)')
 GCOBOL_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gcobol|sed 
'$(program_transform_name)')
 
 GCOBC_INSTALL_NAME := $(shell echo gcobc|sed '$(program_transform_name)')
+GCOBC_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gcobc|sed 
'$(program_transform_name)')
 
 cobol: cobol1$(exeext)
 cobol.serial = cobol1$(exeext)
@@ -149,6 +150,11 @@ gcobol$(exeext): \
         $(GCOBOL_D_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a  \
         $(EXTRA_GCC_LIBS) $(LIBS)
 
+# Create a version of the gcobol driver which calls the cross-compiler.
+gcobol-cross$(exeext): gcobol$(exeext)
+       -rm -f gcobol-cross$(exeext)
+       cp gcobol$(exeext) gcobol-cross$(exeext)
+
 #
 # These control the build of the cobol1 source-to-GENERIC converter
 #
@@ -277,17 +283,29 @@ cobol1$(exeext): $(cobol1_OBJS) $(BACKEND) $(LIBDEPS) 
attribs.o $(cobol.prev)
              $(cobol1_OBJS) $(BACKEND) $(LIBS) $(BACKENDLIBS)
        @$(call LINK_PROGRESS,$(INDEX.cobol),end)
 
-# FIXME
-cobol.all.cross:
+cobol.all.cross: gcobol-cross$(exeext)
 
 cobol.start.encap: gcobol$(exeext)
 
 cobol.rest.encap:
 
 cobol.install-common: installdirs
+       -rm -f $(DESTDIR)$(bindir)/$(GCOBOL_INSTALL_NAME)$(exeext)
+       -rm -f $(DESTDIR)$(bindir)/$(GCOBC_INSTALL_NAME)$(exeext)
        $(INSTALL_PROGRAM) gcobol$(exeext)      
$(DESTDIR)$(bindir)/$(GCOBOL_INSTALL_NAME)$(exeext)
        $(INSTALL_PROGRAM) cobol1$(exeext)      $(DESTDIR)$(libexecsubdir)/
        $(INSTALL) -m 755 $(srcdir)/cobol/gcobc 
$(DESTDIR)$(bindir)/$(GCOBC_INSTALL_NAME)$(exeext)
+       -if test -f cobol1$(exeext); then \
+         if test -f gcobol-cross$(exeext); then \
+           :; \
+         else \
+           rm -f $(DESTDIR)$(bindir)/$(GCOBOL_TARGET_INSTALL_NAME)$(exeext); \
+           rm -f $(DESTDIR)$(bindir)/$(GCOBC_TARGET_INSTALL_NAME)$(exeext); \
+           ( cd $(DESTDIR)$(bindir) && \
+             $(LN) $(GCOBOL_INSTALL_NAME)$(exeext) 
$(GCOBOL_TARGET_INSTALL_NAME)$(exeext) ); \
+             $(LN) $(GCOBC_INSTALL_NAME)$(exeext) 
$(GCOBC_TARGET_INSTALL_NAME)$(exeext) ); \
+         fi; \
+       fi
        mkdir -p $(DESTDIR)$(datadir)/gcobol/udf
        $(INSTALL_DATA) $(srcdir)/cobol/udf/*   $(DESTDIR)$(datadir)/gcobol/udf/
 
@@ -338,9 +356,9 @@ gcobol-io.html: $(srcdir)/cobol/gcobol.3
 # the installed location of the cobol1 compiler.
 cobol.uninstall:
        rm -rf  $(DESTDIR)$(bindir)/$(GCOBOL_INSTALL_NAME)$(exeext)     \
-               $(DESTDIR)$(bindir)/gcobc                               \
+               $(DESTDIR)$(bindir)/$(GCOBC_INSTALL_NAME)               \
                $(DESTDIR)$(datadir)/gcobol/                            \
-               $(DESTDIR)$(man1dir)/gcobol.1                           \
+               $(DESTDIR)$(man1dir)/$(GCOBOL_INSTALL_NAME).1           \
                $(DESTDIR)$(man3dir)/gcobol.3
 
 cobol.man:

Reply via email to