-
Notifications
You must be signed in to change notification settings - Fork 0
/
OpenCL Makefile
49 lines (32 loc) · 1.03 KB
/
OpenCL 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
TARGET := hellocl
CPPOBJDIR = cppobjs
CPPSOURCES := $(wildcard *.cpp)
CPPOBJS := $(CPPSOURCES:%.cpp=$(CPPOBJDIR)/%.o)
COBJDIR = cobjs
CSOURCES := $(wildcard *.c)
COBJS := $(CSOURCES:%.c=$(COBJDIR)/%.o)
OBJS = $(CPPOBJS) $(COBJS)
OPT_FLAGS := -fno-strict-aliasing -O2
INC := -I/opt/AMDAPP/include/
LIB := -L/usr/lib64/
LIB += -lOpenCL
CXXFLAGS := -m64 -DUNIX $(WARN_FLAGS) $(OPT_FLAGS) $(INC)
CFLAGS := -m64 -DUNIX $(WARN_FLAGS) $(OPT_FLAGS) $(INC)
LDFLAGS := $(LIBRARY_PATH) $(LIB)
.PHONY: clean
$(TARGET): $(CPPOBJDIR) $(COBJDIR) $(CPPOBJS) $(COBJS)
g++ -fPIC -o $(TARGET) $(CPPOBJS) $(LDFLAGS)
$(CPPOBJS): $(CPPOBJDIR)/%.o: %.cpp
@echo "compile $@ $<"
g++ -fPIC $(CXXFLAGS) -c $< -o $@
$(COBJS): $(COBJDIR)/%.o: %.c
@echo "compile $@ $<"
gcc -fPIC $(CFLAGS) -c $< -o $@
$(CPPOBJDIR):
@ mkdir -p $(CPPOBJDIR)
$(COBJDIR):
@ mkdir -p $(COBJDIR)
clean:
$(RM) $(TARGET) $(OBJ)
$(RM) -rf $(CPPOBJDIR)
$(RM) -rf $(COBJDIR)