Index: rtemsqual/interface.py
===================================================================
--- rtemsqual/interface.py	(revision 99c6449d6f67a993a9de26fb946c291ce4880414)
+++ rtemsqual/interface.py	(revision 0ee82263943d7ca1816e467f614b0da59d66e28e)
@@ -85,4 +85,11 @@
         raise KeyError
 
+    def enabled_by_to_defined(self, enabled_by: str) -> str:
+        """
+        Maps an item-level enabled-by attribute value to the corresponding
+        defined expression.
+        """
+        return self._node.header_file.enabled_by_defined[enabled_by]
+
 
 class _InterfaceExpressionMapper(ExpressionMapper):
@@ -93,4 +100,14 @@
     def map(self, symbol: str) -> str:
         return self._mapper.substitute(symbol)
+
+
+class _ItemLevelExpressionMapper(ExpressionMapper):
+    def __init__(self, mapper: _InterfaceMapper):
+        super().__init__()
+        self._mapper = mapper
+
+    def map(self, symbol: str) -> str:
+        return self._mapper.substitute(
+            self._mapper.enabled_by_to_defined(symbol))
 
 
@@ -188,7 +205,18 @@
             self.content.append(f"}} {name};")
 
+    def _generate(self) -> None:
+        _NODE_GENERATORS[self.item["interface-type"]](self)
+
     def generate(self) -> None:
         """ Generates a node to generate the node content. """
-        _NODE_GENERATORS[self.item["interface-type"]](self)
+        enabled_by = self.item["enabled-by"]
+        if enabled_by:
+            mapper = _ItemLevelExpressionMapper(self.mapper)
+            self.content.add(f"#if {enabled_by_to_exp(enabled_by, mapper)}")
+            with self.content.indent():
+                self._generate()
+            self.content.add("#endif")
+        else:
+            self._generate()
 
     def generate_compound(self) -> None:
@@ -364,14 +392,16 @@
 class HeaderFile:
     """ A header file. """
-    def __init__(self):
+    def __init__(self, enabled_by_defined: Dict[str, str]):
         self._content = CContent()
         self._ingroups = {}  # type: ItemMap
         self._includes = []  # type: List[Item]
         self._nodes = {}  # type: Dict[str, Node]
+        self.enabled_by_defined = enabled_by_defined
 
     def add_includes(self, item: Item) -> None:
         """ Adds the includes of the item to the header file includes. """
         for link in item.links_to_parents():
-            if link["role"] == "interface-placement":
+            if link["role"] == "interface-placement" and link.item[
+                    "interface-type"] == "header-file":
                 self._includes.append(link.item)
 
@@ -460,9 +490,10 @@
 
 
-def _generate_header_file(item: Item, domains: Dict[str, str]) -> None:
+def _generate_header_file(item: Item, domains: Dict[str, str],
+                          enabled_by_defined: Dict[str, str]) -> None:
     domain_path = domains.get(item["interface-domain"], None)
     if domain_path is None:
         return
-    header_file = HeaderFile()
+    header_file = HeaderFile(enabled_by_defined)
     header_file.generate_nodes(item)
     header_file.finalize(item)
@@ -471,9 +502,21 @@
 
 
-def _visit_header_files(item: Item, domains: Dict[str, str]) -> None:
+def _visit_header_files(item: Item, domains: Dict[str, str],
+                        enabled_by_defined: Dict[str, str]) -> None:
     for child in item.children():
-        _visit_header_files(child, domains)
+        _visit_header_files(child, domains, enabled_by_defined)
     if item["type"] == "interface" and item["interface-type"] == "header-file":
-        _generate_header_file(item, domains)
+        _generate_header_file(item, domains, enabled_by_defined)
+
+
+def _gather_enabled_by_defined(item_level_interfaces: List[str],
+                               item_cache: ItemCache) -> Dict[str, str]:
+    enabled_by_defined = {}  # type: Dict[str, str]
+    for uid in item_level_interfaces:
+        for link in item_cache[uid].links_to_children():
+            if link["role"] == "interface-placement":
+                define = f"defined(${{{link.item.uid}:/interface-name}})"
+                enabled_by_defined[link.item["interface-name"]] = define
+    return enabled_by_defined
 
 
@@ -485,4 +528,7 @@
     :param item_cache: The specification item cache containing the interfaces.
     """
+    enabled_by_defined = _gather_enabled_by_defined(
+        config["item-level-interfaces"], item_cache)
     for item in item_cache.top_level.values():
-        _visit_header_files(item, config["interface-domains"])
+        _visit_header_files(item, config["interface-domains"],
+                            enabled_by_defined)
Index: rtemsqual/tests/spec-interface/asm.yml
===================================================================
--- rtemsqual/tests/spec-interface/asm.yml	(revision 0ee82263943d7ca1816e467f614b0da59d66e28e)
+++ rtemsqual/tests/spec-interface/asm.yml	(revision 0ee82263943d7ca1816e467f614b0da59d66e28e)
@@ -0,0 +1,17 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: []
+interface-brief: null
+interface-description: null
+interface-name: ASM
+interface-definition:
+  defaults: null
+  variants: []
+interface-type: define
+links:
+- role: interface-placement
+  uid: command-line
+- role: other
+  uid: command-line
+type: interface
Index: rtemsqual/tests/spec-interface/command-line.yml
===================================================================
--- rtemsqual/tests/spec-interface/command-line.yml	(revision 0ee82263943d7ca1816e467f614b0da59d66e28e)
+++ rtemsqual/tests/spec-interface/command-line.yml	(revision 0ee82263943d7ca1816e467f614b0da59d66e28e)
@@ -0,0 +1,8 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: []
+interface-domain: command-line
+interface-type: command-line
+links: []
+type: interface
Index: rtemsqual/tests/spec-interface/var.yml
===================================================================
--- rtemsqual/tests/spec-interface/var.yml	(revision 99c6449d6f67a993a9de26fb946c291ce4880414)
+++ rtemsqual/tests/spec-interface/var.yml	(revision 0ee82263943d7ca1816e467f614b0da59d66e28e)
@@ -2,5 +2,6 @@
 copyrights:
 - Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
-enabled-by: []
+enabled-by:
+  not: ASM
 interface-brief: Variable brief description.
 interface-definition:
Index: rtemsqual/tests/test_interface.py
===================================================================
--- rtemsqual/tests/test_interface.py	(revision 99c6449d6f67a993a9de26fb946c291ce4880414)
+++ rtemsqual/tests/test_interface.py	(revision 0ee82263943d7ca1816e467f614b0da59d66e28e)
@@ -38,4 +38,5 @@
 
     interface_config = {}
+    interface_config["item-level-interfaces"] = []
     base_directory = os.path.join(tmpdir, "base")
     interface_domains = {"abc": base_directory}
@@ -44,4 +45,6 @@
     item_cache_config["paths"] = [os.path.normpath(tmpdir)]
     generate(interface_config, ItemCache(item_cache_config))
+
+    interface_config["item-level-interfaces"] = ["/command-line"]
 
     spec_src = os.path.join(os.path.dirname(__file__), "spec-interface")
@@ -313,12 +316,14 @@
 #endif
 
-/**
- * @ingroup GroupC
- *
- * @brief Variable brief description.
- *
- * Variable description.
- */
-extern struct Struct *Variable;
+#if !defined(ASM)
+  /**
+   * @ingroup GroupC
+   *
+   * @brief Variable brief description.
+   *
+   * Variable description.
+   */
+  extern struct Struct *Variable;
+#endif
 
 #ifdef __cplusplus
