Chris LaRose

A Makefile for OpenCL development

The OpenCL Programming Guide for Mac can get you up and running with OpenCL development with a build process integrated into Xcode. If you don’t want to depend on Xcode, here’s way to get your OpenCL workflow started with a good ‘ole Makefile.

Like in Apple’s tutorial, assume you have a C file called main.c and an OpenCl kernel file called Here’s something to get you started:

Use make to generate your executable main, and make clean to get rid of all of the compiled files.

One interesting thing in this Makefile in the inclusion of .SUFFIXES:. Without it, make will complain:

make: Circular <- dependency dropped.

This is because make will include some implicit rules that we don’t want or need for our purposes.

blog comments powered by Disqus