[PATCH] Modula-2: merge proposal/review: 2/9 02.patch-set-02

Gaius Mulley gaiusmod2@gmail.com
Wed May 18 13:45:55 GMT 2022


Hello,

this email contains:

2.  the top level /gm2tools contents.

---------------------------------------
New file: gm2tools/autogen.sh
---------------------------------------
#!/bin/sh

# autogen.sh regenerate the autoconf files.
#   Copyright 2013-2022  Free Software Foundation, Inc.
#
# This file 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 of the License, or
# (at your option) any later version.
#
# This program 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 this program; see the file COPYING3.  If not see
# <http://www.gnu.org/licenses/>.

rm -rf autom4te.cache

# libtoolize
rm -f aclocal.m4
# aclocal -I . -I config -I ../config
aclocal -I . -I ../config
autoreconf -I . -I ../config
automake --include-deps

rm -rf autom4te.cache

exit 0
---------------------------------------
New file: gm2tools/ChangeLog
---------------------------------------
2022-05-17      Gaius Mulley <gaius.mulley@southwales.ac.uk>

	* Corrected dates on all source files.

2021-06-14      Gaius Mulley <gaius.mulley@southwales.ac.uk>

	* errors.c:  (New file).
	* Makefile.am:  (m2color.o) rule added include paths for gcc
	system headers.  (errors.o) rule added include paths for gcc
	system headers.  Add errors.o to list of modules and add errors.o
	to gm2l.
	* Makefile.in:  (rebuilt).

2021-06-12      Gaius Mulley <gaius.mulley@southwales.ac.uk>

	* gm2tools/Makefile.in:  rebuilt.

2021-06-11      Gaius Mulley <gaius.mulley@southwales.ac.uk>

	* gm2tools/Makefile.am:  (man_MANS) set to gm2lgen.1
	gm2l.1 gm2lcc.1 gm2lorder.1.  (%.o) includes changed to
	find gm2-libiberty and the gcc system.h and config.h.
	* gm2tools/Makefile.in:  (rebuilt).

2021-06-09      Gaius Mulley <gaius.mulley@southwales.ac.uk>

	* gm2l.1:  (New file).
	* gm2lcc.1:  (New file).
	* gm2lgen.1:  (New file).
	* gm2lorder.1:  (New file).

2021-06-08      Gaius Mulley <gaius.mulley@southwales.ac.uk>

	* Makefile.am: (LIBM2PIMPATH) New definition.
	(LIBM2CORPATH) New definition.  (LIBM2ISOPATH) New definition.
	(gm2l) specify -flibs=pim,iso and pass link paths.
	(gm2lcc) specify -flibs=pim,iso and pass link paths.
	(gm2lgen) specify -flibs=pim,iso and pass link paths.
	(gm2lorder) specify -flibs=pim,iso and pass link paths.
	(gm2m) specify -flibs=pim,iso and pass link paths.

2021-06-07      Gaius Mulley <gaius.mulley@southwales.ac.uk>

	* aclocal.m4: (New file).
	* autogen.sh: (New file).
	* configure: (New file).
	* configure.ac: (New file).
	* m2color.c: (New file).
	* Makefile.am: (New file).
	* Makefile.in: (New file).
	* Makefile.am: (DEBUG_MODULE_LIST) used to display locations of
	objects.  Added -B./gcc build directory to pick up link tools
	generated in the compiler bootstrap process.
	* Makefile.in: (Regenerated).
---------------------------------------
New file: gm2tools/configure.ac
---------------------------------------
# Configure script for gm2tools.
#   Copyright (C) 2021-2022 Free Software Foundation, Inc.
#
# This file 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 of the License, or
# (at your option) any later version.
#
# This program 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 this program; see the file COPYING3.  If not see
# <http://www.gnu.org/licenses/>.

AC_INIT(package-unused, version-unused,, gm2tools)
AC_CONFIG_SRCDIR(Makefile.am)

