gm2
[Top][All Lists]
Advanced

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

Re: Tales of mc


From: Gaius Mulley
Subject: Re: Tales of mc
Date: Fri, 2 Sep 2022 23:14:33 +0100

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 11:09 PM Gaius Mulley <mulley.gaius@gmail.com> 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]