forked from jmrosinski/GPTL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
173 lines (144 loc) · 3.91 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
include macros.make
ifeq ($(findstring xlf, $(FC)),xlf)
DEFINE = -WF,-D
else
DEFINE = -D
endif
null =
OBJS = gptl.o util.o get_memusage.o print_memusage.o gptl_papi.o pmpi.o getoverhead.o \
hashstats.o memstats.o pr_summary.o print_rusage.o
ifeq ($(ENABLE_PMPI),yes)
CFLAGS += -DENABLE_PMPI -DMPI_STATUS_SIZE_IN_INTS=$(MPI_STATUS_SIZE_IN_INTS)
ifeq ($(MPI_CONST),yes)
CFLAGS += -DCONST=const
else
CFLAGS += -DCONST=
endif
ifeq ($(HAVE_IARGCGETARG),yes)
CFLAGS += -DHAVE_IARGCGETARG
endif
LIBNAME = gptl_pmpi
else
LIBNAME = gptl
endif
# Always run the C tests. Add Fortran tests if Fortran enabled
MAKETESTS = ctests/all
RUNTESTS = ctests/test
ifeq ($(MANDIR),$(null))
MANDIR = $(INSTALLDIR)
endif
ifeq ($(HAVE_SLASHPROC),yes)
CFLAGS += -DHAVE_SLASHPROC
endif
ifeq ($(OPENMP),yes)
CFLAGS += -DTHREADED_OMP $(COMPFLAG)
else
ifeq ($(PTHREADS),yes)
CFLAGS += -DTHREADED_PTHREADS
endif
endif
FOBJS =
ifeq ($(FORTRAN),yes)
FOBJS = process_namelist.o gptlf.o
OBJS += f_wrappers.o f_wrappers_pmpi.o
MAKETESTS += ftests/all
RUNTESTS += ftests/test
endif
CFLAGS += $(INLINEFLAG) $(UNDERSCORING)
ifeq ($(HAVE_PAPI),yes)
CFLAGS += -DHAVE_PAPI
CFLAGS += $(PAPI_INCFLAGS)
FFLAGS += $(DEFINE)HAVE_PAPI
endif
ifeq ($(HAVE_MPI),yes)
CFLAGS += -DHAVE_MPI
FFLAGS += $(DEFINE)HAVE_MPI
ifeq ($(HAVE_COMM_F2C),yes)
CFLAGS += -DHAVE_COMM_F2C
endif
CFLAGS += $(MPI_INCFLAGS)
LDFLAGS += $(MPI_LIBFLAGS)
endif
ifeq ($(HAVE_LIBRT),yes)
CFLAGS += -DHAVE_LIBRT
LDFLAGS += -lrt
endif
ifeq ($(HAVE_NANOTIME),yes)
CFLAGS += -DHAVE_NANOTIME
ifeq ($(BIT64),yes)
CFLAGS += -DBIT64
endif
endif
ifeq ($(HAVE_VPRINTF),yes)
CFLAGS += -DHAVE_VPRINTF
endif
ifeq ($(HAVE_TIMES),yes)
CFLAGS += -DHAVE_TIMES
endif
ifeq ($(HAVE_GETTIMEOFDAY),yes)
CFLAGS += -DHAVE_GETTIMEOFDAY
endif
##############################################################################
%.o: %.F90
$(FC) -c $(FFLAGS) $<
ifeq ($(FORTRAN),yes)
all: lib$(LIBNAME).a $(MAKETESTS) printmpistatussize
printmpistatussize: printmpistatussize.o
$(FC) -o $@ $? $(FFLAGS)
else
all: lib$(LIBNAME).a $(MAKETESTS)
endif
libonly: lib$(LIBNAME).a
test: $(RUNTESTS)
# MAKETESTS is ctests/all and maybe ftests/all
ctests/all:
$(MAKE) -C ctests all
ftests/all:
$(MAKE) -C ftests all
# RUNTESTS is ctests and maybe ftests
ctests/test:
$(MAKE) -C ctests test
ftests/test:
$(MAKE) -C ftests test
lib$(LIBNAME).a: $(OBJS) $(FOBJS)
$(AR) ruv $@ $(OBJS) $(FOBJS)
$(RM) -f ctests/*.o ftests/*.o
install: lib$(LIBNAME).a
install -d $(INSTALLDIR)/lib
install -d $(INSTALLDIR)/include
install -d $(INSTALLDIR)/bin
install -d $(INSTALLDIR)/man/man3
install -m 0644 lib$(LIBNAME).a $(INSTALLDIR)/lib
install -m 0644 gptl.h $(INSTALLDIR)/include
ifeq ($(FORTRAN),yes)
# *.mod will install either gptl.mod or GPTL.mod
install -m 0644 gptl.inc *.mod $(INSTALLDIR)/include
endif
install -m 0644 man/man3/*.3 $(MANDIR)/man/man3
install -m 0755 *pl $(INSTALLDIR)/bin
$(MAKE) -C ctests/ install INSTALLDIR=$(INSTALLDIR)
# Some Fortran compilers name modules in upper case, so account for both possibilities
uninstall:
$(RM) -f $(INSTALLDIR)/lib/lib$(LIBNAME).a
$(RM) -f $(INSTALLDIR)/include/gptl.h $(INSTALLDIR)/include/gptl.inc $(INSTALLDIR)/include/gptl.mod $(INSTALLDIR)/include/GPTL.mod
$(RM) -f $(MANDIR)/man/man3/GPTL*.3
clean:
$(RM) -f $(OBJS) $(FOBJS) lib$(LIBNAME).a *.mod printmpistatussize.o printmpistatussize
$(MAKE) -C ctests clean
$(MAKE) -C ftests clean
f_wrappers.o: gptl.h private.h
f_wrappers_pmpi.o: gptl.h private.h
gptl.o: gptl.h private.h
util.o: gptl.h private.h
gptl_papi.o: gptl.h private.h
process_namelist.o: process_namelist.F90 gptl.inc
gptlf.o: gptlf.F90
pmpi.o: gptl.h private.h
getoverhead.o: private.h
hashstats.o: private.h
memstats.o: private.h
pr_summary.o: private.h
get_memusage.o:
print_memusage.o: gptl.h
print_rusage.o: private.h
printmpistatussize.o: printmpistatussize.F90