5.5 Using Makefiles on Windows

There are several rules to follow when constructing, or converting, makefiles for use by clearmake on a Windows host. Note that, as a general rule, your makefiles must match the syntax required by clearmake on UNIX.

Case-Sensitivity Guidelines

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:

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 an EV named cpu.

Makefile Target/Dependency Pathnames

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 pathnames 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 pathnames 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 pathnames in the makefile and on the file system.

Table 1 describes makefile requirements for the different MVFS settings.

Table 1 MVFS Settings and Case Requirements for Makefiles


MVFS Setting

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:

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

Using UNIX-Style Command Shells in Makefiles

On Windows, clearmake accepts either slashes ( / ) or backslashes ( \ ) in pathnames. However, clearmake uses a backslash as the separator in any pathnames that it constructs in build scripts (for example, as a result of VPATH directory searching). This can cause problems with UNIX-like command shells that require slashes in any pathnames 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 pathnames. 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.