#***********************************************************************
#
# Licensed Materials - Property of IBM
#
# (C) Copyright IBM Corp. 2010
# All Rights Reserved
#
# US Government Users Restricted Rights - Use, duplication or
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
#
#***********************************************************************

CC	= gcc
BITS 	= -m64
CPPFLAGS	= -I.
CFLAGS		= -I../../clu -I../../common -g -O3 ${BITS}
CXXFLAGS	= -I../../clu -I../../common -g -O3 ${BITS} -fno-strict-aliasing
LDFLAGS	= -lOpenCL  ${BITS} -lm -lstdc++
OBJS	= bsop.o clu.o clock.o
KERNELS = bsop.cl
SCRIPTS = bsop_wrapper.pl

vpath	%.c	../src ../../clu ../../common
vpath	%.cpp	../src ../../clu ../../common
vpath	%.h	../src ../../clu ../../common

DEPS    = $(OBJS:.o=.d)

%.d: %.cpp
	@$(CC) -M $(CPPFLAGS) $(CXXFLAGS) $< | sed 's/$*.o/& $@/g' > $@

.PHONY: all
all:  bsop $(KERNELS) $(SCRIPTS)

bsop: $(OBJS)

bsop.cl:
	ln -s -f ../src/$@

bsop_wrapper.pl:
	ln -s -f ../src/$@

-include $(DEPS)

.PHONY: clean
clean:
	@rm -f bsop $(OBJS) $(KERNELS) $(SCRIPTS) *.ocl_bin $(DEPS)
