Intel® oneAPI DPC++/C++ Compiler Developer Guide and Reference

ID 767253
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Makefiles

This section provides information about makefile project types and exporting makefiles.

Project Types and Makefiles

When you create a new project in Eclipse*, there are Executable, Shared Library, Static Library, or Makefile project types available for your selection.

  • Select Makefile Project if the project already includes a makefile.

  • Use Executable, Shared Library, or Static Library Project to build a makefile using options assigned from property pages specific to the Intel® oneAPI DPC++/C++ Compiler.

Export Makefiles

Eclipse can build a makefile that includes Intel® oneAPI DPC++/C++ Compiler options for created Executables, Shared Libraries, or Static Library Projects. When the project is complete, export the makefile and project source files to another directory, and then build the project from the command line using make.

To export the makefile:

  1. Select the project in the Eclipse Project Explorer view.
  2. Select File > Export to launch the Export Wizard. The Export dialog box opens, showing the Select screen.
  3. Select General > File system, then click Next. The File System screen opens.
  4. Check both the hello_world and Release directories in the left-hand pane. Ensure all project sources are checked in the right-hand pane.
    NOTE:
    Some files in the right-hand pane may be deselected, such as the hello_world.o object file and the hello_world executable. Create directory structure for files in the Options section must be selected to successfully create the export directory. This process applies to project files in the hello_world directory.
  5. Use the Browse button to target the export to an existing directory. Eclipse can create a directory for full paths entered in the To directory text box. For example, if the /code/makefile is specified as the export directory, Eclipse creates two new subdirectories:
    • /code/makefile/hello_world
    • /code/makefile/hello_world/Release
  6. Click Finish to complete the export.

Run Make

From the command line, change to your project directory and run make with:

make clean all

You should see the following output:

rm -rf  ./new_source_file.o  ./new_source_file.d  hello_world
 
Building file: ../new_source_file.c
Invoking: Intel C++ Compiler
icx -O2 -MMD -MP -MF"new_source_file.d" -MT"new_source_file.d" -c -o "new_source_file.o" "../new_source_file.c"
Finished building: ../new_source_file.c
 
Building target: hello_world
Invoking: Intel C++ compiler
icx  -o "hello_world"  ./new_source_file.o   
Finished building target: hello_world

This process generates the hello_world executable in the project directory.