Developer Guide and Reference

Contents

Using Makefiles to Compile Your Application

This topic describes the 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*

To run
make
from the command line using the
Intel® oneAPI
DPC++/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 oneAPI
DPC++/C++
Compiler
, your makefile must include the setting CC=icpx (for C++), or CC=dpcpp (for DPC++). Use the same setting on the command line to instruct the makefile to use the compiler. If your makefile is written for GCC*, you need to change the command line options that are not recognized by the 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*

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 (
This content is specific to C++; it does not apply to
DPC++
.
):
prompt> nmake /f your_project.mak CPP=icx.exe LINK32=link.exe
-OR-
prompt> nmake /f your_project.mak CPP=icx.exe LINK32=xilink.exe
For example (
This content is specific to
DPC++
.
):
prompt> nmake /f your_project.mak CPP=dpcpp.exe LINK32=dpcpp.exe
if you have
link/xilink
specific options that are not accepted by
dpcpp.exe
, ensure any linker specific options are placed after the
/link
option. For example:
dpcpp test.obj <compiler options> /link <linker options>
Argument
Description
/f
The
nmake
option to specify a makefile.
your_project.mak
The makefile used to generate object and executable files.
CPP
The preprocessor/compiler that generates object and executable files. (The name of this macro may be different for your makefile.)
LINK32
The linker that is used.
The
nmake
command creates object files (
.obj
) and executable files (
.exe
) from the information specified in the
your_project.mak
makefile.

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.