forked from Pike1z/SETSM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·93 lines (75 loc) · 2.86 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
# This Makefile requires a compiler-specific Makefile.include.
# Select the appropriate include file from the Makefile_includes
# directory, copy to this directory, and rename as Makefile.include.
# If libtiff is installed in a nonstandard location you must edit
# TIFFPATH and uncomment the following three lines.
TIFFPATH=/projects/sciteam/bazu/setsm/lib/tiff-4.0.3-cray
TIFFINC=-I$(TIFFPATH)/include
TIFFLIB=-L$(TIFFPATH)/lib
# If libgeotiff is installed in a nonstandard location you must edit
# # GEOTIFFPATH and uncomment the following three lines.
GEOTIFFPATH=/projects/sciteam/bazu/setsm/lib/geotiff
GEOTIFFINC=-I$(GEOTIFFPATH)/include
GEOTIFFLIB=-L$(GEOTIFFPATH)/lib
PROJLIB=-L/projects/sciteam/bazu/setsm/lib/proj/lib
MPIFLAGS = -DBUILDMPI
INCS = $(TIFFINC) $(GEOTIFFINC)
LDFLAGS = $(TIFFLIB) $(GEOTIFFLIB) $(PROJLIB)
COMMON_OBJS = CoordConversion.o SubFunctions.o LSF.o Orthogeneration.o Coregistration.o SDM.o setsmgeo.o grid.o grid_triangulation.o edge_list.o
MPI_OBJS = $(COMMON_OBJS) log_mpi.o
OBJS = $(COMMON_OBJS) log.o
HDRS = Typedefine.hpp CoordConversion.hpp SubFunctions.hpp Template.hpp LSF.hpp Orthogeneration.hpp Coregistration.hpp SDM.hpp setsm_code.hpp setsmgeo.hpp grid_triangulation.hpp grid_types.hpp grid_iterators.hpp basic_topology_types.hpp git_description.h mpi_helpers.hpp log.hpp
ifeq ($(COMPILER), intel)
CC=icc
CXX=icpc
MPICC=mpicc
MPICXX=mpicxx
CFLAGS=-std=c99 -O3 -qopenmp -fp-model precise
CXXFLAGS=-std=c++11 -O3 -qopenmp -fp-model precise -g
else ifeq ($(COMPILER), pgi)
CC=pgcc
CXX=pgc++
MPICC=mpicc
MPICXX=mpicxx
CFLAGS=-c99 -O3 -mp=allcores -fast
CXXFLAGS=-std=c++11 -O3 -mp=allcores -fast
else ifeq ($(COMPILER), cray)
CC=cc
CXX=CC
MPICC=cc
MPICXX=CC
CFLAGS=
CXXFLAGS=-hstd=c++11 -h aggress
else
CC=gcc
CXX=g++
MPICC=mpicc
MPICXX=mpicxx
CFLAGS=-std=c99 -g -O3 -fopenmp
CXXFLAGS=-std=c++11 -O3 -fopenmp
endif
$(shell ./update_git_description.sh)
GIT_DESCRIPTION:=$(shell cat git_description)
export GIT_DESCRIPTION
setsm : setsm_code.o $(OBJS)
$(CXX) $(CXXFLAGS) -o setsm setsm_code.o $(OBJS) $(LDFLAGS) -lm -lgeotiff -ltiff -lz -ljpeg -lproj
setsm_mpi : setsm_code_mpi.o $(MPI_OBJS)
$(MPICXX) $(CXXFLAGS) $(MPIFLAGS) -o setsm_mpi setsm_code_mpi.o $(MPI_OBJS) $(LDFLAGS) -lm -lgeotiff -ltiff
setsm_code.o : setsm_code.cpp $(HDRS)
$(CXX) -c $(CXXFLAGS) $(INCS) setsm_code.cpp -o setsm_code.o
setsm_code_mpi.o : setsm_code.cpp $(HDRS)
$(MPICXX) -c $(CXXFLAGS) $(MPIFLAGS) $(INCS) setsm_code.cpp -o setsm_code_mpi.o
$(OBJS) : $(HDRS)
$(MPI_OBJS) : $(HDRS)
%.o : %.c
$(CC) -c $(CFLAGS) $(INCS) $< -o $@
%.o : %.cpp
$(CXX) -c $(CXXFLAGS) $(INCS) $< -o $@
%_mpi.o : %.cpp
$(MPICXX) -c $(CXXFLAGS) $(MPIFLAGS) $(INCS) $< -o $@
.PHONY: clean
clean :
rm -f setsm setsm_mpi
rm -f *.o git_description git_description.h
git_description.h: git_description
echo "#define GIT_DESCRIPTION \"$(GIT_DESCRIPTION)\"" > $@