# StarPU --- Resource Management Layer.
#
# Copyright (C) 2017-2020  Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
#
# StarPU is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or (at
# your option) any later version.
#
# StarPU is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See the GNU Lesser General Public License in COPYING.LGPL for more details.
#
NVCC=nvcc
CFLAGS=-Wall -g
CUFLAGS=-g

CFLAGS+=$(shell pkg-config --cflags starpurm-1.3)
CUFLAGS+=$(shell pkg-config --cflags starpurm-1.3)
LDFLAGS+=$(shell pkg-config --libs-only-L starpurm-1.3)
LDLIBS += $(shell pkg-config --libs-only-l starpurm-1.3)

.phony: all clean
all: vector_scale
%: %.c

vector_scale: vector_scale.o vs_cuda_kernel.o
	$(NVCC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
%.o: %.c
	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
%.o: %.cu
	$(NVCC) $(CPPFLAGS) $(CUFLAGS) -c -o $@ $<

clean:
	rm -fv vector_scale *.o
