-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
59 lines (39 loc) · 1.15 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
.SUFFIXES:
.SUFFIXES: .cc .o
CXX = mpic++
CXXFLAGS = -std=c++14 -O3 -march=native
CXXFLAGS += -Wall -Wextra -pedantic
AR = ar
RANLIB = ranlib
MPIEXEC = mpiexec
LIBKDPART_HDR = kdpart.h kdpart_util.h
LIBKDPART_SRC = kdpart.cc
LIBKDPART_OBJ = $(LIBKDPART_SRC:.cc=.o)
LIBKDPART = libkdpart.a
LIBKDPART_SO = libkdpart.so
TGT_SRC = kdpart_test_par.cc
TGT_OBJ = $(TGT_SRC:.cc=.o)
TGT = kdpart_test_par
all: $(LIBKDPART) $(LIBKDPART_SO)
$(LIBKDPART): $(LIBKDPART_OBJ)
$(AR) rc $@ $?
$(RANLIB) $@
$(LIBKDPART_SO): $(LIBKDPART_OBJ)
$(CXX) -shared -o $@ $?
$(LIBKDPART_OBJ): $(LIBKDPART_HDR)
$(TGT_OBJ): $(LIBKDPART_HDR)
$(TGT): $(LIBKDPART)
.cc.o:
$(CXX) -fPIC $(CXXFLAGS) -o $@ -c $<
.o:
$(CXX) -static $(CXXFLAGS) -L. -I. -o $@ $< -lkdpart
clean:
rm -f $(TGT_OBJ) $(TGT) $(LIBKDPART_SO) $(LIBKDPART) $(LIBKDPART_OBJ)
test: $(LIBKDPART) $(TGT)
for i in `seq 1 4`; do $(MPIEXEC) --oversubscribe -n $$i ./kdpart_test_par; if [ $$? -ne 0 ]; then break; fi; done
install: all
mkdir -p $(PREFIX)/lib
mkdir -p $(PREFIX)/include/kdpart/util
cp -f $(LIBKDPART_SO) $(PREFIX)/lib
cp -f $(LIBKDPART_HDR) $(PREFIX)/include/kdpart
.PHONY: all clean check install