forked from danieljprice/phantom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile_fastmath
53 lines (48 loc) · 1.68 KB
/
Makefile_fastmath
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
#----------------------------------------------------
# this is a utility to test the fast sqrt functions
# to see if they are faster than the native calls
# if so, then the appropriate pre-processor flags
# are added
#
.PHONY: .make_mathflags .make_nofastmath getmathflags checkmath
ifndef FASTSQRT
FASTSQRT=${shell if [ -e .make_nofastmath ]; then echo no; fi}
endif
ifeq ($(FASTSQRT), no)
OBJTESTMATH=
FASTMATH=no
else
OBJTESTMATH= random.o io.o fastmath.o mpi_utils.o test_fastmath.o getmathflags.o
FASTMATH=${shell if [ -e .make_mathflags ]; then cat .make_mathflags; fi}
endif
.make_mathflags: checksys $(OBJTESTMATH)
ifeq ($(FASTSQRT), no)
@touch .make_mathflags
else
@if [ ! -e $@ ]; then \
$(FC) $(FFLAGS) -o $(BINDIR)/getmathflags $(OBJTESTMATH) || ${MAKE} fastmathlinkerr; \
$(BINDIR)/getmathflags > .make_mathflags; \
fi
endif
ifeq ($(FASTMATH), yes)
SRCFASTMATH=fastmath.o
TEST_FASTMATH=test_fastmath.f90
FPPFLAGS+=-DFINVSQRT
else
SRCFASTMATH=
TEST_FASTMATH=
endif
fastmath.o: fastmath.f90
$(FC) $(FFLAGS) -o $@ -c $< || ${MAKE} fastmathlinkerr
test_fastmath.o: test_fastmath.f90
$(FC) $(FFLAGS) -o $@ -c $< || ${MAKE} fastmathlinkerr
getmathflags.o: getmathflags.f90
$(FC) $(FFLAGS) -o $@ -c $< || ${MAKE} fastmathlinkerr
fastmathlinkerr:
@echo "***********************************************************************"
@echo "*** ERROR linking fastsqrt stuff (requires Fortran->C call) ***"
@echo "*** Type make again to ignore this and compile without it ***"
@echo "***********************************************************************"
@touch .make_mathflags
@touch .make_nofastmath
${MAKE} err;