Makefile for read and then write

# Start of the Makefile
# Defining Variables
# Syntax
# Target: Dependencies
# Command
#——————– specify netcdf library path ———————
#——————– for IITM Aaditya HPC —————————-
NETCDFINC = -I/gpfs1/home/Libs/INTEL/NETCDF4/netcdf-4.2.1/include
NETCDFLIB = -L/gpfs1/home/Libs/INTEL/NETCDF4/netcdf-4.2.1/lib


LDFLAGS= $(NETCDFINC) $(NETCDFLIB) -lnetcdf -lnetcdff -g -traceback

FFLAGS=-O3 -fp-model precise -vec-report -g -traceback -mcmodel=large -heap-arrays

OBJS=interp_eqhgt.o readfromnc.o check.o write2nc.o

# Makefile

$(FC) $(OBJS) $(LDFLAGS) -traceback -o exec

interp_eqhgt.o: interp_eqhgt.f90 readfromnc.o write2nc.o
$(FC) -c $(NETCDFINC) interp_eqhgt.f90
readfromnc.o: readfromnc.f90 check.o
$(FC) -c $(NETCDFINC) readfromnc.f90
write2nc.o: write2nc.f90
$(FC) -c $(NETCDFINC) write2nc.f90
check.o: check.f90
$(FC) -c $(NETCDFINC) check.f90
# —– This clean is executed only when you do “make clean” ———–
# —– If you do “make” then everything else above this “clean” ——-
# —– is executed —————————————————-

clean :
rm -rf $(OBJS)
rm -rf exec

# End of Makefile

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s