#if, #ifdef Nesting
You can nest #ifdef's within #if's, and vice-versa, throughout the config files. Per-machine #if directives take precedence over logical #ifdef directives. So, for example,
#if linux [ aaa ... ] #ifdef paranoid [ bbb ... ] #endifdef [ ccc ... ] #endifwould have the aaa, bbb & ccc content appear only on linux machines, and the bbb content only if paranoid is set (defined). On the other hand, with
#ifdef paranoid [ aaa ... ] #if linux [ bbb ... ] #endif [ ccc ... ] #endifdefthe aaa and ccc content would appear on all machines, if paranoid is set, while the bbb content would appear only on linux machines with paranoid defined.
This, however, would lead to error on non-linux systems:
#ifdef paranoid [ aaa ... ] #if linux [ bbb ... ] #endifdef [ ccc ... ] #endifbecause there would be no concluding #endifdef on those machines. In other words, be careful about intertwining #if-#endif's with #ifdef-#endifdef's.
Observe that you can set/unset defines on a per-machine basis in the defines.cfg file, for example
#if dbserver paranoid TRUE #else paranoid FALSE #endifOr, alternatively and equivalently,
paranoid #if dbserver TRUE #else FALSE #endif
![]() | next page ![]() |