Case-sensitivity guidelines

Learn about the guidelines of case-sensitivity in clearmake with respect to makefile macros.

The following sections describe how you must specify build macros, targets, and dependencies in makefiles to avoid case problems.

Build macros and case-sensitivity

clearmake is case-sensitive with respect to makefile macros. Consider a makefile macro reference, $(CPU). There are numerous input sources from which to satisfy this macro:

  • From the makefile itself
  • From the current table of environment variables
  • From the command line
  • From a build option specification (BOS) file

For any macro to be expanded correctly from any of these sources, the macro definition and macro reference must be in the same case. For example, $(CPU) is not replaced by the value of a CPU environment variable.

Makefile target/dependency path names

When you write makefiles, you must be aware of the MVFS setting on your computer and specify targets and dependencies accordingly. If the MVFS is case-preserving, you must use case-correct path names in makefiles to guarantee the consistency of the resulting config records. Even if your MVFS is not case-preserving, we recommend that you use case-correct path names so that users on case-preserving computers can share the makefile.

Note: The -d option to clearmake warns you when case is the only difference in path names in the makefile and on the file system.

The following table describes makefile requirements for the different MVFS settings.

Table 1. MVFS Settings and Case Requirements for Makefiles
MVFS settings Build tool and MVFS behavior Makefile requirements
Case-insensitive and case preserving The MVFS preserves the case of created files. The build tool looks for the file as it is specified in the makefile. The case of the target must match the case of the file produced by the MVFS.
Case-insensitive and non-case-preserving The MVFS converts the names of all files created to lowercase. The build tool looks for a lowercase file name. The case of the target does not matter.
Case-sensitive and case-preserving The MVFS preserves the case of created files. The build tool looks for the file as it is specified in the makefile. The case of the target must match the case of the file produced by the MVFS.

Supporting both omake and clearmake

It is possible, but not trivial, to prepare makefiles that can be used with either omake or clearmake. The general approach is to supply omake-specific macro definitions in the makefile, and to supply clearmake-specific macro overrides in a build options specification (BOS) file; clearmake reads the BOS file, but omake does not. When clearmake executes, it looks for macro definitions in two locations:

  • %HOME%\.clearmake.options
  • makefile.options, in the same directory as makefile (substitute the actual name of your makefile, if it is not makefile)

BOS files at other locations can be passed to clearmake with the -A option.

Using UNIX or Linux-style command shells in makefiles

On Windows, clearmake accepts either slashes ( / ) or backslashes ( \ ) in path names. However, clearmake uses a backslash as the separator in any path names that it constructs in build scripts (for example, as a result of VPATH directory searching). This can cause problems with command shells similar to UNIX or Linux that require slashes in any path names supplied to them in command lines.

If you are using such a shell (for example, by setting the SHELL makefile variable accordingly), you can force clearmake to use slashes when constructing path names. To do this, set the CMAKE_PNAME_SEP variable:

CMAKE_PNAME_SEP = /

You can set CMAKE_PNAME_SEP in the makefile, in the BOS file, on the command line, or as an environment variable. clearmake recognizes CMAKE_PNAME_SEP for pattern rules as well as standard targets.