# Determine the noncanonical names used for directories.
ACX_NONCANONICAL_BUILD
ACX_NONCANONICAL_HOST
ACX_NONCANONICAL_TARGET

dnl Autoconf 2.5x and later will set a default program prefix if
dnl --target was used, even if it was the same as --host.  Disable
dnl that behavior.  This must be done before AC_CANONICAL_SYSTEM
dnl to take effect.
test "$host_noncanonical" = "$target_noncanonical" &&
  test "$program_prefix$program_suffix$program_transform_name" = \
    NONENONEs,x,x, &&
  program_transform_name=s,y,y,

AC_CANONICAL_SYSTEM
AC_ARG_PROGRAM

AM_INIT_AUTOMAKE([1.9.3 no-define foreign no-dist -Wall -Wno-portability])
AM_MAINTAINER_MODE

AC_PROG_INSTALL

AC_PROG_CC

# These should be defined by the top-level configure.
# Copy them into Makefile.
AC_SUBST(GCC_FOR_TARGET)

AM_CONDITIONAL(NATIVE, test "$host_alias" = "$target_alias")

AC_CONFIG_FILES(Makefile)

AC_OUTPUT
---------------------------------------
New file: gm2tools/errors.c
---------------------------------------
/* error.c provide C version of fancy_abort.

Copyright (C) 2021-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius@glam.ac.uk>.

This file is part of GNU Modula-2.

GNU Modula-2 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.

GNU Modula-2 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 GNU Modula-2; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.  */

#include "config.h"
#include "system.h"

