Merge pull request #22 from wirc-sjsu/develop-w21
[WRF-SFIRE.git] / external / io_int / makefile
blob3033670e3210238ab5526c8cee0bd5e5429c390e
1 #makefile to build io_int that does binary i/o
3 OBJS = io_int.o io_int_idx.o module_io_int_idx.o module_io_int_read.o
4 LIB = libwrfio_int.a
5 WRF_MOD = ../../frame/pack_utils.o \
6 ../../frame/module_internal_header_util.o \
7 ../../frame/module_driver_constants.o \
8 ../../frame/module_machine.o \
9 ../../frame/module_wrf_error.o \
10 ../../frame/wrf_debug.o
12 CPP1 = $(CPP) $(TRADFLAG) $(ARCHFLAGS)
13 M4 = m4 -Uinclude -Uindex -Ulen
15 .SUFFIXES: .F90 .F .f .f90 .c .h .o .code
17 all : $(LIB) diffwrf test_io_idx
19 $(LIB): $(OBJS)
20 $(RM) $(LIB)
21 $(AR) $(ARFLAGS) $(LIB) $(OBJS)
22 $(RANLIB) $(LIB)
24 io_int.f: io_int.F90 module_internal_header_util.o
25 $(CPP1) -I../../inc -I../ioapi_share $*.F90 | $(M4) - > $@
26 @if echo $(ARCHFLAGS) | $(FGREP) 'DVAR4D'; then \
27 echo COMPILING $*.F90 for 4DVAR ; \
28 $(WRF_SRC_ROOT_DIR)/var/build/da_name_space.pl $@ > io_int.tmp; \
29 mv io_int.tmp $@ ; \
32 io_int.o: io_int.f ../../inc/intio_tags.h
33 $(FC) $(FCFLAGS) -I../../inc -I../ioapi_share -o $@ -c $*.f
35 io_int_idx_tags.h: ../../inc/intio_tags.h
36 awk '{print "#define", toupper($$4), $$6}' < ../../inc/intio_tags.h > $@
38 io_int_idx.o: io_int_idx.c io_int_idx.h io_int_idx_tags.h
39 $(CC) -o $@ -c $(CFLAGS_LOCAL) $*.c
41 module_io_int_idx.o: module_io_int_idx.f
42 $(FC) $(FCFLAGS) -o $@ -c $*.f
44 module_io_int_idx.f: module_io_int_idx.F90
45 $(CPP1) $*.F90 > $@
47 module_io_int_read.o: module_io_int_read.f module_io_int_idx.o
48 $(FC) $(FCFLAGS) -I../../frame -o $@ -c $*.f
50 module_io_int_read.f: module_io_int_read.F90
51 $(CPP1) $(ARCHFLAGS) $*.F90 > $@
53 # this is just so we can get the .mod file, it will be recompiled in
54 # frame again as part of WRF frmwk
55 module_internal_header_util.f: ../../frame/module_internal_header_util.F
56 -$(RM) $@
57 cp ../../frame/module_internal_header_util.F mod_int_hdr_util.b
58 $(CPP1) -I../../inc -I../ioapi_share mod_int_hdr_util.b > $@
59 $(RM) mod_int_hdr_util.b
61 module_internal_header_util.o: module_internal_header_util.f
62 $(FC) $(FCFLAGS) -o $@ -c $*.f
64 diffwrf.f: diffwrf.F90 io_int.o
65 if [ `echo "$(FC)" | awk '{print $$1}'` = "gfortran" ] ; then \
66 echo removing external declaration of iargc for gfortran ; \
67 $(CPP1) -I../ioapi_share $*.F90 | \
68 sed '/integer *, *external.*iargc/d' > $@ ; \
69 else \
70 $(CPP1) -I../ioapi_share $*.F90 > $@ ; \
71 fi ; \
72 $(FC) -c $(FCFLAGS) -I../ioapi_share $@ ; \
75 diffwrf: diffwrf.f $(WRF_MOD) $(ESMF_MOD_DEPENDENCE) $(LIB)
76 if [ -f ../../frame/pack_utils.o -a -f ../../frame/clog.o ] ; then \
77 $(FC) $(FCFLAGS) $(LDFLAGS) -I../ioapi_share -o diffwrf $@.f \
78 $(WRF_MOD) $(ESMF_IO_LIB_EXT) $(LIB) ; \
81 $(WRF_MOD) $(ESMF_MOD_DEPENDENCE):
82 @echo "Diffwrf io_int will be built later on in this compile. No need to rerun compile. "
84 test_io_idx: test_io_idx.f $(LIB)
85 $(FC) $(FCFLAGS) $(LDFLAGS) -o $@ $@.f -L. -lwrfio_int
87 test_io_idx.f: test_io_idx.F90
88 $(CPP1) $*.F90 > $@
90 test_io_mpi: test_io_mpi.f90 $(LIB)
91 $(FC) $(FCFLAGS) $(LDFLAGS) -o $@ $@.f90 -L. -lwrfio_int
93 superclean:
94 @$(RM) *.f *.o *.obj *.i *.mod $(LIB) diffwrf io_int_idx_tags.h \
95 test_io_idx test_io_mpi io_int_idx_tags.h