-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathMakefile
55 lines (43 loc) · 1.47 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#-----------------------------------------------------------------------
#
# Makefile: Cuda clang demo Makefile for both amdgcn and nvptx targets.
# amdgcn GPU targets begin with "gfx". nvptx targets begin
# with sm_. Example: To build and run on k4000 do this:
#
# export LLVM_GPU_ARCH=sm_30
# make run
#
# Run "make help" to see other options for this Makefile
TESTNAME = veccopy
TESTSRC = veccopy.c
mkfile_dir := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
ifneq ($(CURDIR)/,$(mkfile_dir))
TESTSRC := $(mkfile_dir)$(TESTSRC)
endif
include $(mkfile_dir)../../inc/find_gpu_and_install_dir.mk
CC = $(LLVM_INSTALL_DIR)/bin/clang
CFLAGS = -O3 -fopenmp --offload-arch=$(LLVM_GPU_ARCH)$(AOMP_TARGET_FEATURES)
ifeq ($(OFFLOAD_DEBUG),1)
$(info DEBUG Mode ON)
CCENV = env LIBRARY_PATH=$(LLVM_INSTALL_DIR)/lib-debug
RUNENV = LIBOMPTARGET_DEBUG=1
endif
ifeq ($(VERBOSE),1)
$(info Compilation VERBOSE Mode ON)
CFLAGS += -v
endif
ifeq ($(TEMPS),1)
$(info Compilation and linking save-temp Mode ON)
CFLAGS += -save-temps
endif
CFLAGS += $(EXTRA_CFLAGS)
# ----- Demo compile and link in one step, no object code saved
$(TESTNAME): $(TESTSRC)
$(CCENV) $(CC) $(CFLAGS) $(LFLAGS) $^ -o $@
run: $(TESTNAME)
$(RUNENV) ./$(TESTNAME)
include $(mkfile_dir)../../inc/obin.mk
include $(mkfile_dir)../../inc/help.mk
# Cleanup anything this makefile can create
clean:
rm -f $(TESTNAME) obin *.i *.ii *.bc *.lk a.out-* *.ll *.s *.o *.cubin