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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
########################################################################
# Set environments automatically
########################################################################
ifndef CL_TOP
$(error Not set SNU-SAMSUNG OpenCL Environments. please run "source setenv.sh")
endif
# Print detailed output
VERBOSE := 1
########################################################################
# Common Defines
########################################################################
CL_BT_TOP=$(CL_TOP)/src/runtime/hal/device/cpu
INCLUDE = -I$(CL_TOP)/inc -I$(CL_BT_TOP)
CFLAGS = -fsigned-char
ifeq ($(CL_DEBUG), yes)
CC_OPT_LEVEL = -O0 -g
else
CC_OPT_LEVEL = -O3
endif
########################################################################
# Objects
########################################################################
########################################################################
# Subdirectories
########################################################################
VPATH := $(CL_BT_TOP)/async:$(CL_BT_TOP)/atomic:$(CL_BT_TOP)/common:$(CL_BT_TOP)/conversion:$(CL_BT_TOP)/geometric:$(CL_BT_TOP)/integer:$(CL_BT_TOP)/math:$(CL_BT_TOP)/reinterpreting:$(CL_BT_TOP)/relational:$(CL_BT_TOP)/vector
ifdef VPATH
_SRCS = $(sort $(notdir $(foreach path,. $(subst :, ,$(VPATH)),$(wildcard $(path)/*.c))))
else
_SRCS = $(wildcard *.c)
endif
SRCS = $(_SRCS)
########################################################################
# TARGET DEPENDENT MAKEFILE
########################################################################
ifeq ($(CL_MACH), lnx_x86)
CC := gcc
CPP := g++
AR := ar
CFLAGS += -fPIC -m32 -march=core2 -mfpmath=sse -DDEF_INCLUDE_X86
LDFLAGS :=
IMPORTS := -lpthread -ldl
else
ifeq ($(CL_MACH), lnx_x86_64)
CC := gcc
CPP := g++
AR := ar
CFLAGS += -fPIC -march=core2 -mfpmath=sse -fsigned-char -DDEF_INCLUDE_X86
LDFLAGS :=
IMPORTS := -lpthread -ldl
else
ifeq ($(CL_MACH), lnx_ppc)
CC := /opt/ibmcmp/xlc/cbe/10.1/bin/ppuxlc
CPP := /opt/ibmcmp/xlc/cbe/10.1/bin/ppuxlc++
AR := /usr/bin/ppu-ar
INCLUDE += -I/opt/cell/sdk/usr/include
CFLAGS += -DDEF_INCLUDE_PPC -DDEF_INCLUDE_SPU -qcpluscmt -M -ma -qaltivec -qenablevmx
CFLAGS += -DCOMIC_STATISTICS
CC_OPT_LEVEL := -O5
LDFLAGS :=
IMPORTS := -lspe2 -lpthread -ldl
else
ifeq ($(CL_MACH), lnx_arm)
CROSS_COMPILE_PREFIX = $(ARM_TOOLCHAIN_PREFIX)
CC := $(CROSS_COMPILE_PREFIX)gcc
CPP := $(CROSS_COMPILE_PREFIX)g++
AR := ar
#CFLAGS += -fPIC -m32 -DDEF_INCLUDE_ARM -DDEF_INCLUDE_C64XP
CFLAGS += -march=armv7-a $(ARM_FLOAT_ARGS) -ftree-vectorize -ftree-vectorizer-verbose=0 -fsigned-char -fPIC -DDEF_INCLUDE_ARM
LDFLAGS :=
IMPORTS := -lpthread -ldl
else
ifeq ($(CL_MACH), osx_x86)
CC := gcc
CPP := g++
AR := ar
CFLAGS += -arch i386 -m32 -fsigned-char -DDEF_INCLUDE_X86
LDFLAGS :=
IMPORTS := -lpthread -ldl
else
$(error Unknown CL_MACH)
endif
endif
endif
endif
endif
########################################################################
# Local Defines
########################################################################
INCLUDE += -I$(subst :, -I,$(VPATH))
INSTALL_DIR = $(CL_TOP)/lib/$(CL_MACH)
INSTALL_FILES = $(INSTALL_DIR)/$(LIBRARY)
LIBRARY = libsnusamsung_opencl_builtin_$(CL_MACH).a
OBJECTS = $(SRCS:.c=.o)
########################################################################
# buildutils
########################################################################
.SUFFIXES : .o .c
%.o : %.c
$(CPP) $(CFLAGS) -c -o $@ $< $(INCLUDE) $(LDFLAGS) $(CC_OPT_LEVEL)
$(LIBRARY) : $(OBJECTS)
$(AR) r $@ $^
mkdir -p $(INSTALL_DIR)
cp -pfP $@ $(INSTALL_FILES)
all : $(LIBRARY)
clean :
rm -rf *.o *.d $(LIBRARY) $(INSTALL_FILES)
|