extern "C" {

void fancy_abort (const char *filename, int line, char *func)
{
  fprintf (stderr, "%s:%d:%s: fancy abort called\n", filename, line, func);
  exit (1);
}


void _M2_errors_init ()
{
}


void  _M2_errors_finish ()
{
}

}
---------------------------------------
New file: gm2tools/gm2l.1
---------------------------------------
.TH gm2l "1" "June 2021" "Modula-2" "User Commands"
.SH NAME
gm2l \- generate an initialization sequence by analyzing module imports.
.SH SYNOPSIS
.B gm2l
.RB [ -fdef= extension ]
.RB [ -fmod= extension ]
.RB [ -h ]
.RB [ --help ]
.RB [ -I searchpath ]
.RB [ --M2RTS ]
.RB [ -M2RTS ]
.RB [ -v ]
.RB [ --verbose ]
.RB [ -o " outputfile" ]
\fImodulefile\fR
.SH DESCRIPTION
.PP
A tool for generating a static initialization sequence by analyzing
module imports.  This tool will generate a textual list of modules in
an order which satisfies a topological order of an import graph.  The
textual list of modules can be manipulated and used by the other
Modula-2 link tools:
.IR gm2lcc (1)
.IR gm2lgen (1)
.IR gm2lorder (1).
The command line program
.IR gm2
can be instructed to automatically invoke
.IR gm2l (1)
and the above programs to construct a C++ scaffold for a Modula-2
application.
.SH OPTIONS
.TP
.B -fdef= extension
assume that definition modules have the posfix \fIextension\fP.  If
this option is not specified then an extension of
.B .def
is assumed.
.TP
.B -fmod= extension
assume that program and implementation modules have the posfix
\fIextension\fP.  If this option is not specified then an extension of
.B .def
is assumed.
.TP
.B -h
issue a summary help.
.TP
.B --help
equivalent to
.B -h\fR.
.TP
.B -I searchpath
specifies the search path used to find definition, implementation and
program modules.
.TP
.B --M2RTS
do not include the module M2RTS even if it is a dependant module.
.TP
.B -M2RTS
equivalent to
.B --M2RTS\fR.
.TP
.B -v
turn on the verbose flag.  This will display the module name and
associated filename.
.TP
.B --verbose
equivalent to
.B -v\fR.
.SH "SEE ALSO"
.IR gm2lcc (1),
.IR gm2lgen (1),
.IR gm2lorder (1)
and
.IR gm2 (1).
---------------------------------------
New file: gm2tools/gm2lcc.1
---------------------------------------
.TH gm2lcc "1" "June 2021" "Modula-2" "User Commands"
.SH NAME
gm2lcc \- generate the link command from a list of modules.
.SH SYNOPSIS
.B gm2lcc
.RB [ \-c ]
.RB [ \-g ]
.RB [ \-h ]
.RB [ \-\-help ]
.RB [ \-\-main " \f[I]mainmodule" ]
.RB [ \-\-mainobject " \f[I]objectname" ]
.RB [ \-B\f[I]directory\fP ]
.RB [ \-p ]
.RB [ \-\-exec ]
.RB [ \-fshared ]
.RB [ \-\-ignoremain ]
.RB [ \-\-ar ]
.RB [ \-fobject-path=path ]
.RB [ \-ftarget-ar=arname ]
.RB [ \-ftarget-ranlib=\f[I]ranlibname\fP ]
.RB [ \-o " \f[I]outputfile\fP" ]
.RB [ \-\-startup "\f[I] filename\fP" ]
.RB [ \-f\f[I]option\fP ]
.RB [ \-l\f[I]libname\fP ]
.RB [ \-L\f[I]path\fP ]
\fIfilename\fR
.SH DESCRIPTION
.PP
A tool for generating a link or archive command from a text list of
modules.  This program is used by
.IR gm2 (1)
and will create an archive from a list of modules which is later on
linked against the C++ or C scaffold by the gcc linker.
.PP
The textual list of modules can be manipulated and used by the other
Modula-2 link tools:
.IR gm2lcc (1)
.IR gm2lgen (1)
.IR gm2lorder (1).
The command line program
.IR gm2 (1)
can be instructed to automatically invoke
.IR gm2l (1)
and the above programs to construct a C++ scaffold for a Modula-2
application.
.SH OPTIONS
.TP
.B \-c
check that all objects or archives can be found and display their file
system location.
.TP
.B \-g
debug flag, pass on the this flag to \f[I]libtool\fP.
.TP
.B \-h
issue a summary help.
.TP
.B \-\-help
equivalent to
.B \-h\fR.
.TP
.B \-\-mainobject objectname
allows the user to specify the \f[I]objectname\fP as the main program
object which will not be included in the link command.  Typically gm2
will invoke \f[I]gm2lcc\fP to generate an archive of modules and then
link \f[I]objectname\fP with the archive created by \f[I]gm2lcc\fP.
.TP
.B \-B\f[I]directory\fP
pass directory to \f[I]libtool\fP.
.TP
.B \-p
add profile flags and the profiling library \f[I]-lgmon\fP to
\f[I]libtool\fP.
.TP
.B \-\-exec
execute the final link command.  Without this option the link command is
written to stdout.
.TP
.B \-fshared
add the option \f[I]-shared\fP to the \f[I]libtool\fP command.
.TP
.B \-\-ignoremain
remove the main object from the list of modules to be linked.  (See
the option \f[I]-\-main\fP).
.TP
.B \-\-ar
use
.IR ar
and
.IR ranlib
tools rather than
.IR libtool
to create an archive.
.TP
.B \-fobject-path=\f[I]path\fP
specify the \f[I]path\fP used for locating the objects.
The \f[I]path\fP is a colon separated list of directories.
.TP
.B \-ftarget-ar=\f[I]arname\fP
use the program \f[I]arname\fP to generate the archive
(see
.IR ar (1)).
.TP
.RB \-ftarget-ranlib=\f[I]ranlibname\fP
use the program \f[I]ranlibname\fP to perform the
.IR ranlib (1)
function.
.TP
.BI \-o " outputfile"
place the archive into
.I outputfile .
.TP
.BI \-\-startup " filename"
ensure that the scaffold \f[I]filename\fP is in the list of modules.
If it is absent then the \f[I]filename\fP.o or \f[I]filename\fP.lo is
added to the link archive.
.TP
.BI \-f\f[I]option\fP
pass this option to
.IR libtool .
.TP
.BI \-l libname
add
.I libname
to the link command.
.TP
.BI \-L path
use
.I path
as the path for
.IR libtool (1)
libraries.
.TP
.B
filename
is the text list of modules which require linking.
.SH "SEE ALSO"
.IR gm2l (1),
.IR gm2lgen (1),
.IR gm2lorder (1)
and
.IR gm2 (1).
---------------------------------------
New file: gm2tools/gm2lgen.1
---------------------------------------
.TH gm2lgen "1" "June 2021" "Modula-2" "User Commands"
.SH NAME
gm2lgen \- generates the main C function from a list of module names.
.SH SYNOPSIS
.B gm2lgen
.RB [ --exit ]
.RB [ -fcpp ]
.RB [ -fshared ]
.RB [ -h ]
.RB [ --help ]
.RB [ --main function ]
.RB [ -o " outputfile" ]
.RB [ --terminate ]
.RB [ inputfile ]
.SH DESCRIPTION
.PP
A tool for generating the main C or C++ function from a list of module
names.  It generates a sequence of constrictor and deconstructor calls
for each module specified.  See also the programs:
.IR gm2l (1)
.IR gm2lcc (1)
.IR gm2lorder (1).
The command line program
.IR gm2
can be instructed to automatically invoke
.IR gm2lgen (1)
and the above programs to construct a C++ scaffold for a Modula-2
application.
.SH OPTIONS
.TP
.B --exit
do not call exit at the end of the main function.
.TP
.B -fcpp
generate a C++ main program which will utilize a try exception
statement for dispatching the sequence of module initialization calls.
.TP
.B -fshared
generate a scaffold which can be compiled as a shared library.
.TP
.B -h
issue a summary help.
.TP
.B --help
equivalent to
.B -h\fR.
.TP
.B --terminate
do not call M2RTS_Terminate at the end of the main function.
.TP
.B -o
output file.  Place scaffold into the output file.
.SH "SEE ALSO"
.IR gm2l (1),
.IR gm2lcc (1),
.IR gm2lorder (1)
and
.IR gm2 (1).
---------------------------------------
New file: gm2tools/gm2lorder.1
---------------------------------------
.TH gm2lorder "1" "June 2021" "Modula-2" "User Commands"
.SH NAME
gm2lorder \- reorder the list of modules.
.SH SYNOPSIS
.B gm2lorder
.RB [ -h ]
.RB [ --help ]
.RB [ -fruntime-modules=\f[I]modulelist\fP ]
.RB [ -o " outputfile" ]
\fIinputfile\fR
.SH DESCRIPTION
.PP
A tool for reordering the list of modules used when creating a
Modula-2 application.  The
.I inputfile
is a text list of module names which are to be linked and an
appropriate constructor/deconstructor scaffold will be created.
The order of the module list determines the initialization order of
each module.
.IR gm2lorder
allows the user to specify the start order of the text list.
For example if the user wanted to force the modules:
.I a,b,c
and the modulelist in the input file specified:
.sp
.nf
\f[C]d
e
f
a
g
b
h
c
i\fP
.fi
.sp
the user could invoke
.I gm2lorder
using:
.sp
\fCgm2lorder -fruntime-modules=a,b,c -o outputfile inputfile\fP
.sp
the
.I outputfile
would contain a reordered list containing:
.sp
.nf
\f[C]a
b
c
d
e
f
g
h
i\fP
.fi
.sp
.I gm2lorder
checks to see whether any module specified in the comma separated
runtime-module list is present in the input file.  If it is not found
in the input file then this module is ignored.
Any remainaing module specified by
.I -fruntime-modules=
is placed to the front of the list and any subsequent element in the
list containing one of these runtime modules is removed.
.PP
The
textual list of modules can be manipulated and used by the other
Modula-2 link tools:
.IR gm2lcc (1)
.IR gm2lgen (1)
.IR gm2lorder (1).
The command line program
.IR gm2
can be instructed to automatically invoke
.IR gm2l (1)
and the above programs to construct a C++ scaffold for a Modula-2
application.
.SH OPTIONS
.TP
.B -fruntime-modules= listofmodules
the
.I listofmodules
is a comma separated list of modules which the prepended to the list
of modules in the
.I inputfile .
All subsequent occurances of this module in the
.I inputfile
will be removed.
.TP
.B -h
issue a summary help.
.TP
.B --help
equivalent to
.B -h\fR.
.TP
.BI \-o " outputfile"
place the archive into
.I outputfile .
.SH
DEFAULTS
.PP
By default gm2lorder will force the following module order:
.I Storage,SYSTEM,M2RTS,RTExceptions,IOLink .
If any of the comma separated modules is not used by the application
(and not in the
.I inputfile )
then the module is
.I not
included into the outputfile.
.SH "SEE ALSO"
.IR gm2l (1),
.IR gm2lcc (1),
.IR gm2lgen (1)
and
.IR gm2 (1).
---------------------------------------
New file: gm2tools/m2color.c
---------------------------------------
/* m2color.c interface to gcc colorization.

Copyright (C) 2021-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius@glam.ac.uk>.

This file is part of GNU Modula-2.

GNU Modula-2 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.

GNU Modula-2 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 GNU Modula-2; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.  */

