Browse Source

define `static` on static targets

Simon Krajewski 8 years ago
parent
commit
fcc537daad
3 changed files with 4 additions and 2 deletions
  1. 1 1
      src/compiler/main.ml
  2. 1 1
      src/context/common.ml
  3. 2 0
      src/core/define.ml

+ 1 - 1
src/compiler/main.ml

@@ -88,7 +88,7 @@ let error ctx msg p =
 
 let reserved_flags = [
 	"cross";"js";"lua";"neko";"flash";"php";"cpp";"cs";"java";"python";
-	"as3";"swc";"macro";"sys"
+	"as3";"swc";"macro";"sys";"static"
 	]
 
 let delete_file f = try Sys.remove f with _ -> ()

+ 1 - 1
src/context/common.ml

@@ -715,7 +715,7 @@ let init_platform com pf =
 	let forbid acc p = if p = name || PMap.mem p acc then acc else PMap.add p Forbidden acc in
 	com.package_rules <- List.fold_left forbid com.package_rules (List.map platform_name platforms);
 	com.config <- get_config com;
-(*	if com.config.pf_static then define com "static"; *)
+	if com.config.pf_static then define com Define.Static;
 	if com.config.pf_sys then define com Define.Sys else com.package_rules <- PMap.add "sys" Forbidden com.package_rules;
 	raw_define com name
 

+ 2 - 0
src/core/define.ml

@@ -91,6 +91,7 @@ type strict_defined =
 	| ShallowExpose
 	| SourceHeader
 	| SourceMapContent
+	| Static
 	| Swc
 	| SwfCompressLevel
 	| SwfDebugPassword
@@ -202,6 +203,7 @@ let infos = function
 	| ShallowExpose -> "shallow-expose",("Expose types to surrounding scope of Haxe generated closure without writing to window object",[Platform Js])
 	| SourceHeader -> "source-header",("Print value as comment on top of generated files, use '' value to disable",[])
 	| SourceMapContent -> "source-map-content",("Include the hx sources as part of the JS source map",[Platform Js])
+	| Static -> "static",("Defined if the current target is static",[])
 	| Swc -> "swc",("Output a SWC instead of a SWF",[Platform Flash])
 	| SwfCompressLevel -> "swf_compress_level",("<level:1-9> Set the amount of compression for the SWF output",[Platform Flash])
 	| SwfDebugPassword -> "swf_debug_password",("Set a password for debugging",[Platform Flash])