-
Notifications
You must be signed in to change notification settings - Fork 22
/
Makefile
207 lines (187 loc) · 7.29 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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
#
# Makefile for building and installing the pyferret module
# and the modules and libraries associated with it.
#
# Site-specific defines
include site_specific.mk
# Platform-specific defines
include platform_specific.mk.$(BUILDTYPE)
ifeq ("$(BUILDTYPE)", "intel-mac")
COPY_DYLIBS = - ( cd $(DIR_PREFIX); ./copy_dylibs.sh )
else
COPY_DYLIBS =
endif
.PHONY : all
all : optimized
.PHONY : optimized
optimized :
mkdir -p $(DIR_PREFIX)/lib
$(COPY_DYLIBS)
$(MAKE) -C $(DIR_PREFIX)/fer optimized
$(MAKE) pymod_optimized_build
$(MAKE) pymod_optimized_install
$(MAKE) externals_optimized
$(MAKE) -C $(DIR_PREFIX)/bin/build_fonts/unix
.PHONY : debug
debug :
mkdir -p $(DIR_PREFIX)/lib
$(COPY_DYLIBS)
$(MAKE) -C $(DIR_PREFIX)/fer debug
$(MAKE) pymod_debug_build
$(MAKE) pymod_debug_install
$(MAKE) externals_debug
$(MAKE) -C $(DIR_PREFIX)/bin/build_fonts/unix
## The definition of MEMORYDEBUG is observed by fer/special/FerMem_routines.c,
## which causes it to print (append) all memory allocations, reallocations,
## and frees to file "memorydebug.txt". Initialize allocated memory with
## non-zero values. Expect this to be a lot slower due to all the
## (intentionally inefficient but safe) file operations.
.PHONY : memorydebug
memorydebug :
mkdir -p $(DIR_PREFIX)/lib
$(COPY_DYLIBS)
$(MAKE) -C $(DIR_PREFIX)/fer memorydebug
$(MAKE) "CFLAGS = $(CFLAGS) -DMEMORYDEBUG" pymod_debug_build
$(MAKE) "CFLAGS = $(CFLAGS) -DMEMORYDEBUG" pymod_debug_install
$(MAKE) externals_debug
$(MAKE) -C $(DIR_PREFIX)/bin/build_fonts/unix
## The following defines GRDELDEBUG used by fer/grdel, which causes it
## to create a grdeldebug.log file with all the graphics commands issued
.PHONY : grdeldebug
grdeldebug :
mkdir -p $(DIR_PREFIX)/lib
$(COPY_DYLIBS)
$(MAKE) -C $(DIR_PREFIX)/fer grdeldebug
$(MAKE) pymod_debug_build
$(MAKE) pymod_debug_install
$(MAKE) externals_debug
$(MAKE) -C $(DIR_PREFIX)/bin/build_fonts/unix
## The following does an optimized build of libpyferret.so
.PHONY : pymod_optimized_build
pymod_optimized_build :
rm -fr $(DIR_PREFIX)/build $(DIR_PREFIX)/install
( cd $(DIR_PREFIX) ; \
export CC=$(CC) ; \
export CFLAGS="$(CFLAGS) -DNDEBUG -O" ; \
export BUILDTYPE=$(BUILDTYPE) ; \
export NETCDF_LIBDIR=$(NETCDF_LIBDIR) ; \
export HDF5_LIBDIR=$(HDF5_LIBDIR) ; \
export SZ_LIBDIR=$(SZ_LIBDIR) ; \
export CAIRO_LIBDIR=$(CAIRO_LIBDIR) ; \
export PIXMAN_LIBDIR=$(PIXMAN_LIBDIR) ; \
export PANGO_LIBDIR=$(PANGO_LIBDIR) ; \
export GLIB2_LIBDIR=$(GLIB2_LIBDIR) ; \
export GFORTRAN_LIB=$(GFORTRAN_LIB) ; \
export BIND_AND_HIDE_INTERNAL=$(BIND_AND_HIDE_INTERNAL) ; \
$(PYTHON_EXE) setup.py --quiet build )
## The following installs libpyferret.so and optimized
## versions of all the python scripts into $(DIR_PREFIX)/install.
.PHONY : pymod_optimized_install
pymod_optimized_install :
rm -fr $(DIR_PREFIX)/install
( cd $(DIR_PREFIX) ; \
export CC=$(CC) ; \
export CFLAGS="$(CFLAGS) -DNDEBUG -O" ; \
export BUILDTYPE=$(BUILDTYPE) ; \
export NETCDF_LIBDIR=$(NETCDF_LIBDIR) ; \
export HDF5_LIBDIR=$(HDF5_LIBDIR) ; \
export SZ_LIBDIR=$(SZ_LIBDIR) ; \
export CAIRO_LIBDIR=$(CAIRO_LIBDIR) ; \
export PIXMAN_LIBDIR=$(PIXMAN_LIBDIR) ; \
export PANGO_LIBDIR=$(PANGO_LIBDIR) ; \
export GLIB2_LIBDIR=$(GLIB2_LIBDIR) ; \
export GFORTRAN_LIB=$(GFORTRAN_LIB) ; \
export BIND_AND_HIDE_INTERNAL=$(BIND_AND_HIDE_INTERNAL) ; \
$(PYTHON_EXE) setup.py --quiet install -O2 --prefix=$(DIR_PREFIX)/install )
.PHONY : externals_optimized
externals_optimized :
$(MAKE) "FER_DIR = $(DIR_PREFIX)/install" -C $(DIR_PREFIX)/external_functions optimized
## The following does a debug build of libpyferret.so
.PHONY : pymod_debug_build
pymod_debug_build :
rm -fr $(DIR_PREFIX)/build $(DIR_PREFIX)/install
( cd $(DIR_PREFIX) ; \
export CC=$(CC) ; \
export CFLAGS="$(CFLAGS) -UNDEBUG -O0 -g" ; \
export BUILDTYPE=$(BUILDTYPE) ; \
export NETCDF_LIBDIR=$(NETCDF_LIBDIR) ; \
export HDF5_LIBDIR=$(HDF5_LIBDIR) ; \
export SZ_LIBDIR=$(SZ_LIBDIR) ; \
export CAIRO_LIBDIR=$(CAIRO_LIBDIR) ; \
export PIXMAN_LIBDIR=$(PIXMAN_LIBDIR) ; \
export PANGO_LIBDIR=$(PANGO_LIBDIR) ; \
export GLIB2_LIBDIR=$(GLIB2_LIBDIR) ; \
export GFORTRAN_LIB=$(GFORTRAN_LIB) ; \
export BIND_AND_HIDE_INTERNAL=$(BIND_AND_HIDE_INTERNAL) ; \
$(PYTHON_EXE) setup.py build -g )
## The following installs libpyferret.so and unoptimized
## versions of all the python scripts into $(DIR_PREFIX)/install.
.PHONY : pymod_debug_install
pymod_debug_install :
rm -fr $(DIR_PREFIX)/install
( cd $(DIR_PREFIX) ; \
export CC=$(CC) ; \
export CFLAGS="$(CFLAGS) -UNDEBUG -O0 -g" ; \
export BUILDTYPE=$(BUILDTYPE) ; \
export NETCDF_LIBDIR=$(NETCDF_LIBDIR) ; \
export HDF5_LIBDIR=$(HDF5_LIBDIR) ; \
export SZ_LIBDIR=$(SZ_LIBDIR) ; \
export CAIRO_LIBDIR=$(CAIRO_LIBDIR) ; \
export PIXMAN_LIBDIR=$(PIXMAN_LIBDIR) ; \
export PANGO_LIBDIR=$(PANGO_LIBDIR) ; \
export GLIB2_LIBDIR=$(GLIB2_LIBDIR) ; \
export GFORTRAN_LIB=$(GFORTRAN_LIB) ; \
export BIND_AND_HIDE_INTERNAL=$(BIND_AND_HIDE_INTERNAL) ; \
$(PYTHON_EXE) setup.py --quiet install -O0 --prefix=$(DIR_PREFIX)/install )
.PHONY : externals_debug
externals_debug :
$(MAKE) "FER_DIR = $(DIR_PREFIX)/install" -C $(DIR_PREFIX)/external_functions debug
## Remove everything that was built
.PHONY : clean
clean :
# $(MAKE) -C $(DIR_PREFIX)/bench clean
$(MAKE) -C $(DIR_PREFIX)/bin/build_fonts/unix clean
$(MAKE) -C $(DIR_PREFIX)/external_functions clean
rm -fr $(DIR_PREFIX)/install $(DIR_PREFIX)/build ferret.jnl*
find $(DIR_PREFIX)/pviewmod -name '*.py[co]' -delete
find $(DIR_PREFIX)/pyfermod -name '*.py[co]' -delete
$(MAKE) -C $(DIR_PREFIX)/fer clean
rm -fr $(DIR_PREFIX)/lib $(DIR_PREFIX)/dylibs
## Install Ferret binaries, scripts, and other files into $(INSTALL_FER_DIR)
.PHONY : install
install :
rm -f pyferret-latest-local.tar.gz
bin/make_dist_tar . latest local . -y
mkdir -p $(INSTALL_FER_DIR)
mv -f pyferret-latest-local.tar.gz $(INSTALL_FER_DIR)
( cd $(INSTALL_FER_DIR) ; tar xz --strip-components=1 -f pyferret-latest-local.tar.gz )
## The following is for installing the updated ferret_ef_meme_subsc.so, libpyferret.so,
## and PyFerret python scripts into $(INSTALL_FER_DIR)/lib without having to use the
## distribution tar file. Also copies all the PyFerret Fortran external function to
## the $(INSTALL_FER_DIR)/ext_func/pylibs directory.
.PHONY : update
update :
mkdir -p $(INSTALL_FER_DIR)/lib
find $(DIR_PREFIX)/external_functions -type f -perm -100 -name \*.so -exec cp {} $(INSTALL_FER_DIR)/ext_func/pylibs \;
( cd $(DIR_PREFIX) ; \
export CC=$(CC) ; \
export CFLAGS="$(CFLAGS) -O" ; \
export BUILDTYPE=$(BUILDTYPE) ; \
export NETCDF_LIBDIR=$(NETCDF_LIBDIR) ; \
export HDF5_LIBDIR=$(HDF5_LIBDIR) ; \
export SZ_LIBDIR=$(SZ_LIBDIR) ; \
export CAIRO_LIBDIR=$(CAIRO_LIBDIR) ; \
export PIXMAN_LIBDIR=$(PIXMAN_LIBDIR) ; \
export PANGO_LIBDIR=$(PANGO_LIBDIR) ; \
export GLIB2_LIBDIR=$(GLIB2_LIBDIR) ; \
export GFORTRAN_LIB=$(GFORTRAN_LIB) ; \
export BIND_AND_HIDE_INTERNAL=$(BIND_AND_HIDE_INTERNAL) ; \
$(PYTHON_EXE) setup.py --quiet install -O2 --prefix=$(INSTALL_FER_DIR) )
## Compare results from executing the RUN_TESTS.sh test suite with those saved under bench/test_results
.PHONY : check
check :
$(MAKE) -C $(DIR_PREFIX)/bench check
.PHONY : check_noremote
check_noremote :
$(MAKE) -C $(DIR_PREFIX)/bench check_noremote
##