[Mono-list] Providing Dynamic Makefile Defaults
Jonathan Pryor
jonpryor@vt.edu
10 Jan 2003 07:40:58 -0500
There's just one problem with this suggestion: the module that
type-reflector is in (mcs) doesn't have an autoconf configure script.
I found a different solution. Non-ideal, but it works. Have a
"recursive" make (that actually invokes itself) that attempts to build
the specified target. Chain several calls together in this fashion.
For example:
all:
make gui-all || make gtk || make swf || make console
In this case, "make console" should *always* build, so a valid
executable should always be generated.
The downside with this is extra overhead. On my Windows box (which
doesn't have Gtk# installed) it has to attempt building 3 times, as
gui-all and gtk both fail before swf correctly builds.
As I said, non-ideal. But it works.
In the future I'll probably move the different front-ends into different
assemblies (dlls), so I can do the same trick for each front-end
assembly but not worry about attempting to recompile ~56 source files.
I'm not sure when I would implement this.
- Jon
On Thu, 2003-01-09 at 18:42, Peter Williams wrote:
> On Thu, 2003-01-09 at 18:10, Jonathan Pryor wrote:
> > ...
> >
> > Is there a reasonable way to use "console" as the fallback target, and
> > use "gtk" or "swf" if the appropriate libraries are installed?
>
> The standard way to do this would be
>
> 1. create makefile.gnu.in that has something along the lines of:
>
> TYPE_REFLECTOR_TARGET = @TYPE_REFLECTOR_TARGET@
>
> all: makefile.gnu $(TYPE_REFLECTOR_TARGET)
>
> swf:
> blah
>
> console:
> blah
>
> gtk:
> blah
>
> makefile.gnu: ../../config.status makefile.gnu.in
> cd ../.. && CONFIG_FILES=foo/bar/makefile.gnu CONFIG_HEADERS =
> ./config.status
>
> 2. Add a necessary configure check that does
>
> blah blah checks...
> TYPE_REFLECTOR_TARGET=[one of console, swf, gtk]
> AC_SUBST(TYPE_REFLECTOR_TARGET)
>
> AC_OUTPUT([stuff that's already there, foo/bar/makefile.gnu])
>
> 3. Remove makefile.gnu from cvs
>
> So that the configure process will generate a makefile that has the
> correct target embedded in itself, and it will recreate the makefile if
> config.status changes or the makefile template changes.
>
> Peter