SRC=src BUILD=build CFLAGS=-Wall -g CLM_SOURCES=$(SRC)/clm.c $(SRC)/clm_util.c $(SRC)/clm_funcs.c .PHONY: all all: libclm_cpu libclm_opencl cltest .PHONY: run_cpu run: all cd $(BUILD) && ./cltest cpu .PHONY: run_opencl run: all cd $(BUILD) && ./cltest opencl .PHONY: cltest cltest: libclm mkdir -p $(BUILD) gcc -lOpenCL -lm -Wl,-rpath -Wl,'$$ORIGIN' -L$(BUILD) -lclm $(CFLAGS) -o $(BUILD)/cltest $(SRC)/cltest.c .PHONY: libclm libclm: mkdir -p $(BUILD) gcc -lOpenCL -lm -Wl,-rpath -Wl,'$$ORIGIN' -shared -fpic $(CFLAGS) -o $(BUILD)/libclm.so $(CLM_SOURCES) .PHONY: libclm_cpu libclm_cpu: mkdir -p $(BUILD) gcc -lOpenCL -lm -L$(BUILD) -lclm -shared -fpic $(CFLAGS) -o $(BUILD)/libclm_cpu.so $(SRC)/clm_cpu.c .PHONY: libclm_opencl libclm_opencl: mkdir -p $(BUILD) gcc -lOpenCL -lm -L$(BUILD) -lclm -shared -fpic $(CFLAGS) -o $(BUILD)/libclm_opencl.so $(SRC)/clm_opencl.c