forked from zjin-lcf/HeCBench
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.nvc
62 lines (47 loc) · 1.37 KB
/
Makefile.nvc
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
56
57
58
59
60
61
62
#===============================================================================
# User Options
#===============================================================================
# Compiler can be set below, or via environment variable
CC = nvc++
OPTIMIZE = yes
DEBUG = no
DEVICE = gpu
SM = cc70
#===============================================================================
# Program name & source code list
#===============================================================================
program = main
source = main.cpp
obj = $(source:.cpp=.o)
#===============================================================================
# Sets Flags
#===============================================================================
# Standard Flags
CFLAGS := $(EXTRA_CFLAGS) -Wall
# Linker Flags
LDFLAGS =
# Debug Flags
ifeq ($(DEBUG),yes)
CFLAGS += -g
LDFLAGS += -g
endif
# Optimization Flags
ifeq ($(OPTIMIZE),yes)
CFLAGS += -O3
endif
ifeq ($(DEVICE),gpu)
CFLAGS +=-Minfo -mp=gpu -gpu=$(SM)
else
CFLAGS +=
endif
#===============================================================================
# Targets to Build
#===============================================================================
$(program): $(obj)
$(CC) $(CFLAGS) $(obj) -o $@ $(LDFLAGS)
%.o: %.cpp
$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -rf $(program) $(obj)
run: $(program)
./$(program) 10