#define m2color_c

extern "C" {

const char *m2color_colorize_start (bool show_color, char *name, unsigned int name_len)
{
  return "";
}

const char *m2color_colorize_stop (bool show_color)
{
  return "";
}


void _M2_m2color_init ()
{
}


void  _M2_m2color_finish ()
{
}

}
---------------------------------------
New file: gm2tools/Makefile.am
---------------------------------------
# Makefile for gm2tools
#   Copyright (C) 2021-2022 Free Software Foundation, Inc.
#
# This file 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 of the License, or
# (at your option) any later version.
#
# This program 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 this program; see the file COPYING3.  If not see
# <http://www.gnu.org/licenses/>.

ACLOCAL_AMFLAGS = -I ../config

gcc_version := $(shell $(GCC_FOR_TARGET) -dumpversion)

libexecsubdir = $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version)

mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
PWD_COMMAND = $${PWDCMD-pwd}
STAMP = echo timestamp >

LIBSTDCXXPATH = ../$(TARGET_SUBDIR)/libstdc++-v3/src/.libs
LIBSTDCXX = ../$(TARGET_SUBDIR)/libstdc++-v3/src/.libs/libstdc++.a
LIBM2PIMPATH = ../$(TARGET_SUBDIR)/libgm2/libm2pim/.libs
LIBM2CORPATH = ../$(TARGET_SUBDIR)/libgm2/libm2cor/.libs
LIBM2ISOPATH = ../$(TARGET_SUBDIR)/libgm2/libm2iso/.libs
LIBM2 = $(LIBM2PIMPATH)/libm2pim.a $(LIBM2ISOPATH)/libm2iso.a

