Intel® FPGA SDK for OpenCL™ Pro Edition: Programming Guide

ID 683846
Date 12/19/2022
Public
Document Table of Contents

6.6.1. Displaying Example Makefile Fragments (example-makefile or makefile)

To display example Makefile fragments for compiling and linking a host application against host runtime libraries available with the Intel® FPGA SDK for OpenCL™ , invoke the example-makefile or makefile utility command.
At a command prompt, invoke the aocl example-makefile or aocl makefile utility command.
The software displays an output similar to the following:
The following are example Makefile fragments for compiling and linking
a host program against the host runtime libraries included with the Intel® FPGA SDK for OpenCL™.

Example GNU makefile on Linux, with GCC toolchain:

   AOCL_COMPILE_CONFIG=$(shell aocl compile-config)
   AOCL_LINK_CONFIG=$(shell aocl link-config)

   host_prog : host_prog.o
        g++ -o host_prog host_prog.o $(AOCL_LINK_CONFIG)

   host_prog.o : host_prog.cpp
        g++ -c host_prog.cpp $(AOCL_COMPILE_CONFIG)


Example GNU makefile on Windows, with Microsoft Visual C++ command line compiler:

   AOCL_COMPILE_CONFIG=$(shell aocl compile-config)
   AOCL_LINK_CONFIG=$(shell aocl link-config)

   host_prog.exe : host_prog.obj
        link -nologo /OUT:host_prog.exe host_prog.obj $(AOCL_LINK_CONFIG)

   host_prog.obj : host_prog.cpp
        cl /MD /Fohost_prog.obj -c host_prog.cpp $(AOCL_COMPILE_CONFIG)


Example GNU makefile cross-compiling to ARM SoC from Linux or Windows, with
Linaro GCC cross-compiler toolchain:

   CROSS-COMPILER=arm-linux-gnueabihf-
   AOCL_COMPILE_CONFIG=$(shell aocl compile-config --arm)
   AOCL_LINK_CONFIG=$(shell aocl link-config --arm)

   host_prog : host_prog.o
        $(CROSS-COMPILER)g++ -o host_prog host_prog.o $(AOCL_LINK_CONFIG)

   host_prog.o : host_prog.cpp
        $(CROSS-COMPILER)g++ -c host_prog.cpp $(AOCL_COMPILE_CONFIG)