Created
February 10, 2013 16:38
-
-
Save guziy/4750147 to your computer and use it in GitHub Desktop.
Makefile for offline routing project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SUITE = gcc | |
#librmn = $(ARMNLIB)/lib/Linux/librmn.a | |
#@echo "using suite $(SUITE) for build" | |
ifeq ($(SUITE), pgi) | |
boost_root = /rech/huziy/Programs/boost | |
#@echo "using suite $(SUITE) for build" | |
NETCDF = $(HOME)/rech_progs_40Gb/Programs/netcdf | |
CXX_FLAGS = -O0 -g -c -I$(NETCDF)/include -I/software/libraries/boost-1.47/include | |
endif | |
ifeq ($(SUITE),gcc) | |
#module load NETCDF/4.1.3-gcc | |
NETCDF = /sb/software/CentOS-5/libraries/netcdf/4.1.3-gcc | |
endif | |
ifeq ($(SUITE), pgi) | |
CXX = pgCC | |
FC = pgf90 | |
FORTRAN_FLAGS = -i8 -r8 -byteswapio -c -Mpreprocess -g -Mbounds | |
#for boost | |
boost_include = -I$(boost_root)/include -L$(boost_root)/lib | |
LIBS = $(CLIMLIB)/lib/losub.a -lm $(NETCDF)/lib/libnetcdf_c++.a $(NETCDF)/lib/libnetcdf.a -lcurl -lhdf5_hl -lhdf5 -pgf90libs -lboost_date_time | |
endif | |
ifeq ($(SUITE), gcc) | |
CXX = /software/CentOS-5/compilers/gcc-4.7.2/bin/g++ | |
FC = /software/CentOS-5/compilers/gcc-4.7.2/bin/gfortran | |
FORTRAN_FLAGS = -i8 -c -g -fbounds-check | |
LIBS = -L/software/tools/hdf5/1.8.7-gcc/lib \ | |
-L/software/libraries/boost-1.47/lib \ | |
-L/software/CentOS-5/compilers/gcc-4.7.2/lib64 \ | |
-L/software/CentOS-5/compilers/gcc-4.7.2/lib \ | |
-L$(NETCDF)/lib -lnetcdf_c++ -lcurl -lhdf5_hl -lhdf5 | |
LINK_FLAGS = -g -v -fsignaling-nans | |
CXX_FLAGS = -O0 -g -c -I$(NETCDF)/include -I/software/libraries/boost-1.47/include -fsignaling-nans | |
endif | |
CPP_FILES := $(wildcard *.cpp) \ | |
$(wildcard boost/date_time/gregorian/*.cpp boost/date_time/posix_time/*.cpp) #boost/filesystem/*/*.cpp | |
OBJ_DIR = obj | |
OBJS = $(patsubst %.cpp, $(OBJ_DIR)/%.o, $(notdir $(CPP_FILES))) | |
FORTRANFILES = $(wildcard *.f90) | |
TARGET = meshroute.exe | |
test : | |
@echo $(CPP_FILES) | |
@echo "==================================================================" | |
@echo $(OBJS) | |
#compile .cpp and .f90 files | |
#$(OBJS): | |
#@echo Boost libs $(LIBS_BOOST) | |
# @echo NETCDF=$(NETCDF) | |
# $(CXX) $(CXX_FLAGS) $(CPP_FILES) | |
#$(FC) $(FORTRAN_FLAGS) $(FORTRANFILES) | |
#resultfile: inputfile | |
# action | |
$(TARGET): $(OBJS) | |
@echo $(OBJS) | |
$(CXX) -o $@ $^ $(LIBS) $(LINK_FLAGS) | |
obj/%.o: %.cpp | |
mkdir -p $(OBJ_DIR) | |
$(CXX) $(CXX_FLAGS) $< -o $@ | |
obj/%.o: boost/date_time/gregorian/%.cpp | |
mkdir -p $(OBJ_DIR) | |
$(CXX) $(CXX_FLAGS) $< -o $@ | |
obj/%.o: boost/date_time/posix_time/%.cpp | |
mkdir -p $(OBJ_DIR) | |
$(CXX) $(CXX_FLAGS) $< -o $@ | |
all: $(TARGET) | |
rm -f *.o | |
clean: | |
rm -f $(OBJS) $(TARGET) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment