Mistake on this page?
Report an issue in GitHub or email us

Ignoring files from mbed build

An .mbedignore file tells the mbed compile and mbed export commands which files and directories to ignore (not process).


You can place an .mbedignore file in any directory searched by mbed compile or mbed export.

Avoid defining rules that would cross the library boundaries; these can lead to side effects or build problems that are hard to find.


Each line in the .mbedignore file is a file pattern used for matching files. mbed compile and mbed export ignore every file that matches any pattern found in any .mbedignore file.

The following wildcards are accepted:

Pattern Meaning
* Matches everything.
? Matches any single character.
[seq] Matches any character in seq.
[!seq] Matches any character not in seq.

The file is parsed with Python's fnmatch. The syntax follows basic shell patterns with the following exceptions:

  1. Each line is treated as though it were prefixed with the path of the .mbedignore file.
  2. A line cannot start with . or / (because of rule 1).

The globbing functionality is not used, so you cannot recursively match a specific file pattern. Instead, you need to define a rule per directory.

You can use relative paths, so you can match files deeper in the build tree. However, avoid crossing library boundaries.


A file located in source/obsolete/.mbedignore with the following content:


After applying rule 1, the actual patterns used internally for matching the source files are:

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.