Makefile 3.39 KB
Newer Older
1 2 3
ifeq ($(MACH), Linux)
	include Linux_g++_make.inc
	ifeq ($(BLAS), 1)
4
# ===== OpenBLAS ========
5
		BLASYES = -DCBLAS
6
		BLASDIR = /opt/OpenBLAS
7
		BLASINC = -I$(BLASDIR)/include
8
		BLASLIB = -L$(BLASDIR)/lib
9
		BLASLIBN = $(BLASLIB) -lopenblas
10 11 12 13 14 15 16
	endif
else 
	include Darwin_g++_omp_make.inc
# ===== nNative BLAS (Darwin)
	BLASYES = -DCBLAS -flax-vector-conversions 
	BLASLIBN = -framework Accelerate
endif
17

18

19

20
# ===== Libsharp =====
21 22 23
#SHARPDIR = <yourdir>/libsharp-code/auto/

SHARPDIR = /Users/campagne/Travail/kits/libsharp-code/auto
24
SHARPLIB = $(SHARPDIR)/lib
25 26
SHARPINC = -I$(SHARPDIR)/include
SHARPLIBN = -L$(SHARPLIB) -lsharp -lc_utils -lfftpack 
27

28 29 30 31 32
SRC = ./src/
LIB = ./lib/
OBJ = ./objs/
EXE = ./bin/
DATA = ./data/
33 34 35

#  Define our target list
.PHONY: default
36
default: makedir lib lagsht_testsuite
37 38

.PHONY: all 
39
all : makedir lib lagsht_testsuite
40 41 42

.PHONY: check
check : makedir lagsht_testsuite
43 44 45
	$(EXE)lagsht_testsuite -t 1 -n 1024
	@paste lagWeights-1024-Func.txt $(DATA)lagWeights-1024-Func.txt.TEST | awk '{x=($$1-$$2)/$$2;y=(x<0?-x:x);if(max==""){max=y};if(y>max){max=y};sum+=(x<0?-x:x)} END {print "Weight Test: Max Err. ",max,"Abs. Relativ. Err =",sum/NR}'
	@paste lagNodes-1024-Func.txt $(DATA)lagNodes-1024-Func.txt.TEST | awk '{x=($$1-$$2)/$$2;y=(x<0?-x:x);if(max==""){max=y};if(y>max){max=y};sum+=(x<0?-x:x)} END {print "Nodes Test: Max Err. ",max,"Abs. Relativ. Err =",sum/NR}'
46 47 48 49 50


.PHONY: makedir
makedir :
	mkdir -p $(OBJ)
51 52
	mkdir -p $(EXE)
	mkdir -p $(LIB)
53 54 55 56 57 58 59

.PHONY: tidy
tidy : 
	rm *~

.PHONY: clean
clean :
60
	rm -f $(OBJ)/*
61 62
	rm -f $(EXE)/*
	rm -f $(LIB)/*
63 64 65 66

#C++ common Objects
CXXOBJ = $(OBJ)laguerreBuilder.o \
	$(OBJ)laguerreTransform.o \
67
	$(OBJ)lagsht_spheregeom.o \
68 69 70
	$(OBJ)lagSphericTransform.o \
	$(OBJ)walltimer.o

71 72
CXXSHOBJ = laguerreBuilder.o \
	laguerreTransform.o \
73
	lagsht_spheregeom.o \
74 75 76
	lagSphericTransform.o \
	walltimer.o

77 78

#C++ common Headers
79 80 81 82 83 84 85 86 87 88
CXXHDR = $(SRC)lagsht_exceptions.h \
	 $(SRC)lagsht_numbers.h \
	 $(SRC)lagsht_utils.h \
	 $(SRC)lagsht_geom.h \
	 $(SRC)lagsht_spheregeom.h \
	 $(SRC)lagsht_healpixhelper.h \
	 $(SRC)laguerreBuilder.h \
	 $(SRC)laguerreTransform.h \
	 $(SRC)lagSphericTransform.h \
	 $(SRC)walltimer.h
89 90 91



92 93
CPPFLAGS  += $(BLASYES) $(SHARPINC) $(BLASINC)
LDFLAGS   += $(SHARPLIBN) $(BLASLIBN)  -lm
94 95 96 97



#C++ rule for compiling
98
$(OBJ)%.o: $(SRC)%.cc $(CXXHDR)
99 100
	echo "compile... $<",
	$(CXXCOMPILE) $< -o $@
101

102 103 104 105 106
######################
.PHONY: sharelib
sharelib : $(CXXOBJ)
	echo $(CXXSHOBJ) ; \
	cd $(OBJ); \
107
	$(CMDSHLCXX) -o $(LIB)liblagsht.$(SLEXT) $(CXXSHOBJ) $(LDFLAGS)
108
.PHONY: lib
109
lib : $(LIB)liblagsht.a
110

111
$(LIB)liblagsht.a : $(CXXOBJ)
112 113
	$(AR) $(ARFLAGS) $@ $?

114 115 116 117 118 119 120 121 122
######################
.PHONY:  lagsht_testsuite
lagsht_testsuite: $(EXE)lagsht_testsuite
	echo '---- lagsht_testsuite made'

$(EXE)lagsht_testsuite : $(OBJ)lagsht_testsuite.o $(CXXOBJ)
	echo "Link..."
	$(CXXLINK) -o $@ $(OBJ)lagsht_testsuite.o  $(CXXOBJ) $(LDFLAGS)

123
$(OBJ)lagsht_testsuite.o: $(SRC)lagsht_testsuite.cc $(CXXHDR)
124 125
	echo "compile... $<"
	$(CXXCOMPILE) $< -o $@
126

127 128 129
######################
.PHONY: fullcheck
fullcheck :
130 131 132 133 134 135 136 137 138
	$(EXE)lagsht_testsuite -t 0
	$(EXE)lagsht_testsuite -t 1 -n 1024
	$(EXE)lagsht_testsuite -t 2 -n 128	
	$(EXE)lagsht_testsuite -t 3 -l 512 -g ECP	
	$(EXE)lagsht_testsuite -t 3 -l 512 -g Gauss	
	$(EXE)lagsht_testsuite -t 3 -l 512 -g Healpix
	$(EXE)lagsht_testsuite -t 4 -l 1024 -n 128 -nphi 2048 -g ECP
	$(EXE)lagsht_testsuite -t 4 -l 1024 -n 128 -nphi 2048 -g Gauss	
	$(EXE)lagsht_testsuite -t 4 -l 1024 -n 128 -ntheta 512 -g Healpix
139 140 141 142 143