Merge pull request #209 from dsharlet-intel/master

Adding more OpenCL link libs, OpenCL schedules to apps
Fixed CodeGen_C internal test.
Fixing a build problem with -lpthread and -ldl in Linux.
Merge pull request #214 from victormatheus/master

Fixing a build problem with -lpthread and -ldl in Linux.
Fix incorrect command line argument check to prevent segv if passing
too few arguments to local laplacian process command.
Change ref count logic in halide_release to take into account
that the command queue holds a reference to the context.

Add extra debug output to copy_to_host to print buf ptr.
Switch apps Makefiles to including common code to make it easier to edit.
Added min accessor to ImageParams, and top/left/bottom/right helpers.
Added mechanism for selecting device types (HL_OCL_DEVICE)