@@ -2,8 +2,8 @@ How to specify global build defines and options
22===============================================
33
44To create global defines for a Sketch, create a file with a name based
5- on your sketch’s file name followed by ``.globals.h `` in the Sketch folder.
6- For example, if the main Sketch file is named
5+ on your sketch’s file name followed by ``.globals.h `` in the Sketch
6+ folder. For example, if the main Sketch file is named
77``LowWatermark.ino ``, its global defines file would be
88``LowWatermark.ino.globals.h ``. This file will be implicitly included
99with every module built for your Sketch. Do not directly include it in
@@ -21,9 +21,10 @@ command option.
2121Actions taken in processing comment block to create ``build.opt `` \* for
2222each line, white space is trimmed \* blank lines are skipped \* lines
2323starting with ``* ``, ``// ``, or ``# `` are skipped \* the remaining
24- results are written to build tree\ ``/core/build.opt `` \* ``build.opt ``
25- is finished with a ``-include ... `` command, which references the global
26- .h its contents were extracted from.
24+ results are written to build tree\ ``/core/build.opt `` \* multiple
25+ ``/*@create-file:build.opt@ `` ``*/ `` comment blocks are not allowed \*
26+ ``build.opt `` is finished with a ``-include ... `` command, which
27+ references the global .h its contents were extracted from.
2728
2829Example Sketch: ``LowWatermark.ino ``
2930
@@ -72,7 +73,7 @@ Global ``.h`` file: ``LowWatermark.ino.globals.h``
7273 #endif
7374
7475 #if defined(__cplusplus)
75- // Defines kept private to .cpp modules
76+ // Defines kept private to .cpp and .ino modules
7677 //#pragma message("__cplusplus has been seen")
7778 #define MYTITLE2 "Empty"
7879 #endif
@@ -93,14 +94,14 @@ Aggressive Caching of ``core.a``
9394
9495Using global defines or compiler command-line options will lead to bad
9596builds when the **Aggressively cache compiled core ** feature is enabled.
96- When ``#define `` changes require ``core.a `` to be recompiled, and
97- multiple Sketches are open, they can no longer reliably share one cached
97+ When ``#define `` changes require rebuilding ``core.a `` and multiple
98+ Sketches are open, they can no longer reliably share one cached
9899``core.a ``. In a simple case: The 1st Sketch to be built has its version
99100of ``core.a `` cached. Other sketches will use this cached version for
100101their builds.
101102
102103To turn this off, you need to find the location of ``preferences.txt ``.
103- Using the Arduino IDE, go to *File->Preferences *. Make note of the path
104+ From the Arduino IDE, go to *File->Preferences *. Make note of the path
104105to ``prefereces.txt ``. You cannot edit the file while the Arduino IDE is
105106running. Close all Arduino IDE windows and edit the file
106107``preferences.txt ``. Change ``compiler.cache_core=true `` to
@@ -113,11 +114,12 @@ Sketch that uses global defines.
113114Other build confusion
114115=====================
115116
116- 1. Renaming files does not change the last modified timestamp, possibly
117- causing issues when replacing files by renaming and rebuilding. A good
117+ 1. Renaming a file does not change the last modified timestamp, possibly
118+ causing issues when adding a file by renaming and rebuilding. A good
118119 example of this problem would be to have then fixed a typo in file
119120 name ``LowWatermark.ino.globals.h ``. You need to touch (update
120121 timestamp) the file so a “rebuild all” is performed.
122+
1211232. When a ``.h `` file is renamed in the sketch folder, a copy of the old
122124 file remains in the build sketch folder. This can create confusion if
123125 you missed an edit in updating an ``#include `` in one or more of your
0 commit comments