Using Makefiles to Compile Your Application

This topic describes use of makefiles to compile your application. You can use makefiles to specify a number of files with various paths and to save this information for multiple compilations.

Using Makefiles to Store Information for Compilation on Linux* OS or OS X*

To run make from the command line using the Intel® C++ Compiler, make sure that /usr/bin and /usr/local/bin are in your PATH environment variable.

If you use the C shell, you can edit your .cshrc file and add the following:

setenv PATH /usr/bin:/usr/local/bin:$PATH

To use the Intel® C++ Compiler, your makefile must include the setting CC=icpc or CC=clang (on OS X* only). Use the same setting on the command line to instruct the makefile to use the Intel® C++ Compiler. If your makefile is written for gcc, the GNU* C compiler, you will need to change those command line options not recognized by the Intel® C++ Compiler. Run make, using the following syntax:

make -f yourmakefile

where -f is the make command option to specify a particular makefile name.

Using Makefiles to Store Information for Compilation on Windows* OS

To use a makefile to compile your source files, use the nmake command with the following syntax:

nmake /f [makefile_name.mak] CPP=[compiler_name.exe] [LINK32=[linker_name.exe]
For example:
prompt> nmake /f your_project.mak CPP=icl.exe LINK32=xilink.exe




The nmake option to specify a makefile.


The makefile to use to generate object and executable files.


The preprocessor/compiler that will generate object and executable files. (The name of this macro may be different for your makefile.)


The linker that will be used.

The nmake command creates object files (.obj) and executable files (.exe) from the information specified in the your_project.mak makefile.

For more complete information about compiler optimizations, see our Optimization Notice.