libgm2dir = ../$(target_noncanonical)/libgm2
LIBGM2DEP = $(libgm2dir)/libgm2.la
m2srcdir = $(srcdir)/../gcc/m2
m2builddir = ../gcc/m2
PGE = $(m2builddir)/pge$(exe)
DEBUG_MODULE_LIST = # -fmodules

LIBS = ../libiberty/xmalloc.o ../libiberty/xexit.o \
       m2color.o m2linemap.o ../libiberty/choose-temp.o \
       ../libiberty/xstrdup.o ../libiberty/pexecute.o \
       ../libiberty/make-temp-file.o ../gcc/m2/gm2-ici/m2flex.o \
       errors.o

if NATIVE
# Use the compiler we just built.
GCCCOMPILER = $(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET)
GXXCOMPILER = $(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET)
GM2COMPILER = $(GM2_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) -B$(m2builddir)/../ -g -fm2-g
GM2LINK = $(GM2_FOR_TARGET) -B$(m2builddir)/../ -g -fm2-g
else
GCCCOMPILER = $(CC)
GM2COMPILER = $(GM2)
GM2LINK = $(GM2)
endif

GM2CFLAGS = $(CFLAGS_FOR_TARGET)
GM2COMPILE = $(GM2COMPILER) $(GM2CFLAGS)
GM2TOOLSINC = -I$(m2srcdir)/gm2-libs -I$(m2srcdir)/gm2-libiberty -I$(m2srcdir)/gm2-compiler -I$(m2srcdir)/gm2-gcc

