# Die folgenden 2 Zeilen sind unter Linux schon vordefiniert,
# andere Systeme brauchen diese Definitionen eventuell?
CC=gcc
CXX=g++
#h = ~/xtekplot1/h  # falls nicht schon im .profile oder .bashrc definiert
#WARN = -Wall #so fuer neue Programme
# nach Wall koennen noch Ausnahmen geschaltet werden:
#WARN = -Wall -Wno-unused-result -Wno-parentheses -Wno-unused-variable -Wno-write-strings
WARN = -Wall -Wno-unused-result -Wno-parentheses 
#DEBUG= -ggdb  # fuer den Gnu-Debugger
OPT  = -O3  #-O3 fuer moeglichst schnell?, -Os fuer moeglist kurz
CFLAGS  = -pthread -std=c++11 $(WARN) $(OPT) $(DEBUG) 
CXXFLAGS= $(CFLAGS)
LDFLAGS = -L/usr/X11R6/lib $(DEBUG)
MYLIBS  = $h/xtekplot1.o 
LDLIBS  = -lm -lX11 -lcudart -lOpenCL

KERNEL = hello_kernel.cc
KERNEL_OPT = kernelversionen/hello_kernel-opt5.cc

all: hello
#all: hello tmp.o

hello: hello.cc myopencl.cc hello.h myopencl.h $(KERNEL)
	$(CXX) $(CFLAGS) $(LDFLAGS) hello.cc myopencl.cc $(LDLIBS) -o hello

check: $(KERNEL_OPT)
	gcc -c -I/usr/local/cuda/include/ -DCHECK $(KERNEL_OPT) -o tmp.o
tmp.o: $(KERNEL)
	gcc -c -I/usr/local/cuda/include/ -DCHECK $(KERNEL) -o tmp.o

install:
	cp hello $(HOME)/bin

clean:
	rm -f *.o *~
clean_all:
	rm -f *.o *~ *.ptx
	rm -f hello
