This commit adds support for building the Algol 68 front-end to the build system.
Signed-off-by: Jose E. Marchesi <[email protected]> ChangeLog * Makefile.def (libga68): New module. (configure-target-libga68): Likewise. * Makefile.tpl (GA68): Define. (GA68_FOR_BUILD): Likewise. (GA68FLAGS): Likewise. * configure.ac (--enable-libga68): New option. (--enble-algol68-gc): Likewise. (GA68): Subst. (GA68FLAGS): Likewise. Invoke ACX_PROG_GA68. config/ChangeLog * acx.m4 (ACX_PROG_GA68): New defun. gcc/ChangeLog * algol68/Make-lang.in: New file. * algol68/config-lang.in: Likewise. * config.gcc (tm_algol68_file): Define. (algol68_target_objs): Likewise. (target_has_targetalgol68m): Likewise. * configure.ac (tm_algol68_file_list): Subst. (tm_algol68_include_list): Likewise. (algol68_target_objs): Likewise. * Makefile.in (tm_algol68_file_list): Define. (tm_algol68_include_list): Likewise. (TM_ALGOL68_H): Likewise. (ALGOL68_TARGET_DEF): Likewise. (ALGOL68_TARGET_H): Likewise. (ALGOL68_TARGET_OBJS): Likewise. (tm_algol68.h): New target. (cs-tm_algol68.h): Likewise. (default-algol68.o): Likewise. --- Makefile.def | 4 + Makefile.tpl | 14 ++ config/acx.m4 | 6 + configure.ac | 47 ++++-- gcc/Makefile.in | 36 ++++- gcc/algol68/Make-lang.in | 284 +++++++++++++++++++++++++++++++++++++ gcc/algol68/config-lang.in | 29 ++++ gcc/config.gcc | 44 ++++++ gcc/configure.ac | 13 ++ 9 files changed, 462 insertions(+), 15 deletions(-) create mode 100644 gcc/algol68/Make-lang.in create mode 100644 gcc/algol68/config-lang.in diff --git a/Makefile.def b/Makefile.def index e7f33345aa8..12d4e48c97e 100644 --- a/Makefile.def +++ b/Makefile.def @@ -205,6 +205,7 @@ target_modules = { module= zlib; bootstrap=true; }; target_modules = { module= rda; }; target_modules = { module= libada; }; target_modules = { module= libgm2; lib_path=.libs; }; +target_modules = { module= libga68; lib_path=.libs; }; target_modules = { module= libgomp; bootstrap= true; lib_path=.libs; }; target_modules = { module= libitm; lib_path=.libs; }; target_modules = { module= libatomic; bootstrap=true; lib_path=.libs; }; @@ -678,6 +679,7 @@ dependencies = { module=configure-target-libstdc++-v3; on=configure-target-libgo dependencies = { module=configure-target-libsanitizer; on=all-target-libstdc++-v3; }; dependencies = { module=configure-target-libvtv; on=all-target-libstdc++-v3; }; dependencies = { module=configure-target-libgrust; on=all-target-libstdc++-v3; }; +dependencies = { module=configure-target-libga68; on=all-target-libstdc++-v3; }; // parallel_list.o and parallel_settings.o depend on omp.h, which is // generated by the libgomp configure. Unfortunately, due to the use of // recursive make, we can't be that specific. @@ -736,6 +738,8 @@ languages = { language=jit; gcc-check-target=check-jit; }; languages = { language=rust; gcc-check-target=check-rust; }; languages = { language=cobol; gcc-check-target=check-cobol; lib-check-target=check-target-libgcobol; }; +languages = { language=algol68; gcc-check-target=check-algol68; + lib-check-target=check-target-libga68; }; // Toplevel bootstrap bootstrap_stage = { id=1 ; }; diff --git a/Makefile.tpl b/Makefile.tpl index f4f0fc58df4..85c43944db9 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -281,6 +281,11 @@ POSTSTAGE1_HOST_EXPORTS = \ CC_FOR_BUILD="$$CC"; export CC_FOR_BUILD; \ $(POSTSTAGE1_CXX_EXPORT) \ $(LTO_EXPORTS) \ + GA68="$$r/$(HOST_SUBDIR)/prev-gcc/ga68$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/ \ + -B$(build_tooldir)/bin/ $(GA68FLAGS_FOR_TARGET) \ + -B$$r/prev-$(TARGET_SUBDIR)/libga68/.libs"; \ + export GA68; \ + GA68_FOR_BUILD="$$GA68"; export GA68_FOR_BUILD; \ GDC="$$r/$(HOST_SUBDIR)/prev-gcc/gdc$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/ \ -B$(build_tooldir)/bin/ $(GDCFLAGS_FOR_TARGET) \ -B$$r/prev-$(TARGET_SUBDIR)/libphobos/libdruntime/gcc \ @@ -313,6 +318,7 @@ BASE_TARGET_EXPORTS = \ CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \ CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ GFORTRAN="$(GFORTRAN_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GFORTRAN; \ + GA68="$(GA68_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GA68; \ GOC="$(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GOC; \ GDC="$(GDC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GDC; \ GM2="$(GM2_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GM2; \ @@ -383,6 +389,7 @@ CXX_FOR_BUILD = @CXX_FOR_BUILD@ DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@ DSYMUTIL_FOR_BUILD = @DSYMUTIL_FOR_BUILD@ GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@ +GA68_FOR_BUILD = @GA68_FOR_BUILD@ GOC_FOR_BUILD = @GOC_FOR_BUILD@ GDC_FOR_BUILD = @GDC_FOR_BUILD@ GM2_FOR_BUILD = @GM2_FOR_BUILD@ @@ -446,6 +453,7 @@ STRIP = @STRIP@ WINDRES = @WINDRES@ WINDMC = @WINDMC@ +GA68 = @GA68@ GDC = @GDC@ GNATBIND = @GNATBIND@ GNATMAKE = @GNATMAKE@ @@ -456,6 +464,7 @@ LIBCFLAGS = $(CFLAGS) CXXFLAGS = @CXXFLAGS@ LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates GOCFLAGS = $(CFLAGS) +GA68FLAGS = @GA68FLAGS@ GDCFLAGS = @GDCFLAGS@ GM2FLAGS = $(CFLAGS) @@ -601,6 +610,7 @@ CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@ RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@ GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ GOC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GOC_FOR_TARGET@ +GA68_FOR_TARGET=$(STAGE_CC_WRAPPER) @GA68_FOR_TARGET@ GDC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GDC_FOR_TARGET@ GM2_FOR_TARGET=$(STAGE_CC_WRAPPER) @GM2_FOR_TARGET@ DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@ @@ -630,6 +640,7 @@ LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates LDFLAGS_FOR_TARGET = @LDFLAGS_FOR_TARGET@ GM2FLAGS_FOR_TARGET = -O2 -g GOCFLAGS_FOR_TARGET = -O2 -g +GA68FLAGS_FOR_TARGET = -O2 -g GDCFLAGS_FOR_TARGET = -O2 -g FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@ @@ -734,6 +745,7 @@ EXTRA_HOST_FLAGS = \ 'DSYMUTIL=$(DSYMUTIL)' \ 'GFORTRAN=$(GFORTRAN)' \ 'GOC=$(GOC)' \ + 'GA68=$(GA68)' \ 'GDC=$(GDC)' \ 'GM2=$(GM2)' \ 'LD=$(LD)' \ @@ -762,6 +774,7 @@ STAGE1_FLAGS_TO_PASS = \ POSTSTAGE1_FLAGS_TO_PASS = \ CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \ CXX="$${CXX}" CXX_FOR_BUILD="$${CXX_FOR_BUILD}" \ + GA68="$${GA68}" GA68_FOR_BUILD="$${GA68_FOR_BUILD}" \ GDC="$${GDC}" GDC_FOR_BUILD="$${GDC_FOR_BUILD}" \ GM2="$${GM2}" GM2_FOR_BUILD="$${GM2_FOR_BUILD}" \ GNATBIND="$${GNATBIND}" \ @@ -797,6 +810,7 @@ EXTRA_TARGET_FLAGS = \ 'GFORTRAN=$$(GFORTRAN_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ 'GOC=$$(GOC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ 'GOCFLAGS=$$(GOCFLAGS_FOR_TARGET)' \ + 'GA68=$$(GA68_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ 'GDC=$$(GDC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ 'GDCFLAGS=$$(GDCFLAGS_FOR_TARGET)' \ 'GM2=$$(GM2_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ diff --git a/config/acx.m4 b/config/acx.m4 index db54ccf1c7c..4e0c64172e6 100644 --- a/config/acx.m4 +++ b/config/acx.m4 @@ -434,6 +434,12 @@ else have_cargo=no fi]) +# Test for Algol 68 +AC_DEFUN([ACX_PROG_GA68], +[AC_REQUIRE([AC_CHECK_TOOL_PREFIX]) +AC_REQUIRE([AC_PROG_CC]) +AC_CHECK_TOOL(GA68, ga68, no)]) + # Test for D. AC_DEFUN([ACX_PROG_GDC], [AC_REQUIRE([AC_CHECK_TOOL_PREFIX]) diff --git a/configure.ac b/configure.ac index 94321ffd20a..8f249675e5a 100644 --- a/configure.ac +++ b/configure.ac @@ -166,6 +166,7 @@ target_libraries="target-libgcc \ target-libgcobol \ target-libada \ target-libgm2 \ + target-libga68 \ target-libgo \ target-libgrust \ target-libphobos \ @@ -514,6 +515,11 @@ if test "${ENABLE_LIBGM2}" != "yes" ; then noconfigdirs="$noconfigdirs gm2tools" fi +AC_ARG_ENABLE(libga68, +[AS_HELP_STRING([--enable-libga68], [build libga68 directory])], +ENABLE_LIBGA68=$enableval, +ENABLE_LIBGA68=yes) + AC_ARG_ENABLE(libssp, [AS_HELP_STRING([--enable-libssp], [build libssp directory])], ENABLE_LIBSSP=$enableval, @@ -1451,6 +1457,7 @@ if test "${build}" != "${host}" ; then DLLTOOL_FOR_BUILD=${DLLTOOL_FOR_BUILD-dlltool} DSYMUTIL_FOR_BUILD=${DSYMUTIL_FOR_BUILD-dsymutil} GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran} + GA68_FOR_BUILD=${GA68_FOR_BUILD-ga68} GOC_FOR_BUILD=${GOC_FOR_BUILD-gccgo} GDC_FOR_BUILD=${GDC_FOR_BUILD-gdc} GNATMAKE_FOR_BUILD=${GNATMAKE_FOR_BUILD-gnatmake} @@ -1467,6 +1474,7 @@ else DLLTOOL_FOR_BUILD="\$(DLLTOOL)" DSYMUTIL_FOR_BUILD="\$(DSYMUTIL)" GFORTRAN_FOR_BUILD="\$(GFORTRAN)" + GA68_FOR_BUILD="\$(GA68)" GOC_FOR_BUILD="\$(GOC)" GDC_FOR_BUILD="\$(GDC)" GNATMAKE_FOR_BUILD="\$(GNATMAKE)" @@ -1520,6 +1528,7 @@ int main() {}])], fi ACX_PROG_GNAT +ACX_PROG_GA68 ACX_PROG_GDC ACX_PROG_CARGO ACX_PROG_CMP_IGNORE_INITIAL @@ -2644,6 +2653,10 @@ AC_ARG_ENABLE(objc-gc, [AS_HELP_STRING([--enable-objc-gc], [enable use of Boehm's garbage collector with the GNU Objective-C runtime])]) +AC_ARG_ENABLE(algol68-gc, +[AS_HELP_STRING([--enable-algol68-gc], + [enable use of Boehm's garbage collector with the + GNU Algol runtime])]) AC_ARG_WITH([target-bdw-gc], [AS_HELP_STRING([--with-target-bdw-gc=PATHLIST], [specify prefix directory for installed bdw-gc package. @@ -2656,21 +2669,22 @@ AC_ARG_WITH([target-bdw-gc-lib], [AS_HELP_STRING([--with-target-bdw-gc-lib=PATHLIST], [specify directories for installed bdw-gc library])]) -case ,${enable_languages},:${enable_objc_gc} in *,objc,*:yes|*,objc,*:auto) - AC_MSG_CHECKING([for bdw garbage collector]) - if test "x$with_target_bdw_gc$with_target_bdw_gc_include$with_target_bdw_gc_lib" = x; then - dnl no bdw-gw options, assume default locations - AC_MSG_RESULT([using bdw-gc in default locations]) - else - dnl bdw-gw options, first error checking, complete checking in libobjc - if test "x$with_target_bdw_gc_include" = x && test "x$with_target_bdw_gc_lib" != x; then - AC_MSG_ERROR([found --with-target-bdw-gc-lib but --with-target-bdw-gc-include missing]) - elif test "x$with_target_bdw_gc_include" != x && test "x$with_target_bdw_gc_lib" = x; then - AC_MSG_ERROR([found --with-target-bdw-gc-include but --with-target-bdw-gc-lib missing]) +case ,${enable_languages},:${enable_objc_gc}:${enable_algol68_gc} in + *,objc,*:yes:*|*,objc,*:auto:*|*,algol68,*:*:yes|*,algol68,*:*:auto) + AC_MSG_CHECKING([for bdw garbage collector]) + if test "x$with_target_bdw_gc$with_target_bdw_gc_include$with_target_bdw_gc_lib" = x; then + dnl no bdw-gw options, assume default locations + AC_MSG_RESULT([using bdw-gc in default locations]) else - AC_MSG_RESULT([using paths configured with --with-target-bdw-gc options]) + dnl bdw-gw options, first error checking, complete checking in libobjc and libga68 + if test "x$with_target_bdw_gc_include" = x && test "x$with_target_bdw_gc_lib" != x; then + AC_MSG_ERROR([found --with-target-bdw-gc-lib but --with-target-bdw-gc-include missing]) + elif test "x$with_target_bdw_gc_include" != x && test "x$with_target_bdw_gc_lib" = x; then + AC_MSG_ERROR([found --with-target-bdw-gc-include but --with-target-bdw-gc-lib missing]) + else + AC_MSG_RESULT([using paths configured with --with-target-bdw-gc options]) + fi fi - fi esac # Disable libitm, libsanitizer, libvtv if we're not building C++ @@ -3918,6 +3932,7 @@ AC_SUBST(CXX_FOR_BUILD) AC_SUBST(DLLTOOL_FOR_BUILD) AC_SUBST(DSYMUTIL_FOR_BUILD) AC_SUBST(GFORTRAN_FOR_BUILD) +AC_SUBST(GA68_FOR_BUILD) AC_SUBST(GOC_FOR_BUILD) AC_SUBST(GDC_FOR_BUILD) AC_SUBST(GNATMAKE_FOR_BUILD) @@ -4013,6 +4028,9 @@ AC_SUBST(CC) AC_SUBST(CXX) AC_SUBST(CFLAGS) AC_SUBST(CXXFLAGS) +AC_SUBST(GA68) +AC_SUBST(GA68FLAGS) +GA68FLAGS=${GA68FLAGS-${CFLAGS}} AC_SUBST(GDC) AC_SUBST(GDCFLAGS) GDCFLAGS=${GDCFLAGS-${CFLAGS}} @@ -4061,6 +4079,7 @@ NCN_STRICT_CHECK_TARGET_TOOLS(CC_FOR_TARGET, cc gcc) NCN_STRICT_CHECK_TARGET_TOOLS(CXX_FOR_TARGET, c++ g++ cxx gxx) NCN_STRICT_CHECK_TARGET_TOOLS(GCC_FOR_TARGET, gcc, ${CC_FOR_TARGET}) NCN_STRICT_CHECK_TARGET_TOOLS(GFORTRAN_FOR_TARGET, gfortran) +NCN_STRICT_CHECK_TARGET_TOOLS(GA68_FOR_TARGET, ga68) NCN_STRICT_CHECK_TARGET_TOOLS(GOC_FOR_TARGET, gccgo) NCN_STRICT_CHECK_TARGET_TOOLS(GDC_FOR_TARGET, gdc) NCN_STRICT_CHECK_TARGET_TOOLS(GM2_FOR_TARGET, gm2) @@ -4112,6 +4131,8 @@ GCC_TARGET_TOOL(gfortran, GFORTRAN_FOR_TARGET, GFORTRAN, [gcc/gfortran -B$$r/$(HOST_SUBDIR)/gcc/], fortran) GCC_TARGET_TOOL(gccgo, GOC_FOR_TARGET, GOC, [gcc/gccgo -B$$r/$(HOST_SUBDIR)/gcc/], go) +GCC_TARGET_TOOL(ga68, GA68_FOR_TARGET, GA68, + [gcc/ga68 -B$$r/$(HOST_SUBDIR)/gcc/], algol68) GCC_TARGET_TOOL(gdc, GDC_FOR_TARGET, GDC, [gcc/gdc -B$$r/$(HOST_SUBDIR)/gcc/], d) GCC_TARGET_TOOL(gm2, GM2_FOR_TARGET, GM2, diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 5c24a9aab00..7458daf94be 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -615,6 +615,8 @@ tm_rust_file_list=@tm_rust_file_list@ tm_rust_include_list=@tm_rust_include_list@ tm_jit_file_list=@tm_jit_file_list@ tm_jit_include_list=@tm_jit_include_list@ +tm_algol68_file_list=@tm_algol68_file_list@ +tm_algol68_include_list=@tm_algol68_include_list@ build_xm_file_list=@build_xm_file_list@ build_xm_include_list=@build_xm_include_list@ build_xm_defines=@build_xm_defines@ @@ -920,6 +922,7 @@ TM_P_H = tm_p.h $(tm_p_file_list) $(TREE_H) TM_D_H = tm_d.h $(tm_d_file_list) TM_RUST_H = tm_rust.h $(tm_rust_file_list) TM_JIT_H = tm_jit.h $(tm_jit_file_list) +TM_ALGOL68_H = tm_algol68.h $(tm_algol68_file_list) GTM_H = tm.h $(tm_file_list) insn-constants.h TM_H = $(GTM_H) insn-flags.h $(OPTIONS_H) @@ -981,12 +984,14 @@ COMMON_TARGET_DEF = common/common-target.def target-hooks-macros.h D_TARGET_DEF = d/d-target.def target-hooks-macros.h RUST_TARGET_DEF = rust/rust-target.def target-hooks-macros.h JIT_TARGET_DEF = jit/jit-target.def target-hooks-macros.h +ALGOL68_TARGET_DEF = algol68/algol68-target.def target-hooks-macros.h TARGET_H = $(TM_H) target.h $(TARGET_DEF) insn-modes.h insn-codes.h C_TARGET_H = c-family/c-target.h $(C_TARGET_DEF) COMMON_TARGET_H = common/common-target.h $(INPUT_H) $(COMMON_TARGET_DEF) D_TARGET_H = d/d-target.h $(D_TARGET_DEF) RUST_TARGET_H = rust/rust-target.h $(RUST_TARGET_DEF) JIT_TARGET_H = jit/jit-target.h $(JIT_TARGET_DEF) +ALGOL68_TARGET_H = algol68/algol68-target.h $(ALGOL68_TARGET_DEF) MACHMODE_H = machmode.h mode-classes.def HOOKS_H = hooks.h HOSTHOOKS_DEF_H = hosthooks-def.h $(HOOKS_H) @@ -1311,6 +1316,9 @@ FORTRAN_TARGET_OBJS=@fortran_target_objs@ # Target specific, Rust specific object file RUST_TARGET_OBJS=@rust_target_objs@ +# Target specific, Algol68 specific object file +ALGOL68_TARGET_OBJS=@algol68_target_objs@ + # Object files for gcc many-languages driver. GCC_OBJS = gcc.o gcc-main.o ggc-none.o gcc-urlifier.o options-urls.o @@ -2117,6 +2125,7 @@ tm_p.h: cs-tm_p.h ; @true tm_d.h: cs-tm_d.h ; @true tm_rust.h: cs-tm_rust.h ; @true tm_jit.h: cs-tm_jit.h ; @true +tm_algol68.h: cs-tm_algol68.h; @true cs-config.h: Makefile TARGET_CPU_DEFAULT="" \ @@ -2161,6 +2170,11 @@ cs-tm_jit.h: Makefile HEADERS="$(tm_jit_include_list)" DEFINES="" \ $(SHELL) $(srcdir)/mkconfig.sh tm_jit.h +cs-tm_algol68.h: Makefile + TARGET_CPU_DEFAULT="" \ + HEADERS="$(tm_algol68_include_list)" DEFINES="" \ + $(SHELL) $(srcdir)/mkconfig.sh tm_algol68.h + # Don't automatically run autoconf, since configure.ac might be accidentally # newer than configure. Also, this writes into the source directory which # might be on a read-only file system. If configured for maintainer mode @@ -2640,6 +2654,12 @@ default-rust.o: config/default-rust.cc $(COMPILE) $< $(POSTCOMPILE) +# Files used by the Algol68 language front end. + +default-algol68.o: config/default-algol68.cc + $(COMPILE) $< + $(POSTCOMPILE) + # Language-independent files. DRIVER_DEFINES = \ @@ -2995,6 +3015,15 @@ s-jit-target-hooks-def-h: build/genhooks$(build_exeext) jit/jit-target-hooks-def.h $(STAMP) s-jit-target-hooks-def-h +algol68/algol68-target-hooks-def.h: s-algol68-target-hooks-def-h; @true + +s-algol68-target-hooks-def-h: build/genhooks$(build_exeext) + $(RUN_GEN) build/genhooks$(build_exeext) "Algol68 Target Hook" \ + > tmp-algol68-target-hooks-def.h + $(SHELL) $(srcdir)/../move-if-change tmp-algol68-target-hooks-def.h \ + algol68/algol68-target-hooks-def.h + $(STAMP) s-algol68-target-hooks-def-h + # check if someone mistakenly only changed tm.texi. # We use a different pathname here to avoid a circular dependency. s-tm-texi: $(srcdir)/doc/../doc/tm.texi @@ -3020,6 +3049,7 @@ s-tm-texi: build/genhooks$(build_exeext) $(srcdir)/doc/tm.texi.in || test $(srcdir)/doc/tm.texi -nt $(srcdir)/common/common-target.def \ || test $(srcdir)/doc/tm.texi -nt $(srcdir)/d/d-target.def \ || test $(srcdir)/doc/tm.texi -nt $(srcdir)/rust/rust-target.def \ + || test $(srcdir)/doc/tm.texi -nt $(srcdir)/algol68/algol68-target.def \ ); then \ echo >&2 ; \ echo You should edit $(srcdir)/doc/tm.texi.in rather than $(srcdir)/doc/tm.texi . >&2 ; \ @@ -3203,6 +3233,7 @@ generated_files = config.h tm.h $(TM_P_H) $(TM_D_H) $(TM_JIT_H) $(TM_H) \ gimple-match-auto.h generic-match-auto.h \ c-family/c-target-hooks-def.h d/d-target-hooks-def.h \ $(TM_RUST_H) rust/rust-target-hooks-def.h \ + $(TM_ALGOL68_H) algol68/algol68-target-hooks-def.h \ case-cfn-macros.h \ jit/jit-target-hooks-def.h case-cfn-macros.h \ cfn-operators.pd omp-device-properties.h @@ -3339,7 +3370,7 @@ build/genrecog.o : genrecog.cc $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \ $(HASH_TABLE_H) inchash.h build/genhooks.o : genhooks.cc $(TARGET_DEF) $(C_TARGET_DEF) \ $(COMMON_TARGET_DEF) $(D_TARGET_DEF) $(RUST_TARGET_DEF) $(JIT_TARGET_DEF) \ - $(BCONFIG_H) $(SYSTEM_H) errors.h + $(ALGOL68_TARGET_DEF) $(BCONFIG_H) $(SYSTEM_H) errors.h build/genmddump.o : genmddump.cc $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \ $(CORETYPES_H) $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H) build/genmatch.o : genmatch.cc $(BCONFIG_H) $(SYSTEM_H) $(CORETYPES_H) \ @@ -3891,7 +3922,8 @@ $(build_htmldir)/gccinstall/index.html: $(TEXI_GCCINSTALL_FILES) .PHONY: regenerate-opt-urls OPT_URLS_HTML_DEPS = $(build_htmldir)/gcc/Option-Index.html \ $(build_htmldir)/gdc/Option-Index.html \ - $(build_htmldir)/gfortran/Option-Index.html + $(build_htmldir)/gfortran/Option-Index.html \ + $(build_htmldir)/ga68/Option-Index.html $(OPT_URLS_HTML_DEPS): %/Option-Index.html: %/index.html regenerate-opt-urls: $(srcdir)/regenerate-opt-urls.py $(OPT_URLS_HTML_DEPS) diff --git a/gcc/algol68/Make-lang.in b/gcc/algol68/Make-lang.in new file mode 100644 index 00000000000..26a25193e90 --- /dev/null +++ b/gcc/algol68/Make-lang.in @@ -0,0 +1,284 @@ +# Make-lang.in -- Top level -*- makefile -*- fragment for GCC Algol 68 +# frontend. + +# Copyright (C) 2025 Free Software Foundation, Inc. + +# This file is NOT part of GCC. + +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. + +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# This file provides the language dependent support in the main Makefile. + +.PHONY: algol68 + +# Installation name. + +A68_INSTALL_NAME = $(shell echo ga68|sed '$(program_transform_name)') +A68_TARGET_INSTALL_NAME = $(target_noncanonical)-$(shell echo ga68|sed '$(program_transform_name)') + +# General hooks + +algol68: a681$(exeext) +algol68.serial = a681$(exeext) + +.PHONY: algol68 + +# Use maximal warnings for this front end. +algol68-warn = $(STRICT_WARN) + +# First the driver, ga68. + +GA68_OBJS = \ + $(GCC_OBJS) \ + algol68/a68spec.o \ + $(END) + +a68spec.o: $(srcdir)/algol68/a68spec.cc $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) \ + $(CONFIG_H) opts.h + $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \ + $(INCLUDES) $(srcdir)/algol68/a68spec.cc + +ga68$(exeext): $(GA68_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBDEPS) + +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ + $(GA68_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \ + $(EXTRA_GCC_LIBS) $(LIBS) + +# Now the compiler proper, a681. + +ALGOL68_OBJS = algol68/a68-lang.o \ + algol68/a68-unistr.o \ + algol68/a68-moids-diagnostics.o \ + algol68/a68-moids-misc.o \ + algol68/a68-moids-to-string.o \ + algol68/a68-postulates.o \ + algol68/a68-diagnostics.o \ + algol68/a68-parser.o \ + algol68/a68-parser-keywords.o \ + algol68/a68-parser-bottom-up.o \ + algol68/a68-parser-brackets.o \ + algol68/a68-parser-debug.o \ + algol68/a68-parser-extract.o \ + algol68/a68-parser-modes.o \ + algol68/a68-parser-moids-check.o \ + algol68/a68-parser-moids-coerce.o \ + algol68/a68-parser-moids-equivalence.o \ + algol68/a68-parser-scanner.o \ + algol68/a68-parser-scope.o \ + algol68/a68-parser-serial-dsa.o \ + algol68/a68-parser-taxes.o \ + algol68/a68-parser-top-down.o \ + algol68/a68-parser-victal.o \ + algol68/a68-parser-prelude.o \ + algol68/a68-low.o \ + algol68/a68-low-builtins.o \ + algol68/a68-low-clauses.o \ + algol68/a68-low-coercions.o \ + algol68/a68-low-decls.o \ + algol68/a68-low-generator.o \ + algol68/a68-low-misc.o \ + algol68/a68-low-moids.o \ + algol68/a68-low-multiples.o \ + algol68/a68-low-refs.o \ + algol68/a68-low-procs.o \ + algol68/a68-low-structs.o \ + algol68/a68-low-chars.o \ + algol68/a68-low-strings.o \ + algol68/a68-low-ints.o \ + algol68/a68-low-bools.o \ + algol68/a68-low-reals.o \ + algol68/a68-low-complex.o \ + algol68/a68-low-bits.o \ + algol68/a68-low-posix.o \ + algol68/a68-low-prelude.o \ + algol68/a68-low-ranges.o \ + algol68/a68-low-runtime.o \ + algol68/a68-low-unions.o \ + algol68/a68-low-units.o \ + $(END) + +ALGOL68_ALL_OBJS = $(ALGOL68_OBJS) $(ALGOL68_TARGET_OBJS) + +algol68_OBJS = $(ALGOL68_ALL_OBJS) algol68/a68spec.o + +a681$(exeext): $(ALGOL68_ALL_OBJS) attribs.o $(BACKEND) $(LIBDEPS) $(algol68.prev) + @$(call LINK_PROGRESS,$(INDEX.algol68),start) + +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ + $(ALGOL68_OBJS) attribs.o $(BACKEND) $(LIBS) $(A681_LIBS) $(BACKENDLIBS) + @$(call LINK_PROGRESS,$(INDEX.algol68),end) + +algol68/tfspec.o: $(srcdir)/algol68/tfspec.c \ + $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) $(CONFIG_H) $(TREE_H) + +# Documentation. + +A68_MANUAL_FILES = + +A68_MANUAL_FILES = \ + algol68/ga68.texi \ + $(gcc_docdir)/include/fdl.texi \ + $(gcc_docdir)/include/gpl_v3.texi \ + $(gcc_docdir)/include/gcc-common.texi \ + gcc-vers.texi + +A68_INT_MANUAL_FILES = \ + algol68/ga68-internals.texi \ + $(gcc_docdir)/include/fdl.texi \ + $(gcc_docdir)/include/gcc-common.texi \ + gcc-vers.texi + +A68_TEXI_FILES = $(A68_MANUAL_FILES) $(A68_INT_MANUAL_FILES) + +doc/ga68.info: $(A68_MANUAL_FILES) + if test "x$(BUILD_INFO)" = xinfo; then \ + rm -f doc/ga68.info*; \ + $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \ + -I $(gcc_docdir)/include -o $@ $<; \ + else true; fi + +doc/ga68-internals.info: $(A68_INT_MANUAL_FILES) + if test "x$(BUILD_INFO)" = xinfo; then \ + rm -f doc/ga68-internals.info*; \ + $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \ + -I $(gcc_docdir)/include -o $@ $<; \ + else true; fi + +doc/ga68.dvi: $(A68_MANUAL_FILES) + $(TEXI2DVI) -I $(abs_docdir)/include -o $@ $< + +doc/ga68-internals.dvi: $(A68_INT_MANUAL_FILES) + $(TEXI2DVI) -I $(abs_docdir)/include -o $@ $< + +doc/ga68.pdf: $(A68_MANUAL_FILES) + $(TEXI2PDF) -I $(abs_docdir)/include -o $@ $< + +doc/ga68-internals.pdf: $(A68_INT_MANUAL_FILES) + $(TEXI2PDF) -I $(abs_docdir)/include -o $@ $< + +$(build_htmldir)/ga68/index.html: $(A68_MANUAL_FILES) + $(mkinstalldirs) $(@D) + rm -f $(@D)/* + $(TEXI2HTML) $(MAKEINFO_TOC_INLINE_FLAG) \ + -I $(gcc_docdir)/include -I $(srcdir)/d -o $(@D) $< + +$(build_htmldir)/ga68-internals/index.html: $(A68_INT_MANUAL_FILES) + $(mkinstalldirs) $(@D) + rm -f $(@D)/* + $(TEXI2HTML) $(MAKEINFO_TOC_INLINE_FLAG) \ + -I $(gcc_docdir)/include -I $(srcdir)/d -o $(@D) $< + +.INTERMEDIATE: ga68.pod + +ga68.pod: algol68/ga68.texi + -$(TEXI2POD) -D ga68 < $< > $@ + +# Build hooks. + +algol68.srcextra: + +algol68.all.cross: ga68$(exeext) +algol68.start.encap: ga68$(exeect) +algol68.rest.encap: +algol68.info: doc/ga68.info doc/ga68-internals.info +algol68.dvi: doc/ga68.dvi doc/ga68-internals.dvi +algol68.pdf: doc/ga68.pdf doc/ga68-internals.pdf +algol68.install-pdf: +algol68.html: $(build_htmldir)/ga68/index.html $(build_htmldir)/ga68-internals/index.html +algol68.man: doc/ga68.1 +algol68.srcinfo: doc/ga68.info doc/ga68-internals.info + -cp -p $^ $(srcdir)/doc +algol68.srcinfo: +algol68.srcman: +algol68.srcman: doc/ga68.1 + -cp -p $^ $(srcdir)/doc +algol68.install-plugin: + +algol68.tags: force + cd $(srcdir)/algol68; etags -o TAGS.sub *.c *.h; \ + etags --include TAGS.sub --include ../TAGS.sub + +lang_checks += check-algol68 +lang_checks_parallelized += check-algol68 +check_algol68_parallelize = 10 + +selftest-algol68: + +# +# Install hooks: + +algol68.install-common: installdirs + -rm -f $(DESTDIR)$(bindir)/$(A68_INSTALL_NAME)$(exeext) + $(INSTALL_PROGRAM) ga68$(exeext) $(DESTDIR)$(bindir)/$(A68_INSTALL_NAME)$(exeext) + +algol68.install-man: $(DESTDIR)$(man1dir)/$(A68_INSTALL_NAME)$(man1ext) + +$(DESTDIR)$(man1dir)/$(A68_INSTALL_NAME)$(man1ext): doc/ga68.1 installdirs + -rm -f $@ + -$(INSTALL_DATA) $< $@ + -chmod a-x $@ + +$(DESTDIR)$(man7dir)/%.7algol: doc/%.7algol installdirs + -rm -f $@ + -$(INSTALL_DATA) $< $@ + -chmod a-x $@ + +algol68.install-info: $(DESTDIR)$(infodir)/ga68.info $(DESTDIR)$(infodir)/ga68-internals.info + +algol68.install-html: $(build_htmldir)/ga68 $(build_htmldir)/ga68-internals + @$(NORMAL_INSTALL) + test -z "$(htmldir)" || $(mkinstalldirs) "$(DESTDIR)$(htmldir)" + @for p in $(build_htmldir)/ga68; do \ + if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \ + f=$(html__strip_dir) \ + if test -d "$$d$$p"; then \ + echo " $(mkinstalldirs) '$(DESTDIR)$(htmldir)/$$f'"; \ + $(mkinstalldirs) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ + echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \ + else \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \ + fi; \ + done + +algol68.uninstall: +# +# Clean hooks: +# A lot of the ancillary files are deleted by the main makefile. +# We just have to delete files specific to us. +algol68.mostlyclean: + -rm -f algol68/*$(objext) algol68/xforward algol68/fflags + -rm -f algol68/*$(coverageexts) +algol68.clean: algol68.mostlyclean +algol68.distclean: + -rm -f algol68/Makefile algol68/Make-host algol68/Make-target + -rm -f algol68/config.status algol68/config.cache +algol68.maintainer-clean: + -rm -f $(gcc_docdir)/*.7algol + +# +# Stage hooks: + +algol68.stage1: stage1-start + -mv algol68/*$(objext) stage1/algol68 +algol68.stage2: stage2-start + -mv algol68/*$(objext) stage2/algol68 +algol68.stage3: stage3-start + -mv algol68/*$(objext) stage3/algol68 +algol68.stage4: stage4-start + -mv algol68/*$(objext) stage4/algol68 +algol68.stageprofile: stageprofile-start + -mv algol68/*$(objext) stageprofile/algol68 +algol68.stagefeedback: stagefeedback-start + -mv algol68/*$(objext) stagefeedback/algol68 diff --git a/gcc/algol68/config-lang.in b/gcc/algol68/config-lang.in new file mode 100644 index 00000000000..88370b06cad --- /dev/null +++ b/gcc/algol68/config-lang.in @@ -0,0 +1,29 @@ +# config-lang.in -- Top level configure fragment for gcc Algol 68 frontend. + +# Copyright (C) 2025 Free Software Foundation, Inc. + +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. + +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# Configure looks for the existence of this file to auto-config each language. +# We define several parameters used by configure: +# +# language - name of language as it would appear in $(LANGUAGES) +# compilers - value to add to $(COMPILERS) + +language="algol68" +compilers="a681\$(exeext)" +gtfiles="\$(srcdir)/algol68/a68-lang.cc" + +target_libs="target-libga68" diff --git a/gcc/config.gcc b/gcc/config.gcc index c678b801f70..6ef8d721dae 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -93,6 +93,9 @@ # tm_rust_file list of headers with definitions of target hook # macros for the Rust compiler. # +# tm_algol68_file list of headers with definitions of target hook +# macros for the Algol68 compiler. +# # out_file The name of the machine description C support # file, if different from "$cpu_type/$cpu_type.c". # @@ -158,6 +161,9 @@ # rust_target_objs List of extra target-dependent objects that be # linked into the Rust compiler only. # +# algol68_target_objs List of extra target-dependent objects that be +# linked into the Algol68 compiler only. +# # target_gtfiles List of extra source files with type information. # # xm_defines List of macros to define when compiling for the @@ -216,6 +222,9 @@ # # target_has_targetjitm Set to yes or no depending on whether the target # has its own definition of targetjitm. +# target_has_targetalgol68m +# Set to yes or no depending on whether the target +# has its own deinition of targetdm. out_file= common_out_file= @@ -235,11 +244,13 @@ d_target_objs= jit_target_objs= fortran_target_objs= rust_target_objs= +algol68_target_objs= target_has_targetcm=no target_has_targetm_common=yes target_has_targetdm=no target_has_targetrustm=no target_has_targetjitm=no +target_has_targetalgol68m=no tm_defines= xm_defines= # Set this to force installation and use of collect2. @@ -635,6 +646,16 @@ then tm_jit_file="${tm_jit_file} ${cpu_type}/${cpu_type}-jit.h" fi +tm_algol68_file= +if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-algol68.h +then + tm_algol68_file="${cpu_type}/${cpu_type}-algol68.h" +fi +if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-algol68.cc +then + algol68_target_objs="${algol68_target_objs} ${cpu_type}-algol68.o" +fi + extra_modes= if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-modes.def then @@ -805,9 +826,11 @@ case ${target} in d_target_objs="${d_target_objs} darwin-d.o" fortran_target_objs="darwin-f.o" rust_target_objs="${rust_target_objs} darwin-rust.o" + algol68_target_objs="${algol68_target_objs} darwin-algol68.o" target_has_targetcm=yes target_has_targetdm=yes target_has_targetrustm=yes + target_has_targetalgol68m=no extra_objs="${extra_objs} darwin.o" extra_gcc_objs="darwin-driver.o" default_use_cxa_atexit=yes @@ -840,6 +863,8 @@ case ${target} in target_has_targetdm=yes rust_target_objs="${rust_target_objs} dragonfly-rust.o" target_has_targetrustm=yes + algol68_target_objs="${algol68_target_objs} dragonfly-algol68.o" + target_has_targetalgol68m=yes ;; *-*-freebsd*) # This is the generic ELF configuration of FreeBSD. Later @@ -893,12 +918,16 @@ case ${target} in target_has_targetdm=yes rust_target_objs="${rust_target_objs} freebsd-rust.o" target_has_targetrustm=yes + algol68_target_objs="${algol68_target_objs} freebsd-algol68.o" + target_has_targetalgol68m=yes ;; *-*-fuchsia*) native_system_header_dir=/include tmake_file="t-fuchsia" rust_target_objs="${rust_target_objs} fuchsia-rust.o" target_has_targetrustm=yes + algol68_target_objs="${algol68_target_objs} fuchsia-algol68.o" + target_has_targetalgol68m=yes ;; *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu | *-*-uclinuxfdpiceabi) extra_options="$extra_options gnu-user.opt" @@ -1007,6 +1036,8 @@ case ${target} in esac rust_target_objs="${rust_target_objs} netbsd-rust.o" target_has_targetrustm=yes + algol68_target_objs="${algol68_target_objs} netbsd-algol68.o" + target_has_targetalgol68m=yes ;; *-*-openbsd*) tmake_file="t-openbsd" @@ -1024,6 +1055,8 @@ case ${target} in target_has_targetdm=yes rust_target_objs="${rust_target_objs} openbsd-rust.o" target_has_targetrustm=yes + algol68_target_objs="${algol68_target_objs} openbsd-algol68.o" + target_has_targetalgol68m=yes ;; *-*-phoenix*) gas=yes @@ -1086,6 +1119,8 @@ case ${target} in target_has_targetdm=yes rust_target_objs="${rust_target_objs} sol2-rust.o" target_has_targetrustm=yes + algol68_target_objs="${algol68_target_objs} sol2-algol68.o" + target_has_targetalgol68m=yes ;; *-*-*vms*) extra_options="${extra_options} vms/vms.opt" @@ -1121,6 +1156,9 @@ case ${target} in rust_target_objs="${rust_target_objs} vxworks-rust.o" target_has_targetrustm=yes + algol68_target_objs="${algol68_target_objs} vxworks-algol68.o" + target_has_targetalgol68m=yes + extra_gcc_objs="vxworks-driver.o" # This private header exposes a consistent interface for checks on @@ -2247,6 +2285,8 @@ i[34567]86-*-mingw* | x86_64-*-mingw*) target_has_targetdm="yes" rust_target_objs="${rust_target_objs} winnt-rust.o" target_has_targetrustm="yes" + algol68_target_objs="${algol68_target_objs} winnt-algol68.o" + target_has_targetalgol68m=yes case ${target} in x86_64-*-* | *-w64-*) need_64bit_isa=yes @@ -3736,6 +3776,10 @@ if [ "$target_has_targetjitm" = "no" ]; then jit_target_objs="$jit_target_objs default-jit.o" fi +if [ "$target_has_targetalgol68" = "no" ]; then + algol68_target_objs="$algol68_target_objs default-algol68.o" +fi + # Support for --with-cpu and related options (and a few unrelated options, # too). case ${with_cpu} in diff --git a/gcc/configure.ac b/gcc/configure.ac index 1e5f7c3c4d0..41430c5b475 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -2450,6 +2450,16 @@ for f in $tm_jit_file; do * ) tm_jit_file_list="${tm_jit_file_list} \$(srcdir)/config/$f" tm_jit_include_list="${tm_jit_include_list} config/$f" + esac +done + +tm_algol68_file_list= +tm_algol68_include_list= +for f in $tm_algol68_file; do + case $f in + * ) + tm_algol68_file_list="${tm_algol68_file_list} \$(srcdir)/config/$f" + tm_algol68_include_list="${tm_algol68_include_list} config/$f" ;; esac done @@ -7614,6 +7624,8 @@ AC_SUBST(tm_rust_file_list) AC_SUBST(tm_rust_include_list) AC_SUBST(tm_jit_file_list) AC_SUBST(tm_jit_include_list) +AC_SUBST(tm_algol68_file_list) +AC_SUBST(tm_algol68_include_list) AC_SUBST(xm_file_list) AC_SUBST(xm_include_list) AC_SUBST(xm_defines) @@ -7624,6 +7636,7 @@ AC_SUBST(fortran_target_objs) AC_SUBST(d_target_objs) AC_SUBST(rust_target_objs) AC_SUBST(jit_target_objs) +AC_SUBST(algol68_target_objs) AC_SUBST(target_cpu_default) AC_SUBST_FILE(language_hooks) -- 2.30.2
