updated top-level README and version_decl for V4.4.2 (#1795)
[WRF.git] / external / io_netcdfpar / Makefile
blob87000c2a1a9d0610c690c0e003d3bfed014e200d
1 #makefile to build a wrf_io with netCDF
3 OBJSL = wrf_io.o field_routines.o module_wrfsi_static.o
4 OBJS = $(OBJSL)
5 CODE = ext_ncdpar_get_dom_ti.code ext_ncdpar_get_var_td.code ext_ncdpar_get_var_ti.code ext_ncdpar_put_dom_ti.code ext_ncdpar_put_var_td.code ext_ncdpar_put_var_ti.code transpose.code
6 FFLAGS = $(FCFLAGS) -I$(NETCDFPARPATH)/include -I../ioapi_share
7 LIBS = $(LIB_LOCAL) -L$(NETCDFPARPATH)/lib -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lcurl
8 LIBFFS = $(LIB_LOCAL) -L$(NETCDFPARPATH)/lib -lnetcdff -lnetcdf $(NETCDF4_DEP_LIB)
9 CPP1 = $(CPP) -P $(TRADFLAG) -D_NETCDFPAR -D_NETCDF4
10 M4 = m4 -Uinclude -Uindex -Ulen
11 AR = ar
13 .SUFFIXES: .F90 .f .o .code
15 all : libwrfio_nfpar.a
17 libwrfio_nfpar.a: $(OBJS) $(CODE)
18 /bin/rm -f $@
19 if [ "$(AR)" != "lib.exe" ] ; then \
20 $(AR) cr libwrfio_nfpar.a $(OBJSL) ; \
21 else \
22 $(AR) /out:libwrfio_nfpar.a $(OBJSL) ; \
24 $(RANLIB) $@
26 wrf_io.o: wrf_io.F90 $(CODE)
27 grep nf_format_64bit $(NETCDFPARPATH)/include/netcdf.inc ;\
28 a=$$? ; export a ; \
29 if [ $$a -a "$$WRFIO_NCD_LARGE_FILE_SUPPORT" = "1" ] ; then \
30 $(CPP1) -DWRFIO_NCD_LARGE_FILE_SUPPORT -I../ioapi_share wrf_io.F90 | $(M4) - > wrf_io.f ; \
31 else \
32 $(CPP1) -I../ioapi_share wrf_io.F90 | $(M4) - > wrf_io.f ; \
34 $(FC) -o $@ $(FFLAGS) -c wrf_io.f
37 module_wrfsi_static.o: module_wrfsi_static.F90
38 $(CPP1) -I../ioapi_share module_wrfsi_static.F90 > module_wrfsi_static.f
39 $(FC) -o $@ $(FFLAGS) -c module_wrfsi_static.f
41 # gfortran treats iargc as intrinsic, so get rid of external declaration in that case
42 diffwrf: diffwrf.F90
43 x=`echo "$(FC)" | awk '{print $$1}'` ; export x ; \
44 if [ $$x = "gfortran" ] ; then \
45 echo removing external declaration of iargc for gfortran ; \
46 $(CPP1) -I$(NETCDFPARPATH)/include -I../ioapi_share diffwrf.F90 | sed '/integer *, *external.*iargc/d' > diffwrf.f ;\
47 else \
48 $(CPP1) -I$(NETCDFPARPATH)/include -I../ioapi_share diffwrf.F90 > diffwrf.f ; \
50 $(FC) -c $(FFLAGS) diffwrf.f
51 @if [ \( -f ../../frame/wrf_debug.o \) -a \( -f ../../frame/module_wrf_error.o \) -a \( -f $(ESMF_MOD_DEPENDENCE) \) -a \( -f ../../frame/clog.o \) ] ; then \
52 echo "diffwrf io_netcdfpar is being built now. " ; \
53 if [ \( -f $(NETCDFPARPATH)/lib/libnetcdff.a -o -f $(NETCDFPARPATH)/lib/libnetcdff.so \) ] ; then \
54 $(FC) $(FFLAGS) $(LDFLAGS) -o diffwrf diffwrf.o $(OBJSL) ../../frame/wrf_debug.o ../../frame/module_wrf_error.o ../../frame/clog.o $(ESMF_IO_LIB_EXT) $(LIBFFS) ;\
55 else \
56 $(FC) $(FFLAGS) $(LDFLAGS) -o diffwrf diffwrf.o $(OBJSL) ../../frame/wrf_debug.o ../../frame/module_wrf_error.o ../../frame/clog.o $(ESMF_IO_LIB_EXT) $(LIBS) ;\
57 fi ; \
58 else \
59 echo "***************************************************************************** " ; \
60 echo "*** Rerun compile to make diffwrf in external/io_netcdf directory *** " ; \
61 echo "***************************************************************************** " ; \
64 field_routines.o: field_routines.F90 wrf_io.o
65 $(CPP1) -I../ioapi_share field_routines.F90 > field_routines.f
66 $(FC) -o $@ $(FFLAGS) -c field_routines.f
68 superclean:
69 /bin/rm -f *.f *.o *.obj *.i testWRFWrite testWRFRead \
70 *.mod libwrfio_nfpar.a diffwrf