forked from Nek5000/parRSB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
100 lines (77 loc) · 2.09 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
98
99
100
DEBUG ?= 0
PAUL ?= 1
CC ?= mpicc
CFLAGS ?= -O2
SRCROOT=.
GSLIBDIR=$(GSLIBPATH)
SRCDIR =$(SRCROOT)/src
BUILDDIR=$(SRCROOT)/build
TESTDIR =$(SRCROOT)/example
TARGET=parRSB
TESTS=$(TESTDIR)/example
LIB=src/lib$(TARGET).a
INCFLAGS=-I$(SRCDIR) -I$(GSLIBDIR)/include
TESTLDFLAGS:=-L$(BUILDDIR)/lib -l$(TARGET) -L $(GSLIBDIR)/lib -lgs -lm $(LDFLAGS)
ifneq (,$(strip $(DESTDIR)))
INSTALL_ROOT = $(DESTDIR)
else
INSTALL_ROOT = $(SRCROOT)/build
endif
CSRCS:= $(SRCDIR)/genmap.c \
$(SRCDIR)/genmap-vector.c $(SRCDIR)/genmap-handle.c $(SRCDIR)/genmap-comm.c \
$(SRCDIR)/genmap-eigen.c $(SRCDIR)/genmap-laplacian.c $(SRCDIR)/genmap-lanczos.c \
$(SRCDIR)/genmap-rsb.c \
$(SRCDIR)/parrsb-binsort.c \
$(SRCDIR)/parrsb-histogram.c \
$(SRCDIR)/genmap-chelpers.c \
$(SRCDIR)/parRSB.c
COBJS:=$(CSRCS:.c=.o)
SRCOBJS:=$(COBJS)
PP=
ifneq ($(DEBUG),0)
PP += -g -DGENMAP_DEBUG
endif
ifneq ($(PAUL),0)
PP += -DGENMAP_PAUL
endif
.PHONY: default
default: check lib install
.PHONY: all
all: check lib tests install
.PHONY: install
install: lib
@mkdir -p $(INSTALL_ROOT)/lib 2>/dev/null
@cp -v $(LIB) $(INSTALL_ROOT)/lib 2>/dev/null
@mkdir -p $(INSTALL_ROOT)/include 2>/dev/null
@cp $(SRCDIR)/parRSB.h $(INSTALL_ROOT)/include 2>/dev/null
.PHONY: $(TARGET)
lib: $(SRCOBJS)
@$(AR) cr $(LIB) $(SRCOBJS)
@ranlib $(LIB)
.PHONY: check
check:
ifeq ($(GSLIBPATH),)
$(error Specify GSLIBPATH=<path to gslib>/build)
endif
$(COBJS): %.o: %.c
$(CC) $(CFLAGS) $(PP) $(INCFLAGS) -c $< -o $@
.PHONY: tests
tests: $(TESTS)
$(TESTS): lib install
$(CC) $(CFLAGS) -I$(GSLIBDIR)/include -I$(BUILDDIR)/include [email protected] -o $@ $(TESTLDFLAGS)
.PHONY: clean
clean:
@rm -f $(SRCOBJS) $(LIB) $(TESTS) $(TESTS).o
.PHONY: astyle
astyle:
astyle --style=google --indent=spaces=2 --max-code-length=80 \
--keep-one-line-statements --keep-one-line-blocks --lineend=linux \
--suffix=none --preserve-date --formatted --pad-oper \
--unpad-paren example/*.[ch] src/*.[ch]
print-%:
$(info [ variable name]: $*)
$(info [ origin]: $(origin $*))
$(info [ value]: $(value $*))
$(info [expanded value]: $($*))
$(info)
@true