-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
56 lines (46 loc) · 934 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
51
52
53
54
55
56
CC=nvcc
ifdef ALT_CC
CC:=$(ALT_CC)
endif
DEFAULT_REAL=float
ifndef REAL
REAL=$(DEFAULT_REAL)
endif
CFLAGS=-I$(IDIR) --std=c++11 -DREAL=$(REAL)
ifeq ($(CC), nvcc)
CFLAGS+= -Xcompiler -fopenmp
else
CFLAGS+= -fopenmp
endif
IDIR=lib
LIBS=
_DEPS=*.cu*
DEPS=$(patsubst %,$(IDIR)/%,$(_DEPS))
MACROS=
ifeq ($(CC), nvcc)
LANG=cu
else
LANG=c++
endif
ODIR=obj
_OBJ = main.o
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))
$(ODIR)/%.o: %.cpp $(DEPS)
$(ODIR)/%.o: %.cu $(DEPS)
$(CC) -c -o $@ -x $(LANG) $< $(CFLAGS) `libpng-config --cflags`
all: makedir mbrot
mbrot: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS) `libpng-config --ldflags`
#openmp: CC := g++
#openmp: CFLAGS += -fopenmp
#openmp: mbrot
#cuda: CC := nvcc
#openmp: MACROS += __CUDACC__
#cuda: mbrot
debug: CFLAGS += -DDEBUG -g
debug: mbrot
makedir:
mkdir -p obj
.PHONY: clean
clean:
rm -f $(ODIR)/*.o *~ core $(INCDIR)/*~