AM_GM2CFLAGS = -I $(libgm2dir)
AM_LDFLAGS = -L $(libgm2dir) -L $(libgm2dir)/.libs

if NATIVE

GM2DEPS = ../gcc/cc1gm2$(EXEEXT) \
  ../gcc/m2/gm2-compiler-boot/gm2.a \
  ../gcc/m2/gm2-libs-boot/libgm2.a \
  ../gcc/m2/ppg$(exeext) \
  $(GM2_LIBS)

# For a native build we build the programs using the newly built libgm2
# and install them as regular programs.

# gm2m is built in gcc/m2 as it is internal to gm2.

bin_PROGRAMS = gm2l gm2lcc gm2lgen gm2lorder

MODULES = ASCII.o Assertion.o Break.o CmdArgs.o Debug.o DynamicStrings.o \
          FIO.o FormatStrings.o IO.o Indexing.o Lists.o M2ColorString.o \
          M2Configure.o M2Debug.o M2Defaults.o M2Depth.o M2DriverOptions.o \
          M2EXCEPTION.o M2Emit.o M2Error.o M2FileName.o M2LexBuf.o \
          M2Options.o M2Preprocess.o M2Printf.o M2RTS.o M2Reserved.o \
          M2Search.o M2Version.o NameKey.o NumberIO.o ObjectFiles.o \
          RTExceptions.o SArgs.o SEnvironment.o SFIO.o SYSTEM.o StdIO.o \
          Storage.o StrIO.o StrLib.o StringConvert.o SymbolKey.o SysExceptions.o \
          SysStorage.o UnixArgs.o choosetemp.o dtoa.o errno.o ldtoa.o m2color.o \
          m2linemap.o termios.o wrapc.o errors.o

# noinst_PROGRAMS = ppg$(EXEEXT)
man_MANS = gm2lgen.1 gm2l.1 gm2lcc.1 gm2lorder.1

gm2lcc: $(MODULES) gm2lcc.o
	grep -v mod_init $(m2srcdir)/init/gm2lccinit > gm2lcc.lst
	$(GM2COMPILER) -fuselist $(DEBUG_MODULE_LIST) -c -I$(m2builddir)/gm2-libs -I$(m2builddir)/gm2-compiler \
               -I$(m2srcdir)/gm2-libs -I$(m2srcdir)/gm2-compiler \
               -g -B./ $(m2srcdir)/gm2-compiler/gm2lcc.mod
	$(GM2LINK) -flibs=pim,iso -I$(m2builddir)/gm2-libs -I$(m2builddir)/gm2-compiler \
               -I$(m2srcdir)/gm2-libs -I$(m2srcdir)/gm2-compiler -g -B../gcc/stage1/gm2 -B../gcc -o $@ \
               -fuselist $(m2srcdir)/gm2-compiler/gm2lcc.mod -L$(LIBSTDCXXPATH) -L$(LIBM2PIMPATH) -L$(LIBM2ISOPATH) $(LIBS)

gm2l: $(MODULES) gm2l.o
	grep -v mod_init $(m2srcdir)/init/gm2linit > gm2l.lst
	$(GM2COMPILER) -fuselist $(DEBUG_MODULE_LIST) -c \
               -I$(m2builddir)/gm2-libs -I$(m2builddir)/gm2-compiler \
               -I$(m2builddir)/gm2-ici $(GM2TOOLSINC) -I../libiberty \
               -g -B./ gm2l.mod
	$(GM2LINK) -flibs=pim,iso -fuselist -I$(m2builddir)/gm2-libs -I$(m2builddir)/gm2-compiler \
               -I$(m2builddir)/gm2-libs -I$(m2builddir)/gm2-compiler \
               -I$(m2builddir)/gm2-ici $(GM2TOOLSINC) -I../libiberty \
               -g -B../gcc/stage1/gm2 -B../gcc -o $@ \
               gm2l.mod -L$(LIBSTDCXXPATH) -L$(LIBM2PIMPATH) -L$(LIBM2ISOPATH) $(LIBS)

