gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tales of mc


From: john o goyo
Subject: Re: Tales of mc
Date: Sat, 10 Sep 2022 22:01:48 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.10.0

Greetings, Gaius.

Thank you for the information below. (I actually tee'd the build output to see the build commands.)

I am able to translate and build simple modules using the empty m2/gm2-libs-min/SYSTEM.mod.  Trying to compile the SYSTEM in m2/gm2-libs-min/SYSTEM.mod led me to a question.  I know that mc is a boot-strapping tool that does not translate all of Modula-2. How much does it understand?

For example, gcc/m2/mc/README states that local modules and (most) aggregates are unsupported.  However, I found that SHIFT() is not known to it.

Sincerely,
john


On 2022-09-02 18:09, Gaius Mulley wrote:
Hello John,

sure, mc doesn't create a main function - it only translates modules
into C/C++ modules.
The main (scaffold) needs to be created and it will need to call each
modulename_init and
modulename_finish function in order.  This is accomplished by using
another small program
mklink which takes input a list of modules and creates a main with an
ordered sequence of
calls to the modulename_init / finish.  Here are the rules from
gcc/m2/Make-lang.in which
creates the main for mc itself.

M2LINK=m2/boot-bin/mklink$(exeext)

m2/boot-bin/mklink$(exeext): $(srcdir)/m2/tools-src/mklink.c
         $(CXX) $(CFLAGS) -I$(srcdir)/m2 -Im2/gm2-libs-boot
-Im2/gm2-compiler-boot -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) $< -o $@

m2/mc-boot/main.o: $(M2LINK) $(srcdir)/m2/init/mcinit
         unset CC ; $(M2LINK) -s --langc++ --exit --name mainmcinit.c
$(srcdir)/m2/init/mcinit
         mv mainmcinit.c m2/mc-boot/main.c
         $(CXX) -g -c -I. -I$(srcdir)/../include -I$(srcdir)
$(INCLUDES) m2/mc-boot/main.c -o $@


hope this helps,
regards,
Gaius

On Fri, Sep 2, 2022 at 4:53 PM john o goyo <jog37@riddermarkfarm.ca> wrote:
Greetings.

I now have a makefile that builds mc directly from the git repository as
pulled down.  Several header and source files are local as they were
generated during the build. Now, I need to know how the main() function
is created -- nothing in the help message seems to indicate how.

Gaius, please assist.

Sincerely,
john





reply via email to

[Prev in Thread] Current Thread [Next in Thread]