| 1 |
##-------------------------------------------------------------------## |
| 2 |
## Makefile for compiling SPLASH and linking with ## |
| 3 |
## required libraries ## |
| 4 |
## ## |
| 5 |
## Written by Daniel Price ## |
| 6 |
## University of Exeter, UK, 2004-2008 ## |
| 7 |
## Monash University, Australia, 2008- ## |
| 8 |
## ## |
| 9 |
## requires GNU make (on some systems this is 'gmake' instead ## |
| 10 |
## of 'make') ## |
| 11 |
## ## |
| 12 |
## see the INSTALL file for detailed installation instructions ## |
| 13 |
##-------------------------------------------------------------------## |
| 14 |
|
| 15 |
.KEEP_STATE: |
| 16 |
|
| 17 |
KNOWN_SYSTEM=no |
| 18 |
SRCDIR=../src |
| 19 |
BINDIR=../bin |
| 20 |
TESTDIR=../tests |
| 21 |
VPATH=$(SRCDIR) $(SRCDIR)/H5Part ../utils |
| 22 |
SHELL=/bin/bash |
| 23 |
|
| 24 |
# |
| 25 |
# use SYSTEM=gfortran if no SYSTEM variable is set |
| 26 |
# |
| 27 |
ifndef SYSTEM |
| 28 |
SYSTEM=gfortran |
| 29 |
endif |
| 30 |
# |
| 31 |
# some default settings for unix systems |
| 32 |
# |
| 33 |
FC= |
| 34 |
FFLAGS= |
| 35 |
# |
| 36 |
# change the line below if SPLASH does not find the X11 libraries |
| 37 |
# (some settings of the SYSTEM variable for specific machines overwrite this) |
| 38 |
# |
| 39 |
# X11_LIBS= -L/usr/X11R6/lib64 -lX11 |
| 40 |
# X11_DIR= /usr/X11/ |
| 41 |
#X11_LIBS= -L$(X11_DIR)/lib -lX11 |
| 42 |
X11_CFLAGS= -I$(X11_DIR)/include |
| 43 |
CAIRO_LIBS= -L$(X11_DIR)/lib -lcairo |
| 44 |
CAIRO_CFLAGS= -I$(X11_DIR)/include |
| 45 |
|
| 46 |
#-------------------------------------------------------------- |
| 47 |
# here we choose the backend plotting library for splash |
| 48 |
# (giza is the default backend for splash v2.x, but can |
| 49 |
# still be compiled with PGPLOT, just with disabled features) |
| 50 |
#-------------------------------------------------------------- |
| 51 |
ifeq ($(BACKEND), pgplot) |
| 52 |
#-- P G P L O T -- |
| 53 |
PLOTLIB= plotlib_pgplot.f90 |
| 54 |
# |
| 55 |
# change the line below depending on where/how you have installed PGPLOT |
| 56 |
# (some settings of the SYSTEM variable for specific machines overwrite this) |
| 57 |
# |
| 58 |
PGPLOTLIBS = -L$(PGPLOT_DIR) -lpgplot -lpng |
| 59 |
else |
| 60 |
ifeq ($(BACKEND), none) |
| 61 |
PLOTLIB= plotlib_mock.f90 |
| 62 |
else |
| 63 |
#-- C A I R O -- |
| 64 |
GIZA_DIR= $(PREFIX) |
| 65 |
PLOTLIB= giza-fortran.F90 plotlib_giza.f90 |
| 66 |
PGPLOTLIBS = -L$(GIZA_DIR)/lib -lgiza $(CAIRO_LIBS) |
| 67 |
CFLAGS+= -fPIC |
| 68 |
endif |
| 69 |
endif |
| 70 |
#-------------------------------------------------------------- |
| 71 |
|
| 72 |
# |
| 73 |
# If you need the HDF5 libraries, edit the lines below |
| 74 |
# possibly adding a -L/libpath/ and a -I/includepath/ |
| 75 |
# |
| 76 |
ifndef HDF5ROOT |
| 77 |
ifdef HDF5_ROOT |
| 78 |
HDF5ROOT=$(HDF5_ROOT) |
| 79 |
endif |
| 80 |
ifdef HDF5_DIR |
| 81 |
HDF5ROOT=$(HDF5_DIR) |
| 82 |
endif |
| 83 |
endif |
| 84 |
HDF5LIBS = -L$(HDF5ROOT)/lib -lhdf5 |
| 85 |
HDF5INCLUDE = -I$(HDF5ROOT)/include |
| 86 |
H5PART_LIBS = -L$(H5PART_DIR)/lib -lH5Part |
| 87 |
H5PART_INCLUDE = -I$(H5PART_DIR)/include |
| 88 |
ifdef FITS_DIR |
| 89 |
FITSLIBS = -L$(FITS_DIR)/lib -lcfitsio |
| 90 |
else |
| 91 |
FITSLIBS = -lcfitsio |
| 92 |
endif |
| 93 |
FITSINCLUDE = -I$(FITS_DIR)/include |
| 94 |
# |
| 95 |
# this file contains system-dependent routines like getarg, iargc etc. |
| 96 |
# |
| 97 |
SYSTEMFILE= system_f2003.f90 |
| 98 |
# |
| 99 |
# this can be used to static link the pgplot libraries if all else fails |
| 100 |
# |
| 101 |
STATICLIBS= |
| 102 |
# |
| 103 |
# set the parallel flag to 'yes' to compile with openMP directives |
| 104 |
# |
| 105 |
#PARALLEL=no |
| 106 |
ifndef OPENMP |
| 107 |
OPENMP=yes |
| 108 |
endif |
| 109 |
# |
| 110 |
# compile in double precision by default (v3.0 onwards this is now default) |
| 111 |
# |
| 112 |
ifndef DOUBLEPRECISION |
| 113 |
DOUBLEPRECISION=yes |
| 114 |
endif |
| 115 |
# |
| 116 |
# the openMP flags should be set in the lines defining your system type |
| 117 |
# (ie. leave line below blank) |
| 118 |
OMPFLAGS= |
| 119 |
# |
| 120 |
# the endian flag can be used to compile the code to read BIG or LITTLE endian data |
| 121 |
# some compilers also allow this to be done at runtime (e.g. g95, ifort) by setting |
| 122 |
# an environment variable appropriately (e.g. G95_ENDIAN or F_UFMTENDIAN) |
| 123 |
# |
| 124 |
#ENDIAN= |
| 125 |
#ENDIAN='BIG' |
| 126 |
#ENDIAN='LITTLE' |
| 127 |
# |
| 128 |
# default destination for installed binaries |
| 129 |
# |
| 130 |
DESTDIR= |
| 131 |
PREFIX=/usr/ |
| 132 |
# |
| 133 |
# default C compiler |
| 134 |
# |
| 135 |
ifndef CC |
| 136 |
CC = gcc |
| 137 |
endif |
| 138 |
ifndef CXX |
| 139 |
CXX = g++ |
| 140 |
endif |
| 141 |
|
| 142 |
# default C++ library linking |
| 143 |
# (different between Mac/Linux) |
| 144 |
UNAME=$(shell uname) |
| 145 |
ifeq ($(UNAME), Darwin) |
| 146 |
CXXLIBS= -lc++ |
| 147 |
else |
| 148 |
CXXLIBS= -lstdc++ |
| 149 |
endif |
| 150 |
|
| 151 |
#-------------------------------------------------------------- |
| 152 |
# the following are general settings for particular compilers |
| 153 |
# |
| 154 |
# set the environment variable 'SYSTEM' to one of those |
| 155 |
# listed to use the appropriate settings |
| 156 |
# |
| 157 |
# in bash the equivalent is |
| 158 |
# export SYSTEM='gfortran' |
| 159 |
# |
| 160 |
#-------------------------------------------------------------- |
| 161 |
|
| 162 |
ifeq ($(SYSTEM), gfortran) |
| 163 |
# gfortran compiler (part of gcc 4.x.x) |
| 164 |
CC = gcc |
| 165 |
FC= gfortran |
| 166 |
FFLAGS= -fPIC |
| 167 |
DBLFLAGS= -fdefault-real-8 -fdefault-double-8 |
| 168 |
SYSTEMFILE= system_f2003.f90 |
| 169 |
DEBUGFLAG= -Wall -Wextra -pedantic -g -frange-check -fcheck=all -fbacktrace \ |
| 170 |
-finit-real=NaN #-ffpe-trap=invalid,zero,overflow |
| 171 |
OMPFLAGS= -fopenmp |
| 172 |
ENDIANFLAGBIG= -fconvert=big-endian |
| 173 |
ENDIANFLAGLITTLE= -fconvert=little-endian |
| 174 |
PGPLOTLIBS= -lgiza |
| 175 |
KNOWN_SYSTEM=yes |
| 176 |
endif |
| 177 |
|
| 178 |
ifeq ($(SYSTEM),sunf95) |
| 179 |
# sun f95 compiler on linux |
| 180 |
FC= sunf95 |
| 181 |
FFLAGS= -fast -ftrap=%none |
| 182 |
OMPFLAGS= -openmp |
| 183 |
DBLFLAGS= -xtypemap=real:64,double:64 |
| 184 |
DEBUGFLAG= -g -C -w4 -errtags -erroff=COMMENT_1582,COMMENT_1744 -ftrap=%all |
| 185 |
SYSTEMFILE= system_f2003.f90 |
| 186 |
ENDIANFLAGBIG= -xfilebyteorder=big16:%all |
| 187 |
ENDIANFLAGLITTLE= -xfilebyteorder=little16:%all |
| 188 |
KNOWN_SYSTEM=yes |
| 189 |
endif |
| 190 |
|
| 191 |
ifeq ($(SYSTEM),ifort) |
| 192 |
# this is for the intel fortran compiler (version 10) |
| 193 |
FC= ifort |
| 194 |
FFLAGS= -O3 -nbs -fPIC |
| 195 |
OMPFLAGS= -qopenmp |
| 196 |
DBLFLAGS= -r8 |
| 197 |
DEBUGFLAG= -C -g |
| 198 |
SYSTEMFILE= system_f2003.f90 |
| 199 |
ENDIANFLAGBIG= -convert big_endian |
| 200 |
ENDIANFLAGLITTLE= -convert little_endian |
| 201 |
# or use setenv F_UFMTENDIAN=big or little at runtime |
| 202 |
KNOWN_SYSTEM=yes |
| 203 |
CC=icc |
| 204 |
CFLAGS=-Wall -O3 -fPIC |
| 205 |
endif |
| 206 |
|
| 207 |
ifeq ($(SYSTEM),ifx) |
| 208 |
# this is for the intel fortran compiler (version 10) |
| 209 |
FC= ifx |
| 210 |
FFLAGS= -O3 -nbs -fPIC |
| 211 |
OMPFLAGS= -qopenmp |
| 212 |
DBLFLAGS= -r8 |
| 213 |
DEBUGFLAG= -C -g |
| 214 |
SYSTEMFILE= system_f2003.f90 |
| 215 |
ENDIANFLAGBIG= -convert big_endian |
| 216 |
ENDIANFLAGLITTLE= -convert little_endian |
| 217 |
# or use setenv F_UFMTENDIAN=big or little at runtime |
| 218 |
KNOWN_SYSTEM=yes |
| 219 |
CC=icc |
| 220 |
CFLAGS=-Wall -O3 -fPIC |
| 221 |
endif |
| 222 |
|
| 223 |
ifeq ($(SYSTEM),pgf90) |
| 224 |
# this is for the Portland Group Fortran 90 compiler (tested with version 7.2-5) |
| 225 |
FC= pgf90 |
| 226 |
FFLAGS= -fast -mcmodel=medium -Mbackslash -Ktrap=none |
| 227 |
DBLFLAGS= -r8 |
| 228 |
DEBUGFLAG= -C -g -gopt -Mbounds -Mchkfpstk -Mchkptr -Mchkstk -Mcoff \ |
| 229 |
-Mdwarf1 -Mdwarf2 -Melf -Mpgicoff -traceback |
| 230 |
OMPFLAGS= -mp |
| 231 |
SYSTEMFILE= system_f2003.f90 |
| 232 |
ENDIANFLAGBIG= -Mbyteswapio # only works on a little-endian machine |
| 233 |
ENDIANFLAGLITTLE= |
| 234 |
KNOWN_SYSTEM=yes |
| 235 |
endif |
| 236 |
|
| 237 |
ifeq ($(SYSTEM),pathf95) |
| 238 |
# this is for the Pathscale f95 compiler |
| 239 |
FC= pathf95 |
| 240 |
FFLAGS= -Ofast -mcmodel=medium |
| 241 |
DBLFLAGS= -r8 |
| 242 |
DEBUGFLAG= -C -g |
| 243 |
OMPFLAGS= -openmp |
| 244 |
SYSTEMFILE= system_f2003.f90 |
| 245 |
ENDIANFLAGBIG= -convert big_endian |
| 246 |
ENDIANFLAGLITTLE= -convert little_endian |
| 247 |
KNOWN_SYSTEM=yes |
| 248 |
endif |
| 249 |
|
| 250 |
#-------------------------------------------------------------- |
| 251 |
# |
| 252 |
# the following presets are user or machine-specific |
| 253 |
# |
| 254 |
#-------------------------------------------------------------- |
| 255 |
ifeq ($(SYSTEM),cody) |
| 256 |
FC= gfortran |
| 257 |
FFLAGS= -O3 -Wall |
| 258 |
SYSTEMFILE= system_f2003.f90 |
| 259 |
DBLFLAGS= -fdefault-real-8 -fdefault-double-8 |
| 260 |
DEBUGFLAG= -g -frange-check |
| 261 |
OMPFLAGS= -fopenmp |
| 262 |
ENDIANFLAGBIG= -fconvert=big-endian |
| 263 |
ENDIANFLAGLITTLE= -fconvert=little-endian |
| 264 |
SNFLAGS= -L$(HOME)/tree16/Objfiles/g5 -lsw |
| 265 |
CFLAGS = -g -O2 -Wall -I$(HOME)/tree16/include -fbounds-check |
| 266 |
CC = gcc |
| 267 |
KNOWN_SYSTEM=yes |
| 268 |
endif |
| 269 |
|
| 270 |
# |
| 271 |
# these are the flags used for linking |
| 272 |
# |
| 273 |
LDFLAGS+= $(X11_LIBS) $(PGPLOTLIBS) |
| 274 |
PIELDFLAGS= -pie |
| 275 |
|
| 276 |
# |
| 277 |
# this is an option to change the endian-ness at compile time |
| 278 |
# (provided the appropriate flags are specified for the compiler) |
| 279 |
# |
| 280 |
ifeq ($(ENDIAN), BIG) |
| 281 |
FFLAGS += ${ENDIANFLAGBIG} |
| 282 |
endif |
| 283 |
|
| 284 |
ifeq ($(ENDIAN), LITTLE) |
| 285 |
FFLAGS += ${ENDIANFLAGLITTLE} |
| 286 |
endif |
| 287 |
|
| 288 |
# compile in parallel |
| 289 |
ifeq ($(PARALLEL),yes) |
| 290 |
FFLAGS += $(OMPFLAGS) |
| 291 |
else |
| 292 |
ifeq ($(OPENMP),yes) |
| 293 |
FFLAGS += $(OMPFLAGS) |
| 294 |
endif |
| 295 |
endif |
| 296 |
|
| 297 |
# compile in double precision |
| 298 |
ifeq ($(DOUBLEPRECISION), yes) |
| 299 |
FFLAGS += ${DBLFLAGS} |
| 300 |
FPPFLAGS+=-DDP |
| 301 |
endif |
| 302 |
|
| 303 |
# add debugging flags at compile time |
| 304 |
ifeq ($(DEBUG),yes) |
| 305 |
FFLAGS += $(DEBUGFLAG) |
| 306 |
endif |
| 307 |
|
| 308 |
# |
| 309 |
# MPI... no splash doesn't use it |
| 310 |
# but sometimes you need to compile |
| 311 |
# with the mpi compiler (e.g. to link |
| 312 |
# correctly to MPI-HDF5 libraries) |
| 313 |
# This just changes the compiler name |
| 314 |
# whilst keeping the flags the same |
| 315 |
# if MPI is set to "yes" |
| 316 |
# |
| 317 |
ifeq ($(MPI),yes) |
| 318 |
FC= mpif90 -DPARALLEL_IO |
| 319 |
CC=mpicc -DPARALLEL_IO |
| 320 |
endif |
| 321 |
|
| 322 |
# |
| 323 |
# If PGPLOT was compiled with a different compiler to the one used here, |
| 324 |
# need to link to the libraries for that compiler. We attempt to do this |
| 325 |
# automatically below by looking in the PGPLOT makefile. |
| 326 |
# |
| 327 |
# If the relevant library is not found, may also need -L/dir/ for the directory |
| 328 |
# where the corresponding library is located (e.g. -L/usr/local/gfortran/lib -lgfortran) |
| 329 |
# |
| 330 |
# (information about what is done here is printed via the checkpgplot target, below) |
| 331 |
# |
| 332 |
ifeq ($(BACKEND),pgplot) |
| 333 |
ifdef PGPLOT_DIR |
| 334 |
|
| 335 |
PGPLOT_COMP=${shell if [ -e $$PGPLOT_DIR/makefile ]; then grep 'FCOMPL=' $$PGPLOT_DIR/makefile | cut -d= -f2; else echo unknown; fi} |
| 336 |
|
| 337 |
ifneq (X$(FC), X) # make sure it is not just accidentally blank |
| 338 |
ifneq ($(PGPLOT_COMP), $(FC)) |
| 339 |
# g77-compiled PGPLOT |
| 340 |
ifeq ($(PGPLOT_COMP), g77) |
| 341 |
PGPLOTLIBS+=-lg2c |
| 342 |
endif |
| 343 |
# gfortran-compiled PGPLOT |
| 344 |
ifeq ($(PGPLOT_COMP), gfortran) |
| 345 |
PGPLOTLIBS+=-lgfortran |
| 346 |
endif |
| 347 |
# g95-compiled PGPLOT |
| 348 |
ifeq ($(PGPLOT_COMP), g95) |
| 349 |
PGPLOTLIBS+=-lg95 |
| 350 |
endif |
| 351 |
endif |
| 352 |
endif |
| 353 |
endif |
| 354 |
endif |
| 355 |
|
| 356 |
ifeq ($(FC),gfortran) |
| 357 |
GFORTRAN_VERSION=${shell $(FC) -dumpversion | head -1 | awk '{print $$NF}'} |
| 358 |
GFORTRAN_VMAJOR:=${shell echo "$(GFORTRAN_VERSION)" | cut -f1 -d.} |
| 359 |
GFORTRAN_VMINOR:=${shell echo "$(GFORTRAN_VERSION)" | cut -f2 -d.} |
| 360 |
GFORTRAN_GE_4_4:=$(shell [ $(GFORTRAN_VMAJOR) -gt 4 -o \( $(GFORTRAN_VMAJOR) -eq 4 -a $(GFORTRAN_VMINOR) -ge 4 \) ] && echo true) |
| 361 |
else |
| 362 |
GFORTRAN_GE_4_4:=true |
| 363 |
endif |
| 364 |
|
| 365 |
# define the implicit rule to make a .o file from a .f90/.f95 file |
| 366 |
# (some Make versions don't know this) |
| 367 |
|
| 368 |
%.o : %.f90 |
| 369 |
$(FC) $(FFLAGS) -c $< -o $@ |
| 370 |
%.o : %.F90 |
| 371 |
$(FC) $(FPPFLAGS) $(FFLAGS) -c $< -o $@ |
| 372 |
%.o : %.f95 |
| 373 |
$(FC) $(FFLAGS) -c $< -o $@ |
| 374 |
%.o : %.c |
| 375 |
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(INCLUDES) $< -o $@ |
| 376 |
|
| 377 |
# modules must be compiled in the correct order to check interfaces |
| 378 |
# really should include all dependencies but I am lazy |
| 379 |
|
| 380 |
READFILES= utils_json.f90 \ |
| 381 |
read_data_ascii.f90 read_data_sphNG.f90 read_data_ndspmhd.f90 \ |
| 382 |
read_data_gadget.f90 read_data_VINE.f90 read_data_sro.f90 \ |
| 383 |
read_data_dragon.f90 read_data_seren.f90 read_data_tipsy.f90 \ |
| 384 |
read_data_mhutch.f90 read_data_UCLA.f90 read_data_aly.f90 \ |
| 385 |
read_data_bauswein.f90 read_data_egaburov.f90 read_data_starsmasher.f90 \ |
| 386 |
read_data_gadget_jsb.f90 read_data_foulkes.f90 read_data_jjm.f90 \ |
| 387 |
read_data_jjm_multiphase.f90 read_data_mbate.f90 read_data_oilonwater.f90 \ |
| 388 |
read_data_rsph.f90 read_data_urban.f90 read_data_shamrock.f90 \ |
| 389 |
read_data_spyros.f90 read_data_vanaverbeke.f90 read_data_vtk.f90 |
| 390 |
|
| 391 |
READFILES_HDF5= hdf5_helper_utils.c read_data_gadget_hdf5_utils.c read_data_gadget_hdf5.f90 \ |
| 392 |
read_data_amuse_hdf5_utils.c read_data_amuse_hdf5.f90 \ |
| 393 |
read_data_cactus_hdf5_utils.c read_data_cactus_hdf5_futils.f90 read_data_cactus_hdf5.f90 \ |
| 394 |
read_data_flash_hdf5_utils.c read_data_flash_hdf5.f90 |
| 395 |
#read_data_falcON_hdf5_utils.cc read_data_falcON_hdf5_utils.f90 read_data_falcON_hdf5.f90 \ |
| 396 |
|
| 397 |
READFILES_FITS= write_fits.f90 read_data_fits.f90 |
| 398 |
|
| 399 |
READFILES_PBOB= read_data_pbob_utils.c read_data_pbob.f90 read_pbob.c read_particle.c |
| 400 |
|
| 401 |
READFILES_H5PART= H5PartF.c H5PartAttribF.c H5Part.f90 H5PartAttrib.f90 |
| 402 |
|
| 403 |
RUN_CHECKS= |
| 404 |
|
| 405 |
LDFLAGSLIB= |
| 406 |
|
| 407 |
# link with hdf5 libraries |
| 408 |
ifeq ($(HDF5),yes) |
| 409 |
READFILES+=$(READFILES_HDF5) |
| 410 |
CFLAGS+=$(HDF5INCLUDE) |
| 411 |
LDFLAGS+=$(HDF5LIBS) |
| 412 |
LDFLAGSLIB+=$(HDF5LIBS) |
| 413 |
FPPFLAGS+=-DHDF5 |
| 414 |
RUN_CHECKS+=checkhdf5 |
| 415 |
endif |
| 416 |
|
| 417 |
|
| 418 |
ifeq ($(FITS),yes) |
| 419 |
READFILES+= $(READFILES_FITS) |
| 420 |
LDFLAGS+=$(FITSLIBS) |
| 421 |
LDFLAGSLIB+=$(FITSLIBS) |
| 422 |
FPPFLAGS+=-DFITS |
| 423 |
RUN_CHECKS+=checkfits |
| 424 |
else |
| 425 |
READFILES+=no_fits.f90 |
| 426 |
endif |
| 427 |
|
| 428 |
ifdef PBOB_DIR |
| 429 |
READFILES+=$(READFILES_PBOB) |
| 430 |
VPATH+=$(PBOB_DIR) |
| 431 |
RUN_CHECKS+=checkpbob |
| 432 |
endif |
| 433 |
|
| 434 |
ifdef H5PART_DIR |
| 435 |
READFILES+=$(READFILES_H5PART) |
| 436 |
VPATH+=$(H5PART_LIBS) $(HDF5LIBS) |
| 437 |
RUN_CHECKS+=checkh5part |
| 438 |
endif |
| 439 |
|
| 440 |
|
| 441 |
SOURCES= $(PLOTLIB) globaldata.f90 physcon.f90 utils_vectors.f90 \ |
| 442 |
asciiutils.f90 byteswap.f90 \ |
| 443 |
labels.f90 partutils.f90 transform.f90 setpage.f90 sort.f90 \ |
| 444 |
prompting.f90 promptlist.f90 map_columns.f90 geometry.f90 kernels.f90 \ |
| 445 |
plotutils.f90 blackbody.f90 colourbar.f90 \ |
| 446 |
colours.f90 colourparts.f90 timing.f90 pagecolours.f90 \ |
| 447 |
interpolation.f90 interpolate1D.f90 interpolate2D.f90 \ |
| 448 |
rotate.f90 interpolate3D_projection.f90 interpolate3D_geom.f90 interpolate3D_xsec.f90 \ |
| 449 |
interpolate3D_proj_geom.f90 \ |
| 450 |
interpolate3D_opacity.f90 interpolate_vec.f90 interpolate3D.f90 \ |
| 451 |
units.f90 limits.f90 geomutils.f90 dataread_utils.f90 \ |
| 452 |
write_data_gadget.f90 write_data_phantom.f90 write_pfm.f90 write_pixmap.f90 \ |
| 453 |
write_griddata.f90 write_sphdata.f90 read_composition.f90 \ |
| 454 |
$(SYSTEMFILE) system_utils.f90 \ |
| 455 |
cubicsolve.f90 discplot.f90 fparser.f90 parsetext.f90 \ |
| 456 |
exact_fromfile.f90 exact_Cshock.f90 exact_mhdshock.f90 \ |
| 457 |
exact_polytrope.f90 exact_rhoh.f90 exact_rochelobe.f90 \ |
| 458 |
exact_sedov.f90 exact_shock.f90 exact_shock_sr.f90 exact_wave.f90 \ |
| 459 |
exact_toystar1D.f90 exact_toystar2D.f90 exact_function.f90 exact_planetdisc.f90\ |
| 460 |
exact_densityprofiles.f90 exact_dustywaves.f90 exact_torus.f90 exact_bondi.f90 \ |
| 461 |
exact_ringspread.f90 exact_gresho.f90 exact.f90 shapes.f90 \ |
| 462 |
allocate.f90 titles.f90 calc_quantities.f90 contours.f90 \ |
| 463 |
legends.f90 options_render.f90 options_particleplots.f90 options_xsecrotate.f90 \ |
| 464 |
options_limits.f90 options_page.f90 imageutils.f90 \ |
| 465 |
lightcurve_utils.f90 $(READFILES) lightcurve.f90 extinction.f90 \ |
| 466 |
read_data.F90 get_h.f90\ |
| 467 |
adjust_data.f90 set_options_from_dataread.f90 get_data.f90 \ |
| 468 |
options_data.f90 options_powerspec.f90 \ |
| 469 |
options_vecplot.f90 pdfs.f90 \ |
| 470 |
particleplot.f90 interactive.f90 \ |
| 471 |
convert_grid.f90 \ |
| 472 |
analysis.f90 convert.f90 fieldlines.f90 \ |
| 473 |
powerspectrums.f90 render.f90 \ |
| 474 |
plotstep.f90 timestepping.f90 \ |
| 475 |
defaults.f90 initialise.f90 menu.f90 \ |
| 476 |
splash.f90 |
| 477 |
|
| 478 |
|
| 479 |
OBJECTS1= $(SOURCES:.f90=.o) $(STATICLIBS) |
| 480 |
OBJECTS2= $(OBJECTS1:.F90=.o) |
| 481 |
OBJECTS3= $(OBJECTS2:.c=.o) |
| 482 |
OBJECTS= $(OBJECTS3:.cc=.o) |
| 483 |
|
| 484 |
|
| 485 |
# |
| 486 |
# Now compile with the appropriate data read file |
| 487 |
# (move yours to the top so that you can simply type "make") |
| 488 |
# |
| 489 |
|
| 490 |
all: checksystem $(RUN_CHECKS) $(OBJECTS) read_data.o |
| 491 |
$(FC) $(FFLAGS) -o $(BINDIR)/splash $(OBJECTS) $(LDFLAGS) $(PIELDFLAGS) |
| 492 |
@echo; echo ' SPLASH v3 successfully compiled! '; |
| 493 |
@echo; echo ' "sudo make install" to copy the binary to $(DESTDIR)$(PREFIX)/bin'; |
| 494 |
@echo; echo ' If you do not have admin privileges, add the following to your .bashrc or equialent:'; |
| 495 |
@echo; echo ' export SPLASH_DIR=$$HOME/splash'; |
| 496 |
@echo ' export PATH=$$PATH:$$SPLASH_DIR/bin'; |
| 497 |
@echo; echo ' For backwards compatibility with v2.x, add the following to your .bashrc or equivalent:'; |
| 498 |
@echo; echo " alias asplash='splash ' # alias for ascii splash"; |
| 499 |
@echo " alias ssplash='splash -f phantom'"; |
| 500 |
@echo " alias gsplash='splash -f gadget' "; |
| 501 |
@echo " alias vsplash='splash -f vine' "; |
| 502 |
@echo " alias nsplash='splash -f ndspmhd' "; |
| 503 |
@echo " alias rsplash='splash -f srosph' "; |
| 504 |
@echo " alias dsplash='splash -f dragon' "; |
| 505 |
@echo " alias srsplash='splash -f seren' "; |
| 506 |
@echo " alias tsplash='splash -f tipsy' "; |
| 507 |
@echo " alias msplash='splash -f mhutch' "; echo; |
| 508 |
|
| 509 |
#---falcON HDF5 read --- |
| 510 |
falcon: falcON |
| 511 |
|
| 512 |
falcON: falcON_hdf5 |
| 513 |
|
| 514 |
falcON_hdf5: checksystem checkhdf5 $(OBJECTS) read_data_falcON_hdf5_utils.o read_data_falcON_hdf5.o |
| 515 |
$(FC) $(FFLAGS) -o $(BINDIR)/fsplash $(OBJECTS) read_data_falcON_hdf5_utils.o read_data_falcON_hdf5.o $(LDFLAGS) $(PIELDFLAGS) $(CXXLIBS) $(HDF5LIBS) -lhdf5_cpp |
| 516 |
|
| 517 |
read_data_falcON_hdf5_utils.o: read_data_falcON_hdf5_utils.cc |
| 518 |
$(CXX) $(CXXFLAGS) -std=c++11 $(HDF5INCLUDE) -c $< -o $@ |
| 519 |
|
| 520 |
|
| 521 |
|
| 522 |
#---SILO read --- |
| 523 |
silo: checksystem checksilo $(OBJECTS) read_data_silo_utils.o read_data_silo.o |
| 524 |
$(FC) $(FFLAGS) -o $(BINDIR)/silosplash $(OBJECTS) read_data_silo_utils.o read_data_silo.o $(LDFLAGS) $(PIELDFLAGS) $(HDF5LIBS) -lsiloh5 |
| 525 |
|
| 526 |
read_data_silo_utils.o: read_data_silo_utils.c |
| 527 |
$(CC) $(CFLAGS) $(HDF5INCLUDE) -c $< -o $@ |
| 528 |
|
| 529 |
# |
| 530 |
# sources for the grid2pdf command-line utility |
| 531 |
# |
| 532 |
SRCGRID2PDF= $(SYSTEMFILE) globaldata.f90 prompting.f90 transform.f90 \ |
| 533 |
asciiutils.f90 write_griddata.f90 pdfs.f90 grid2pdf.f90 |
| 534 |
OBJGRID2PDF= ${SRCGRID2PDF:.f90=.o} |
| 535 |
grid2pdf: checksystem $(OBJGRID2PDF) |
| 536 |
$(FC) $(FFLAGS) -o $(BINDIR)/$@ $(OBJGRID2PDF) $(PIELDFLAGS) |
| 537 |
|
| 538 |
# |
| 539 |
# |
| 540 |
# |
| 541 |
liball: lib libexact libread |
| 542 |
|
| 543 |
# |
| 544 |
# libsplash: library version of splash interpolation routines |
| 545 |
# |
| 546 |
SRCLIB= sort.f90 asciiutils.f90 kernels.f90 timing.f90 geometry.f90 \ |
| 547 |
interpolation.f90 interpolate1D.f90 interpolate2D.f90 interpolate3D.f90 \ |
| 548 |
interpolate3D_geom.f90 interpolate3D_projection.f90 \ |
| 549 |
interpolate3D_proj_geom.f90 interpolate3D_opacity.f90 interpolate3D_xsec.f90 \ |
| 550 |
libsplash.f90 libutils.f90 |
| 551 |
OBJLIB1=${SRCLIB:.f90=.o} |
| 552 |
OBJLIB=${OBJLIB1} libread.o |
| 553 |
|
| 554 |
.PHONY: libsplash |
| 555 |
libsplash: lib |
| 556 |
|
| 557 |
lib: $(OBJLIB) |
| 558 |
$(FC) -shared -fPIC $(FFLAGS) $(FPPFLAGS) $(DBLFLAGS) $(OBJLIB) -o libsplash.so |
| 559 |
|
| 560 |
# |
| 561 |
# libexact: exact solution library |
| 562 |
# |
| 563 |
SRCLIBEXACT= $(PLOTLIB) libutils.f90 geometry.f90 exact_shock.f90 \ |
| 564 |
exact_shock_sr.f90 exact_sedov.f90 \ |
| 565 |
exact_polytrope.f90 exact_toystar1D.f90 exact_toystar2D.f90 exact_gresho.f90 \ |
| 566 |
exact_mhdshock.f90 exact_rhoh.f90 exact_densityprofiles.f90 exact_torus.f90 \ |
| 567 |
exact_ringspread.f90 cubicsolve.f90 exact_dustywaves.f90 exact_rochelobe.f90 \ |
| 568 |
exact_Cshock.f90 exact_planetdisc.f90 exact_bondi.f90 \ |
| 569 |
libexact.f90 |
| 570 |
OBJLIBEXACT=${SRCLIBEXACT:.f90=.o} |
| 571 |
OBJLIBEXACTALL=${OBJLIBEXACT:.F90=.o} |
| 572 |
|
| 573 |
.PHONY: libexact libexact2 |
| 574 |
libexact: |
| 575 |
${MAKE} libexact2 BACKEND=none |
| 576 |
|
| 577 |
libexact2: checksystem $(OBJLIBEXACTALL) |
| 578 |
$(FC) -shared -fPIC $(FFLAGS) $(FPPFLAGS) $(DBLFLAGS) $(OBJLIBEXACTALL) -o libexact.so |
| 579 |
|
| 580 |
# |
| 581 |
# libread: data read library |
| 582 |
# |
| 583 |
SRCLIBREAD= globaldata.f90 physcon.f90 asciiutils.f90 libutils.f90 labels.f90 allocate.f90 byteswap.f90 $(SYSTEMFILE)\ |
| 584 |
system_utils.f90 geometry.f90 prompting.f90 fparser.f90 units.f90 timing.f90\ |
| 585 |
sort.f90 geomutils.f90 partutils.f90 calc_quantities.f90 dataread_utils.f90 \ |
| 586 |
utils_vectors.f90 lightcurve_utils.f90 read_composition.f90 $(READFILES) read_data.F90 kernels.f90 get_h.f90\ |
| 587 |
adjust_data.f90 limits.f90 get_data.f90 initialise.f90 read.f90 libread.f90 |
| 588 |
|
| 589 |
OBJLIBREAD=${SRCLIBREAD:.f90=.o} |
| 590 |
OBJLIBREAD1=${OBJLIBREAD:.F90=.o} |
| 591 |
OBJLIBREADALL=${OBJLIBREAD1:.c=.o} |
| 592 |
|
| 593 |
.PHONY: libread |
| 594 |
libread: checksystem $(OBJLIBREADALL) |
| 595 |
$(FC) -shared -fPIC $(FFLAGS) $(FPPFLAGS) $(DBLFLAGS) $(OBJLIBREADALL) -o libread.so $(LDFLAGSLIB) |
| 596 |
|
| 597 |
# |
| 598 |
# splash image manipulation utilities |
| 599 |
# |
| 600 |
SOURCESIMLIB= asciiutils.f90 $(SYSTEMFILE) system_utils.f90 timing.f90 kernels.f90 \ |
| 601 |
interpolation.f90 interpolate2D.f90 interpolate3D.f90 \ |
| 602 |
imageutils.f90 write_fits.f90 denoise.f90 |
| 603 |
|
| 604 |
OBJECTSIMLIB = $(SOURCESIMLIB:.f90=.o) |
| 605 |
|
| 606 |
.PHONY: denoise |
| 607 |
splash-image: denoise |
| 608 |
|
| 609 |
splash-denoise: denoise |
| 610 |
|
| 611 |
denoise: checksystem checkfits $(OBJECTSIMLIB) |
| 612 |
$(FC) $(FFLAGS) -o $(BINDIR)/$@ $(OBJECTSIMLIB) $(FITSLIBS) $(PIELDFLAGS) |
| 613 |
@echo; echo ' Denoise utility successfully compiled! '; |
| 614 |
@echo; echo ' Use "make install" to copy the binaries to $(DESTDIR)$(PREFIX)/bin'; echo; |
| 615 |
|
| 616 |
# |
| 617 |
# splash moments |
| 618 |
# |
| 619 |
SOURCESM= asciiutils.f90 $(SYSTEMFILE) system_utils.f90 timing.f90 kernels.f90 \ |
| 620 |
interpolate1D.f90 write_fits.f90 moments.f90 sph_moments.f90 |
| 621 |
|
| 622 |
OBJECTSM = $(SOURCESM:.f90=.o) |
| 623 |
|
| 624 |
.PHONY: sphmoments |
| 625 |
sphmoments: checksystem checkfits $(OBJECTSM) |
| 626 |
$(FC) $(FFLAGS) -o $(BINDIR)/$@ $(OBJECTSM) $(FITSLIBS) $(PIELDFLAGS) |
| 627 |
@echo; echo ' sphmoments utility successfully compiled! '; |
| 628 |
@echo; echo ' Use "make install" to copy the binaries to $(DESTDIR)$(PREFIX)/bin'; echo; |
| 629 |
|
| 630 |
|
| 631 |
checksystem: |
| 632 |
ifeq ($(KNOWN_SYSTEM), yes) |
| 633 |
ifeq ($(ENDIAN), BIG) |
| 634 |
@echo "Flags set for conversion to BIG endian" |
| 635 |
endif |
| 636 |
ifeq ($(ENDIAN), LITTLE) |
| 637 |
@echo "Flags set for conversion to LITTLE endian" |
| 638 |
endif |
| 639 |
ifeq ($(PARALLEL), yes) |
| 640 |
@echo "Compiling the PARALLEL code" |
| 641 |
else |
| 642 |
ifeq ($(OPENMP), yes) |
| 643 |
@echo "Compiling the PARALLEL code" |
| 644 |
else |
| 645 |
@echo "Compiling the SERIAL code" |
| 646 |
endif |
| 647 |
endif |
| 648 |
ifeq ($(FC),gfortran) |
| 649 |
ifeq ($(GFORTRAN_GE_4_4),true) |
| 650 |
else |
| 651 |
${error gfortran v$(GFORTRAN_VERSION) is too old to compile this version of splash: please upgrade your gfortran} |
| 652 |
endif |
| 653 |
endif |
| 654 |
else |
| 655 |
@echo "" |
| 656 |
@echo " Makefile for splash by Daniel Price " |
| 657 |
@echo " -- see INSTALL file for detailed instructions" |
| 658 |
@echo "" |
| 659 |
@echo " make: ERROR: value of SYSTEM=$(SYSTEM) not recognised..." |
| 660 |
@echo " => set the environment variable SYSTEM to one listed " |
| 661 |
@echo " in build/Makefile and try again" |
| 662 |
@echo "" |
| 663 |
@${MAKE} compilers |
| 664 |
@$(MAKE) err; |
| 665 |
endif |
| 666 |
|
| 667 |
compilers: |
| 668 |
@echo "I suggest one of the following, based on detected Fortran compilers..."; echo; |
| 669 |
@if type -p ifx > /dev/null; then echo "make SYSTEM=ifx"; fi; |
| 670 |
@if type -p ifort > /dev/null; then echo "make SYSTEM=ifort"; fi; |
| 671 |
@if type -p pathf90 > /dev/null; then echo "make SYSTEM=pathf90"; fi; |
| 672 |
@if type -p pgf90 > /dev/null; then echo "make SYSTEM=pgf90"; fi; |
| 673 |
@if type -p xlf90_r > /dev/null; then echo "make SYSTEM=ukaff1a [uses xlf90_r]"; fi; |
| 674 |
@if type -p gfortran > /dev/null; then echo "make SYSTEM=gfortran"; fi; |
| 675 |
@if type -p g95 > /dev/null; then echo "make SYSTEM=g95"; fi; |
| 676 |
@echo "(end of possible selections)"; echo; |
| 677 |
|
| 678 |
checkpgplot: |
| 679 |
ifneq ($(BACKEND),pgplot) |
| 680 |
@# Not using PGPLOT, skip check |
| 681 |
else ifeq (X${PGPLOT_DIR}, X) |
| 682 |
@echo; echo "ERROR: PGPLOT_DIR should be set before compiling splash"; echo; ${MAKE} err; |
| 683 |
else |
| 684 |
@if [ -d $$PGPLOT_DIR ]; then echo; echo "PGPLOT_DIR=$$PGPLOT_DIR"; echo; else echo; echo "ERROR: Directory given by PGPLOT_DIR=$$PGPLOT_DIR does not exist"; echo; ${MAKE} err; fi; |
| 685 |
endif |
| 686 |
ifneq ($(PGPLOT_COMP),$(FC)) |
| 687 |
@echo; echo "*** WARNING: PGPLOT appears to have been compiled with a different Fortran"; echo " compiler (${PGPLOT_COMP}) to the one you are using to compile SPLASH (${FC}),"; echo " so may need to link to the relevant compiler libraries ***"; |
| 688 |
# g77-compiled PGPLOT |
| 689 |
@if [ "${PGPLOT_COMP}" = "g77" ]; then echo " [Adding -lg2c to the link flags for g77-compiled PGPLOT]"; fi; |
| 690 |
# gfortran-compiled PGPLOT |
| 691 |
@if [ "${PGPLOT_COMP}" = "gfortran" ]; then echo " [Adding -lgfortran to the link flags for gfortran-compiled PGPLOT]"; fi; |
| 692 |
# g95-compiled PGPLOT |
| 693 |
@if [ "${PGPLOT_COMP}" = "g95" ]; then echo " [Adding -lg95 to the link flags for g95-compiled PGPLOT]"; fi; |
| 694 |
@echo |
| 695 |
# else |
| 696 |
# @echo "PGPLOT was compiled with ${PGPLOT_COMP}"; |
| 697 |
endif |
| 698 |
|
| 699 |
checkgiza: |
| 700 |
@if [ ! -e $(GIZA_DIR)/include/giza-fortran.F90 ]; then \ |
| 701 |
if [ -d ../giza/ ]; then \ |
| 702 |
echo "*********************************************************"; \ |
| 703 |
echo "* *"; \ |
| 704 |
echo "* ERROR: Cannot find system install of giza *"; \ |
| 705 |
echo "* Type \"make withgiza\" to build local copy of giza *"; \ |
| 706 |
echo "* *"; \ |
| 707 |
echo "*********************************************************"; \ |
| 708 |
else \ |
| 709 |
echo "*********************************************************"; \ |
| 710 |
echo "* *"; \ |
| 711 |
echo "* ERROR: giza is not installed. Please install it. *"; \ |
| 712 |
echo "* *"; \ |
| 713 |
echo "* e.g: *"; \ |
| 714 |
echo "* git clone https://github.com/danieljprice/giza.git *"; \ |
| 715 |
echo "* make withgiza *"; \ |
| 716 |
echo "* *"; \ |
| 717 |
echo "*********************************************************"; \ |
| 718 |
fi; \ |
| 719 |
fi; |
| 720 |
|
| 721 |
checkh5part: checkhdf5 |
| 722 |
ifeq (X${H5PART_DIR}, X) |
| 723 |
@echo; echo "ERROR: H5PART_DIR should be set before compiling splash with h5part read/write"; echo; ${MAKE} err; |
| 724 |
else |
| 725 |
@if [ -d $$H5PART_DIR ]; then echo; echo "H5PART_DIR=$$H5PART_DIR"; echo; else echo; echo "ERROR: Directory given by H5PART_DIR=$$H5PART_DIR does not exist"; echo; ${MAKE} err; fi; |
| 726 |
endif |
| 727 |
|
| 728 |
checkhdf5: |
| 729 |
ifeq (X${HDF5ROOT}, X) |
| 730 |
@echo; echo "ERROR: HDF5ROOT should be set before compiling splash with HDF5 utilities"; echo; ${MAKE} err; |
| 731 |
else |
| 732 |
@if [ -d $$HDF5ROOT ]; then echo; echo "HDF5ROOT=$$HDF5ROOT"; echo; else echo; echo "ERROR: Directory given by HDF5ROOT=$$HDF5ROOT does not exist"; echo; ${MAKE} err; fi; |
| 733 |
endif |
| 734 |
|
| 735 |
checksilo: checkhdf5 |
| 736 |
ifeq (X${SILO_DIR}, X) |
| 737 |
@echo; echo "ERROR: SILO_DIR should be set before compiling splash with SILO reader"; echo; ${MAKE} err; |
| 738 |
else |
| 739 |
@if [ -d $$SILO_DIR ]; then echo; echo "SILO_DIR=$$SILO_DIR"; echo; else echo; echo "ERROR: Directory given by SILO_DIR=$$SILO_DIR does not exist"; echo; ${MAKE} err; fi; |
| 740 |
endif |
| 741 |
|
| 742 |
checkfits: |
| 743 |
ifeq (X${FITS_DIR}, X) |
| 744 |
@echo; echo "*** WARNING: May need FITS_DIR=/usr/local to find cfitsio library **"; echo; |
| 745 |
else |
| 746 |
@if [ -d $$FITS_DIR ]; then echo; echo "FITS_DIR=$$FITS_DIR"; echo; else echo; echo "ERROR: Directory given by FITS_DIR=$$FITS_DIR does not exist"; echo; ${MAKE} err; fi; |
| 747 |
endif |
| 748 |
|
| 749 |
checkpbob: |
| 750 |
ifeq (X${PBOB_DIR}, X) |
| 751 |
@echo; echo "ERROR: PBOB_DIR should be set before compiling splash with PBOB reader"; echo; ${MAKE} err; |
| 752 |
else |
| 753 |
@if [ -d $$PBOB_DIR ]; then echo; echo "PBOB_DIR=$$PBOB_DIR"; echo; else echo; echo "ERROR: Directory given by PBOB_DIR=$$PBOB_DIR does not exist"; echo; ${MAKE} err; fi; |
| 754 |
endif |
| 755 |
|
| 756 |
# |
| 757 |
# install option, copies any binaries compiled to /usr/local/bin/ |
| 758 |
# run `make' first, then `make install'. Could in principle |
| 759 |
# have install compile it as well, but environment variables |
| 760 |
# will not be defined if "make" is run using sudo, so better |
| 761 |
# to do the two separately |
| 762 |
# |
| 763 |
install: destdircheck installcheck |
| 764 |
@cd $(BINDIR); for x in *splash*; do if [ -e $$x ]; then echo "copying $$x -> $(DESTDIR)$(PREFIX)/bin/$$x"; cp $$x $(DESTDIR)$(PREFIX)/bin/; fi; done; |
| 765 |
@cd $(BINDIR); x=denoise; if test -e $$x; then echo "copying $$x -> $(DESTDIR)$(PREFIX)/bin/$$x"; cp $$x $(DESTDIR)$(PREFIX)/bin/; fi; |
| 766 |
@cd $(BINDIR); x=sphmoments; if test -e $$x; then echo "copying $$x -> $(DESTDIR)$(PREFIX)/bin/$$x"; cp $$x $(DESTDIR)$(PREFIX)/bin/; fi; |
| 767 |
@echo; echo 'installation complete'; |
| 768 |
|
| 769 |
installcheck: |
| 770 |
@if [ -e $(BINDIR)/splash ] || [ -e $(BINDIR)/denoise ] || [ -e $(BINDIR)/sphmoments ]; then echo; \ |
| 771 |
echo 'compiled binaries install to $(DESTDIR)$(PREFIX)/bin'; \ |
| 772 |
echo '(use "sudo make install" if Permission denied)'; \ |
| 773 |
echo; else echo;\ |
| 774 |
echo 'run "make" first, followed by "make install"'; echo;\ |
| 775 |
$(MAKE) err; fi |
| 776 |
|
| 777 |
destdircheck: installcheck |
| 778 |
mkdir -p $(DESTDIR)$(PREFIX)/bin |
| 779 |
@if test -d $(DESTDIR)$(PREFIX)/bin; then echo $(DESTDIR)$(PREFIX)/bin exists and is a directory; else \ |
| 780 |
echo; echo "*** ERROR in make install ***"; echo "$(DESTDIR)$(PREFIX)/bin is not a valid directory"; echo;\ |
| 781 |
$(MAKE) err; fi; |
| 782 |
|
| 783 |
installclean: destdircheck |
| 784 |
@for x in $(DESTDIR)$(PREFIX)/bin/?splash; do rm $$x; done; |
| 785 |
|
| 786 |
distclean: installclean |
| 787 |
|
| 788 |
cleanall: clean installclean |
| 789 |
|
| 790 |
err: |
| 791 |
$(error aborting); |
| 792 |
|
| 793 |
## other stuff |
| 794 |
|
| 795 |
ifeq ($(BACKEND),pgplot) |
| 796 |
plotlib_pgplot.o: checkpgplot |
| 797 |
endif |
| 798 |
|
| 799 |
plotlib_giza.o : giza-fortran.o |
| 800 |
|
| 801 |
giza-fortran.o : /usr/include/giza-fortran.F90 |
| 802 |
$(FC) $(FFLAGS) -c $< -o $@ |
| 803 |
|
| 804 |
.PHONY: giza gizabuild libgiza |
| 805 |
|
| 806 |
giza-fortran.F90 : checkgiza |
| 807 |
# |
| 808 |
# LOCAL build of giza |
| 809 |
# |
| 810 |
withgiza: ../giza/lib/libgiza.a |
| 811 |
$(MAKE) $(MAKECMDFLAGS) GIZA_DIR="../giza" |
| 812 |
|
| 813 |
../giza/lib/libgiza.a: |
| 814 |
@echo "Compiling local copy of giza..." |
| 815 |
cd ../giza; ./configure --prefix="$(PWD)/../giza" CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="" CAIRO_LIBS="$(CAIRO_LIBS)" CAIRO_CFLAGS="$(CAIRO_CFLAGS)" X11_LIBS="$(X11_LIBS)" X11_CFLAGS="$(X11_CFLAGS) CPPFLAGS="$(CPPFLAGS)" |
| 816 |
cd ../giza; $(MAKE) $(MAKECMDFLAGS) install CC="$(CC)" CFLAGS="$(CFLAGS)" |
| 817 |
|
| 818 |
docs: doc |
| 819 |
|
| 820 |
doc: |
| 821 |
cd ../docs; make html latexpdf |
| 822 |
|
| 823 |
htmldocs: htmldoc |
| 824 |
|
| 825 |
htmldoc: doc cleanhtmldocs |
| 826 |
cd ../docs; \ |
| 827 |
make html |
| 828 |
|
| 829 |
cleanhtmldocs: |
| 830 |
cd ../docs; make clean |
| 831 |
|
| 832 |
tar: |
| 833 |
tar cf splash.tar Makefile $(SOURCES) read_data*.f90 |
| 834 |
|
| 835 |
targz: |
| 836 |
tar cf splash.tar Makefile $(SOURCES) read_data*.f90 |
| 837 |
gzip splash.tar |
| 838 |
|
| 839 |
## unit tests of various modules as I write them |
| 840 |
|
| 841 |
test1: interpolate3D_projection.o interpolate3D_xsec.o test_interpolate3D.o |
| 842 |
$(FC) $(FFLAGS) $(LDFLAGS) $(PIELDFLAGS) -o $(BINDIR)/test_interpolation3D $(TESTDIR)/test_interpolate3D.o interpolate3D_projection.o interpolate3D_xsec.o |
| 843 |
test2: transform.o $(TESTDIR)//test_transform.o |
| 844 |
$(FC) $(FFLAGS) $(LDFLAGS) $(PIELDFLAGS) -o $(BINDIR)/test_transform $(TESTDIR)/test_transform.o transform.o |
| 845 |
test3: fieldlines.o $(TESTDIR)//test_fieldlines.o |
| 846 |
$(FC) $(FFLAGS) $(LDFLAGS) $(PIELDFLAGS) -o $(BINDIR)/test_fieldlines $(TESTDIR)/test_fieldlines.o fieldlines.o |
| 847 |
test_slicer: interpolate3D_projection.o interpolate3D_xsec.o test_slicer3D.o |
| 848 |
$(FC) $(FFLAGS) $(LDFLAGS) $(PIELDFLAGS) -o $(BINDIR)/test_slicer3D $(TESTDIR)/test_slicer3D.o interpolate3D_projection.o interpolate3D_xsec.o |
| 849 |
test_prompt: prompting.o test_prompting.o |
| 850 |
$(FC) $(FFLAGS) $(LDFLAGS) $(PIELDFLAGS) -o $(BINDIR)/test_prompt prompting.o test_prompting.o |
| 851 |
test-parse: $(PLOTLIB) asciiutils.o fparser.o parsetext.o $(TESTDIR)/test-parsetext.o |
| 852 |
$(FC) $(FFLAGS) $(PIELDFLAGS) -o $(BINDIR)/test-parse giza-fortran.o plotlib_giza.o fparser.o asciiutils.o parsetext.o $(TESTDIR)/test-parsetext.o $(LDFLAGS) |
| 853 |
|
| 854 |
|
| 855 |
depends: clean |
| 856 |
@echo '*********************************************************************************' |
| 857 |
@echo 'Generating dependency lines using makedepf90, writing to .depends' |
| 858 |
@echo '*********************************************************************************' |
| 859 |
@echo " Using git to get list of tracked source files..."; \ |
| 860 |
SOURCE_FILES=$$(cd .. && git ls-files 'src/*.f90' 'src/*.F90' | sed 's|^src/||' | \ |
| 861 |
grep -v '^plotlib_pgplot\.f90$$' | grep -v '^plotlib_mock\.f90$$'); \ |
| 862 |
if [ "$(BACKEND)" = "pgplot" ]; then \ |
| 863 |
SOURCE_FILES=$$(echo $$SOURCE_FILES | sed 's|plotlib_giza\.f90||g'); \ |
| 864 |
fi; \ |
| 865 |
if ! command -v makedepf90 > /dev/null 2>&1; then \ |
| 866 |
echo " Error: makedepf90 not found in PATH"; \ |
| 867 |
echo " Please install it:"; \ |
| 868 |
echo " - Debian/Ubuntu: sudo apt-get install makedepf90"; \ |
| 869 |
echo " - Or download from: https://github.com/outpaddling/makedepf90"; \ |
| 870 |
exit 1; \ |
| 871 |
fi; \ |
| 872 |
echo " Generating dependencies with makedepf90 (from src directory)..."; \ |
| 873 |
cd ../src && makedepf90 -free $$SOURCE_FILES | sed 's/plotlib_[a-z_]*\.o/\$${PLOTLIB:.f90=.o}/g' > ../build/.depends || \ |
| 874 |
(echo " Error: makedepf90 failed to generate .depends file"; exit 1); \ |
| 875 |
if [ ! -s ../build/.depends ]; then \ |
| 876 |
echo " Error: .depends file is empty"; exit 1; \ |
| 877 |
fi; \ |
| 878 |
echo " Successfully created .depends with $$(grep -c '\.o ' ../build/.depends 2>/dev/null || echo 0) dependency entries" |
| 879 |
@echo '*************************************************************************' |
| 880 |
@echo 'Dependency file .depends created successfully' |
| 881 |
@echo ' -- run "make depends" again if you alter code dependencies' |
| 882 |
@echo '*************************************************************************' |
| 883 |
@echo 'Removing object files...' |
| 884 |
@rm -f $(SRCDIR)/*.o $(SRCDIR)/H5Part/*.o |
| 885 |
# |
| 886 |
#--code dependencies: MAY BE INCOMPLETE - I generate this automatically every so often |
| 887 |
# |
| 888 |
include .depends |
| 889 |
|
| 890 |
cleanread: |
| 891 |
rm -f read_data*.o splash.o $(BINDIR)/?splash $(BINDIR)/splash* libsplash.so libexact.so |
| 892 |
|
| 893 |
clean: |
| 894 |
rm -f *.o *.mod $(BINDIR)/?splash $(BINDIR)/splash* libsplash.so libexact.so $(BINDIR)/denoise |
| 895 |
rm -f $(SRCDIR)/*.o $(SRCDIR)/H5Part/*.o |
| 896 |
|
| 897 |
cleangiza: |
| 898 |
${MAKE} -C ../giza clean uninstall |