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.
- SelectMakefile Projectif the project already includes a makefile.
- UseExecutable,Shared Library, orStatic Library Projectto build a makefile using options assigned from property pages specific to theIntel® oneAPI.DPC++/C++Compiler
Export Makefiles
Eclipse can build a makefile that includes
Intel® oneAPI
options for created
DPC++/C++
Compiler 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:
- Select the project in the EclipseProject Explorerview.
- Selectto launch theExport Wizard. TheExportdialog box opens, showing theSelectscreen.
- Select, then clickNext. TheFile Systemscreen opens.
- Check both thehello_worldandReleasedirectories in the left-hand pane. Ensure all project sources are checked in the right-hand pane.Some files in the right-hand pane may be deselected, such as thehello_world.oobject file and thehello_worldexecutable.Create directory structure for filesin theOptionssection must be selected to successfully create the export directory. This process applies to project files in thehello_worlddirectory.
- Use theBrowsebutton to target the export to an existing directory. Eclipse can create a directory for full paths entered in theTo directorytext box. For example, if the/code/makefileis specified as the export directory, Eclipse creates two new subdirectories:
- /code/makefile/hello_world
- /code/makefile/hello_world/Release
- ClickFinishto complete the export.
Run Make
In a terminal window, change to the
/cpp/hello_world/Release
directory, then run
make
by typing:
make clean all
.
You should see the following output:
For C++:
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
For DPC++:
rm -rf ./new_source_file.o ./new_source_file.d hello_world Building file: ../new_source_file.c Invoking: Intel(R) oneAPI DPC++ Compiler dpcpp -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: Linker dpcpp -o "hello_world" ./new_source_file.o Finished building target: hello_world
This process generates the
hello_world
executable in the same directory.