Simplify square sample's Makefile
Change-Id: I44349a880a3c57ca0e833d67d9c380b706655b1e
This commit is contained in:
@@ -1,17 +1,24 @@
|
|||||||
HIP_PATH?= $(wildcard /opt/rocm/hip)
|
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
|
HIPCC=$(HIP_PATH)/bin/hipcc
|
||||||
|
|
||||||
|
ifeq (${HIP_PLATFORM}, nvcc)
|
||||||
|
SOURCES=square.cu
|
||||||
|
else
|
||||||
|
SOURCES=square.cpp
|
||||||
|
endif
|
||||||
|
|
||||||
all: square.out
|
all: square.out
|
||||||
|
|
||||||
# Step
|
# Step
|
||||||
square.cpp:
|
square.cpp: square.cu
|
||||||
$(HIP_PATH)/bin/hipify-perl square.cu > square.cpp
|
$(HIP_PATH)/bin/hipify-perl square.cu > square.cpp
|
||||||
|
|
||||||
square.out: square.cpp
|
square.out: $(SOURCES)
|
||||||
$(HIPCC) $(CXXFLAGS) square.cpp -o $@
|
$(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:
|
clean:
|
||||||
rm -f *.o *.out
|
rm -f *.o *.out square.cpp
|
||||||
|
|||||||
Reference in New Issue
Block a user