[Mono-list] Providing Dynamic Makefile Defaults

Peter Williams peter@newton.cx
09 Jan 2003 18:42:40 -0500


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

-- 
Peter Williams     peter@newton.cx / peterw@ximian.com

"[Ninjas] are cool; and by cool, I mean totally sweet."
                              -- REAL Ultimate Power