Skip to content

Instantly share code, notes, and snippets.

@TakashiUNUMA
Created June 6, 2014 07:36
Show Gist options
  • Save TakashiUNUMA/7e9c63188a01b87175bd to your computer and use it in GitHub Desktop.
Save TakashiUNUMA/7e9c63188a01b87175bd to your computer and use it in GitHub Desktop.
Makefile for compiling with NetCDF library.
#SHELL = /bin/sh
#-----------------------------------------------------------------------------
# NETCDF SECTION
#-----------------------------------------------------------------------------
# - netcdf3
OUTPUTINC = -I/usr/local/netcdf-3.6.3-gnu/include
OUTPUTLIB = -L/usr/local/netcdf-3.6.3-gnu/lib
LINKOPTS = -lnetcdf
# - netcdf4
#OUTPUTINC = -I/usr/include
#OUTPUTLIB = -L/usr/lib
#NETCDF = /usr/local/netcdf-4.1.3-intel
#HDF5 = /usr/local/hdf5-1.8.7-intel
#ZLIB = /usr/local/zlib-1.2.5-intel
#OUTPUTINC = -I$(NETCDF)/include -I$(HDF5)/include -I$(ZLIB)/include
#OUTPUTLIB = -L$(NETCDF)/lib -L$(HDF5)/lib -L$(ZLIB)/lib
#LINKOPTS = -lnetcdf -lnetcdff -lhdf5_hl -lhdf5 -lz -lm -lcurl
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# HARDWARE SECTION
#-----------------------------------------------------------------------------
# single processor, Intel compiler
#FC = ifort
#OPTS = -O3 -xHost -ip -assume byterecl -ftz
#-----------------------------------------------------------------------------
# single processor, Portland Group compiler
#FC = pgf90
#OPTS = -Mfree -fast -Ktrap=none
#-----------------------------------------------------------------------------
# single processor, gfortran compiler
#FC = gfortran
#OPTS = -ffree-form -ffree-line-length-none -O2
#-----------------------------------------------------------------------------
# single processor, g95 compiler
FC = g95
OPTS = -ffree-form -ffree-line-length-huge -O2
#-----------------------------------------------------------------------------
#-- You shouldn't need to change anything below here
#-----------------------------------------------------------------------------
FFLAGS = $(OPTS)
.SUFFIXES:
.SUFFIXES: .f90 .o
all: sample
sample:
$(FC) ncedit.f90 $(FFLAGS) $(OUTPUTINC) $(OUTPUTLIB) $(LINKOPTS) -o $@
clean:
rm -f *.f90 *.o *.a *.mod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment