From e447146abfa91c395185849acefb3f154d8ec685 Mon Sep 17 00:00:00 2001 From: Maneesh Gupta Date: Tue, 5 Dec 2017 11:54:50 +0530 Subject: [PATCH] Simplify square sample's Makefile Change-Id: I44349a880a3c57ca0e833d67d9c380b706655b1e [ROCm/clr commit: ccc3fc1de643a4dae42c424e3739afce9dbb56a1] --- .../hipamd/samples/0_Intro/square/Makefile | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/projects/clr/hipamd/samples/0_Intro/square/Makefile b/projects/clr/hipamd/samples/0_Intro/square/Makefile index a1e2464160..9bb0dd8205 100644 --- a/projects/clr/hipamd/samples/0_Intro/square/Makefile +++ b/projects/clr/hipamd/samples/0_Intro/square/Makefile @@ -1,17 +1,24 @@ HIP_PATH?= $(wildcard /opt/rocm/hip) +ifeq (,$(HIP_PATH)) + HIP_PATH=../../.. +endif +HIP_PLATFORM=$(shell $(HIP_PATH)/bin/hipconfig --platform) HIPCC=$(HIP_PATH)/bin/hipcc +ifeq (${HIP_PLATFORM}, nvcc) + SOURCES=square.cu +else + SOURCES=square.cpp +endif + all: square.out # Step -square.cpp: +square.cpp: square.cu $(HIP_PATH)/bin/hipify-perl square.cu > square.cpp -square.out: square.cpp - $(HIPCC) $(CXXFLAGS) square.cpp -o $@ +square.out: $(SOURCES) + $(HIPCC) $(CXXFLAGS) $(SOURCES) -o $@ -# make step to make native cuda app, if on cuda machine -square.cuda.out : square.cu - nvcc square.cu -o $@ clean: - rm -f *.o *.out + rm -f *.o *.out square.cpp