Or even just use trace.
class Test()
{
static function main()
{
#if java
var language = 'java';
#elseif js
var language = 'js';
#elseif cs
var language = 'csharp';
#elseif php
var language = 'PHP'
#elseif (flash||flash8)
var language = 'flash';
#elseif cpp
var language = 'c++';
#elseif neko
var language = 'neko';
#elseif tamarin
var language = 'tamarin';
#end
trace( language );
}
}
But it should be noted that the hxml for compiling this would need to have each target specified in theory it would be something generic like...
-java java
-main Test
--next
-js test.js
-main Test
--next
-cs cs
-main Test
--next
-php www
-main Test
--next
-swf test8.swf
-swf-version 8
-main Test
--next
-swf test.swf
-swf-version 9
-main Test
--next
-neko neko
--main Test
But in practice you will probably want to add other compiler flags and even use -cmd to actually run examples.
Getting started with a range of targets...
'http://haxe.org/doc/start/
conditional compilation
'http://haxe.org/ref/conditionals
compiler flags and options, although I may have missed a link.
'http://haxe.org/manual/tips_and_tricks
'http://haxe.org/doc/compiler
Then target magic
'http://haxe.org/doc/advanced/magic
For each target you can use generic haxe api along with target specific libraries named after the target
'http://haxe.org/api
My first reply on Stackoverflow so sorry if it's a bit verbose :) also the reason I can't post proper links (limited to two).