forked from franz/HeCBench
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.aomp
67 lines (50 loc) · 1.52 KB
/
Makefile.aomp
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
63
64
65
66
#===============================================================================
# User Options
#===============================================================================
# Compiler can be set below, or via environment variable
CC = clang++
OPTIMIZE = yes
DEBUG = no
DEVICE = gpu
ARCH = gfx906
#===============================================================================
# Program name & source code list
#===============================================================================
program = main
source = main.cpp
obj = $(source:.cpp=.o)
#===============================================================================
# Sets Flags
#===============================================================================
# Standard Flags
CFLAGS := $(EXTRA_CFLAGS) -std=c++14 -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 += -target x86_64-pc-linux-gnu \
-fopenmp -fopenmp-targets=amdgcn-amd-amdhsa \
-Xopenmp-target=amdgcn-amd-amdhsa \
-march=$(ARCH)
else
CFLAGS +=-fopenmp
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)