gm2lgen: $(MODULES) gm2lgen.o
	grep -v mod_init $(m2srcdir)/init/gm2lgeninit > gm2lgen.lst
	$(GM2COMPILER) -fuselist $(DEBUG_MODULE_LIST) -c -I$(m2builddir)/gm2-libs -I$(m2builddir)/gm2-compiler \
               -I$(m2srcdir)/gm2-libs -I$(m2srcdir)/gm2-compiler \
               -g -B./ $(m2srcdir)/gm2-compiler/gm2lgen.mod
	$(GM2LINK) -flibs=pim,iso -I$(m2builddir)/gm2-libs -I$(m2builddir)/gm2-compiler \
               -I$(m2srcdir)/gm2-libs -I$(m2srcdir)/gm2-compiler -g -B../gcc/stage1/gm2 -B../gcc -o $@ \
               -fuselist $(m2srcdir)/gm2-compiler/gm2lgen.mod -L$(LIBSTDCXXPATH) -L$(LIBM2PIMPATH) -L$(LIBM2ISOPATH) $(LIBS)

gm2lorder: $(MODULES) gm2lorder.o
	grep -v mod_init $(m2srcdir)/init/gm2lorderinit > gm2lorder.lst
	$(GM2COMPILER) -fuselist $(DEBUG_MODULE_LIST) -c -I$(m2builddir)/gm2-libs -I$(m2builddir)/gm2-compiler \
               -I$(m2srcdir)/gm2-libs -I$(m2srcdir)/gm2-compiler \
               -g -B./ $(m2srcdir)/gm2-compiler/gm2lorder.mod
	$(GM2LINK) -flibs=pim,iso -I$(m2builddir)/gm2-libs -I$(m2builddir)/gm2-compiler \
               -I$(m2srcdir)/gm2-libs -I$(m2srcdir)/gm2-compiler -g -B../gcc/stage1/gm2 -B../gcc -o $@ \
               -fuselist $(m2srcdir)/gm2-compiler/gm2lorder.mod -L$(LIBSTDCXXPATH) -L$(LIBM2PIMPATH) -L$(LIBM2ISOPATH) $(LIBS)

gm2m: $(GM2DEPS) $(GM2_LIBS) $(GM2_LINK_TOOLS_BOOT) $(LIBSTDCXX) $(MODULES) gm2m.o
	grep -v mod_init $(m2srcdir)/init/gm2minit > gm2m.lst
	$(GM2COMPILER) -fuselist $(DEBUG_MODULE_LIST) -c \
               -I$(m2builddir)/gm2-libs -I$(m2builddir)/gm2-compiler \
               -I$(m2builddir)/gm2-ici $(GM2TOOLSINC) -I../libiberty \
               -g -B./ gm2m.mod
	$(GM2LINK) -flisb=pim,iso -fuselist -I$(m2builddir)/gm2-libs -I$(m2builddir)/gm2-compiler \
               -I$(m2builddir)/gm2-libs -I$(m2builddir)/gm2-compiler \
               -I$(m2builddir)/gm2-ici $(GM2TOOLSINC) -I../libiberty \
               -g -B../gcc/stage1/gm2 -B../gcc -o $@ \
               gm2m.mod -L$(LIBSTDCXXPATH) $(LIBS) -L$(LIBM2PIMPATH) -L$(LIBM2ISOPATH) $(LIBS)

m2color.o: m2color.c
	$(GXXCOMPILER) -g -c -g -c -I../gcc -I../gcc/m2/gm2-libiberty \
                       -I$(srcdir)/../include -I$(srcdir)/../gcc -I$(m2builddir)/../ $<

