[M3devel] Multiple executables from the same source

Rodney M. Bates rodney_bates at lcwb.coop
Mon Jul 8 17:51:41 CEST 2013



On 07/06/2013 09:11 PM, Hendrik Boom wrote:
> I'm writiing and debugging a bunch of interfaces and modules.
> They are all supposed to fit together into one happy executable.
>
> But of course, until I've finished debugging them
>    they fit together into one unhappy executable.
> To test them properly I'd like to write a series of unit tests.
> To run these tests I will need  to make further executables,
>    each consisting of a test modules and several of the modules under test.
>
> Now with the usual structure of a Modula 3 workspace,
>    there is one m3makefile and a src directory, and it makes one executable,
>    not many,
>    and it doesn't really give me a choice of which executable I want.
>
> In the old days of C code and Makefiles, I could have multiple targets
>    each one being built with its own cc command
>    with its own list of source files names.
>
> Is there anything comparable for Modula 3?
>
> The best I've come up sith so far is to have a number of directories,
>    one for each test case,
>    with its own m3makefile and its own symbolic link to a common src directory.

I have one project with three executables and a majority of the code shared.  I
am using essentially this scheme, but instead of the symlinks in the directories,
I have 'include_dir("../common/src")' in the m3makefiles of the main programs.
common/src has its m3makefile for all the stuff in common.

This means means every main program has to independently compile all the common
stuff and keep its own copies thereof.  But disk is cheap and plentiful,
and 200K..300K SLOC compiles from scratch fast enough.

Someday, when bored, I plan to make the common stuff a separate library package.
But then I will have to remember to recompile it when it changes, before
compiling a main package.

I have often thought about a second level of automatic, inter-package recompilation.
It would have saved me some grief on occasions.  But it could introduce new problems
too.

>
> Is there something better?
>
> I'm not really interested in having all the test code
>    be part of the final application.
>
> For one thing,
>    I'd like to be able to test multiple implementations of a single interface,
>    such as a reference implementation and an efficient one,
>    so that I can compare the output and complain about the differences.
>
> -- hendrik
>




More information about the M3devel mailing list