# Where to place @:build macros with module level fields

**URL:** https://community.haxe.org/t/where-to-place-build-macros-with-module-level-fields/4273
**Category:** Haxe
**Created:** [June 25, 2024, 3:41pm UTC](https://community.haxe.org/t/where-to-place-build-macros-with-module-level-fields/4273 "2024-06-25T15:41:43Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![neimanpinchas](https://community.haxe.org/user_avatar/community.haxe.org/neimanpinchas/32/2348_2.png) [@neimanpinchas](https://community.haxe.org/u/neimanpinchas)
#### Post date: [June 25, 2024, 3:41pm UTC](https://community.haxe.org/t/where-to-place-build-macros-with-module-level-fields/4273/1 "2024-06-25T15:41:43Z")

</div>

I like MLFs [Module-level fields are here! - Haxe - The Cross-platform Toolkit](https://community.haxe.org/t/module-level-fields-are-here-haxe-the-cross-platform-toolkit/2475) because it makes the code cleaner, by not requiring the class keyboard, or public static on every ivocation.

How can i use it with build macro annonations?

---

<div class="post-metadata">

### Author: ![back2dos](https://community.haxe.org/user_avatar/community.haxe.org/back2dos/32/30_2.png) [@back2dos](https://community.haxe.org/u/back2dos)
#### Post date: [June 26, 2024, 6:57am UTC](https://community.haxe.org/t/where-to-place-build-macros-with-module-level-fields/4273/2 "2024-06-26T06:57:40Z")

</div>

You can add `--macro addGlobalMetadata('some.Module', '@:build(Tro.lolo())', false)` to you your build.

Or `--macro addGlobalMetada('', '@:build(Every.thing())')` to run a build macro across _all_ modules and then use something that is cheap to check against.

For example:

You could define a module called `SomePragma` (can be empty) and then in `Every.thing` do `if (!Lambda.exists(haxe.macro.Context.getLocalUsing(), c -> c.toString() == 'SomePragma')) return null` to bail out early in all modules that don’t have `using SomePragma;`

You can then also add `using SomePragma;` into an [`import.hx`](https://haxe.org/manual/type-system-import-defaults.html) to apply it to entire folders when so desired.
