Haxe:是否有指示当前编译目标的定义?

Haxe: Are there defines indicating the current compilation target?

Haxe有没有说明当前编译目标的定义,可用于条件编译?

是的,每个 Haxe 目标都有自己的定义。

#if js 
  trace("js");
#elseif php
  trace("php");
#elseif cpp
  trace("cpp");
#elseif java
  trace("java");
#elseif python
  trace("python");
#elseif neko
  trace("neko");
#elseif sys
  trace("sys");
#elseif flash
  trace("flash");
#elseif cs
  trace("cs");
#elseif macro
  trace("macro");
#end

You can find more build-in compilation flags here:
http://haxe.org/manual/lf-condition-compilation-flags.html

More info about conditional compilation:
http://haxe.org/manual/lf-condition-compilation.html