-
Notifications
You must be signed in to change notification settings - Fork 25
/
Makefile
50 lines (33 loc) · 1010 Bytes
/
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
TARGET := runme
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 -fopenmp
INC := /usr/include/
LIB := -L/usr/lib64/
LIB += -lOpenCL
LIB += -fopenmp
CXXFLAGS := -m64 -DUNIX -std=c++11 $(WARN_FLAGS) $(OPT_FLAGS) -I$(INC)
CFLAGS := -m64 -DUNIX $(WARN_FLAGS) $(OPT_FLAGS) -I$(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)