errors.o: errors.c
	$(GXXCOMPILER) -g -c -g -c -I../gcc -I../gcc/m2/gm2-libiberty \
                       -I$(srcdir)/../include -I$(srcdir)/../gcc -I$(m2builddir)/../ $<

%.o: $(m2srcdir)/gm2-ici/%.mod
	$(GM2COMPILER) -g -c -I$(m2srcdir)/gm2-libs -I$(m2srcdir)/gm2-compiler -I$(m2srcdir)/gm2-gcc \
        -I$(m2srcdir)/gm2-libiberty -I$(m2srcdir)/gm2-ici $<

%.o: $(m2srcdir)/gm2-libs/%.mod
	$(GM2COMPILER) -g -c -I$(m2srcdir)/gm2-libs $<

%.o: $(m2srcdir)/gm2-compiler/%.mod
	$(GM2COMPILER) -g -c -I$(m2srcdir)/gm2-libs -I$(m2srcdir)/gm2-compiler -I$(m2srcdir)/gm2-gcc \
        -I$(m2srcdir)/gm2-libiberty -I$(m2srcdir)/gm2-gcc $<

%.o: $(m2srcdir)/gm2-libs-ch/%.c
	$(GCCCOMPILER) -g -c -I../gcc -I../gcc/m2/gm2-libiberty \
                       -I../gcc/m2/gm2-libs-boot \
                       -I$(srcdir)/../include -I$(m2builddir)/../ -I$(m2builddir)/gm2-libs -I$(m2builddir)/gm2-gcc -I$(srcdir)/../gcc $<

%.o: $(m2builddir)/gm2-compiler-boot/%.mod
	$(GM2COMPILER) -g -c -I$(m2srcdir)/gm2-libs -I$(m2srcdir)/gm2-compiler -I$(m2srcdir)/gm2-gcc \
        -I$(srcdir)/gm2-gcc $<

m2linemap.o: $(m2srcdir)/gm2-ici/m2linemap.c
	$(GCCCOMPILER) -g -c -I$(srcdir)/../include -I$(m2builddir)/../ -I$(m2builddir)/gm2-libs -I$(m2builddir)/gm2-gcc -I$(srcdir)/../gcc $<

%.o: $(m2srcdir)/gm2-gcc/%.c
	$(GXXCOMPILER) -g -c -I$(srcdir)/../include -I$(m2builddir)/../ -I$(m2builddir)/gm2-libs -I$(m2builddir)/gm2-gcc -I$(srcdir)/../gcc -I$(srcdir)/../libcpp/include $<

gm2l.o: gm2l.mod
	$(GM2COMPILER) -g -c $(GM2TOOLSINC) $<

gm2l.mod: $(m2srcdir)/bnf/gm2l.bnf
	$(PGE) -l $< > $@

gm2m.o: gm2m.mod
	$(GM2COMPILER) -g -c -I$(m2srcdir)/gm2-libs -I$(m2srcdir)/gm2-compiler -I$(m2srcdir)/gm2-gcc $<

gm2m.mod: $(m2srcdir)/bnf/gm2m.bnf
	$(PGE) -l $< > $@

install-exec-local: $(noinst_PROGRAMS)
	$(MKDIR_P) $(DESTDIR)$(libexecsubdir)
	for f in $(noinst_PROGRAMS); do \
	  rm -f $(DESTDIR)$(libexecsubdir)/$$f; \
	  $(INSTALL_PROGRAM) $$f $(DESTDIR)$(libexecsubdir)/$$f; \
	done

uninstall-local:
	for f in $(noinst_PROGRAMS); do \
	  rm -f $(DESTDIR)$(libexecsubdir)/$$f; \
	done

else

# For a non-native build we have to build the programs using a
# previously built host (or build -> host) gm2 compiler.  We should
# only do this if such a compiler is available.

endif


More information about the Gcc-patches mailing list