-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathMakefile
98 lines (66 loc) · 1.95 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
-include Makefile.local
CUDA?=0
CUDA_BASE ?= /usr/local/cuda
CUDA_LIB ?= lib
DEBUG?=0
OMP?=1
PKG_CONFIG?=pkg-config
BUILDTYPE = Linux
UNAME = $(shell uname -s)
ifeq ($(UNAME),Darwin)
BUILDTYPE = MacOSX
endif
ifeq ($(BART_TOOLBOX_PATH),)
TOOLBOX_INC=/usr/include/bart/
TOOLBOX_LIB=/usr/lib/bart/
else
TOOLBOX_INC=$(BART_TOOLBOX_PATH)/src/
TOOLBOX_LIB=$(BART_TOOLBOX_PATH)/lib/
endif
ifeq ($(origin CC), default)
CC = gcc
endif
CFLAGS ?= -Wall -Wextra
ifeq ($(DEBUG),1)
CFLAGS += -Og -g
else
CFLAGS += -O2
endif
ifeq ($(BUILDTYPE), MacOSX)
CFLAGS += -std=gnu11 -Xpreprocessor
else
CFLAGS += -std=gnu11
endif
ifeq ($(OMP),1)
CFLAGS += -fopenmp
else
CFLAGS += -Wno-unknown-pragmas
endif
# clang
ifeq ($(findstring clang, $(CC)), clang)
CFLAGS += -fblocks
LDFLAGS += -lBlocksRuntime
endif
ifeq ($(CUDA),1)
CUDA_L := -L$(CUDA_BASE)/$(CUDA_LIB) -lcufft -lcudart -lcublas -lblas
else
CUDA_L :=
endif
EXPDYN = -rdynamic
ifeq ($(BUILDTYPE), MacOSX)
LDFLAGS += -L/opt/local/lib -lm -lpng -lomp -lrt
else
LDFLAGS += -lm -lpng -lrt
endif
all: view cfl2png
src/viewer.inc: src/viewer.ui
@echo "STRINGIFY(`cat src/viewer.ui`)" > src/viewer.inc
view: src/main.c src/view.[ch] src/draw.[ch] src/gtk_ui.[ch] src/viewer.inc
$(CC) $(CFLAGS) $(CPPFLAGS) $(EXPDYN) -o view -I$(TOOLBOX_INC) `$(PKG_CONFIG) --cflags gtk+-3.0` src/main.c src/view.c src/gtk_ui.c src/draw.c `$(PKG_CONFIG) --libs gtk+-3.0` $(TOOLBOX_LIB)/libmisc.a $(TOOLBOX_LIB)/libgeom.a $(TOOLBOX_LIB)/libnum.a $(TOOLBOX_LIB)/libmisc.a $(CUDA_L) $(LDFLAGS)
cfl2png: src/cfl2png.c src/view.[ch] src/draw.[ch] src/viewer.inc
$(CC) $(CFLAGS) $(CPPFLAGS) $(EXPDYN) -o cfl2png -I$(TOOLBOX_INC) src/cfl2png.c src/draw.c $(TOOLBOX_LIB)/libmisc.a $(TOOLBOX_LIB)/libgeom.a $(TOOLBOX_LIB)/libnum.a $(TOOLBOX_LIB)/libmisc.a $(CUDA_L) $(LDFLAGS)
install:
install -D view $(DESTDIR)/usr/lib/bart/commands/view
install cfl2png $(DESTDIR)/usr/lib/bart/commands/
clean:
rm -f view cfl2png src/viewer.inc