]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Build and install gcobol driver for the cross build
authorMatthias Klose <doko@ubuntu.com>
Tue, 18 Mar 2025 15:12:37 +0000 (16:12 +0100)
committerMatthias Klose <doko@ubuntu.com>
Tue, 18 Mar 2025 15:12:37 +0000 (16:12 +0100)
gcc/cobol/

2025-03-18  Matthias Klose  <doko@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.

gcc/cobol/Make-lang.in

index eccc1c43f23b9f8e89e1105c34b3a75f192f692d..5b61ae9121922e98003b5358f639e0e32f2b99e1 100644 (file)
@@ -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: