-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
77 lines (64 loc) · 1.52 KB
/
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
-include conanbuildinfo.mak
CC=gcc
CPP=g++
LD=$(CC)
CP=cp
RM=rm
SYS=posix
OPTIMIZATION=-O3 -finline-functions -Winline
VECTORIZE=-ftree-vectorize -march=native -mavx2 -mfpmath=sse
DIAGNOSE=-fopt-info-vec-all
CFLAGS=$(OPTIMIZATION) -c -Wall
LDFLAGS=-L/usr/local/lib
CPFLAGS=-rf
RMFLAGS=-rf
LIBS=-lm -lpng
PREFIX=/usr
SRC_DIR=src/pconvert
SOURCES=$(wildcard $(SRC_DIR)/*.c)
OBJECTS=$(SOURCES:.c=.o)
EXECUTABLE=pconvert
# updates the internal variables with the values comming
# from the conan package manager
CFLAGS+=$(CONAN_CFLAGS)
CFLAGS+=$(addprefix -I, $(CONAN_INCLUDE_DIRS))
CFLAGS+=$(addprefix -D, $(CONAN_DEFINES))
LDFLAGS+=$(addprefix -L, $(CONAN_LIB_DIRS))
LIBS+=$(addprefix -l, $(CONAN_LIBS))
ifeq ($(SYS),darwin)
CC=clang
CPP=clang
LDFLAGS+=-framework Security
endif
ifeq ($(DEBUG),1)
CFLAGS+=-g
LDFLAGS+=-g
endif
ifeq ($(AGRESSIVE),1)
CFLAGS+=$(VECTORIZE)
endif
ifeq ($(DIAGNOSTICS),1)
CFLAGS+=$(DIAGNOSE)
endif
ifeq ($(EXTENSION),1)
CFLAGS+=-DPCONVERT_EXTENSION -I/usr/local/include -I/usr/include/python$(PYTHON_VERSION) -I/usr/local/include/python$(PYTHON_VERSION) $(shell python-config --includes)
LIBS+=-lpython
PYTHON_VERSION=2.7
endif
ifeq ($(OPENCL),1)
CFLAGS+=-DPCONVERT_OPENCL
ifeq ($(SYS),darwin)
LDFLAGS+=-framework OpenCL
else
LIBS+=-lOpenCL
endif
endif
all: $(SOURCES) $(EXECUTABLE)
install: all
$(CP) $(EXECUTABLE) $(PREFIX)/bin
clean:
$(RM) $(RMFLAGS) $(OBJECTS) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(LD) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $@
.cpp.o:
$(CC) $(CFLAGS) $< -o $@