Makefile 3.16 KB
Newer Older
Don Morton's avatar
Don Morton committed
1
2
3
4
5
6

FC = gfortran

# Location of FLEXPART source directory
FLEXPART_SRC = ..

7

Don Morton's avatar
Don Morton committed
8
BINARY = grib2nc4
Don Morton's avatar
Don Morton committed
9
10
CMP_BINARY = nc4cmp
OBJS = processmetfields.o verttransform_grib2nc4_ecmwf.o verttransform_grib2nc4_gfs.o
11
12
FPMODOBJS_ = par_mod.o com_mod.o class_vtable_mod.o cmapf_mod.o conv_mod.o 
FLXPRTOBJS_ = detectformat.o grib2check.o shift_field_0.o gridcheck.o \
13
14
15
16
17
18
19
	     readwind.o readwind_nests.o calcpar.o calcpar_nests.o \
             shift_field.o pbl_profile.o scalev.o obukhov.o \
             richardson.o ew.o getvdep.o calcpv.o obukhov_gfs.o \
             richardson_gfs.o getvdep_nests.o calcpv_nests.o psim.o psih.o \
             qvsat.o caldate.o getrb.o raerod.o getrc.o partdep.o \
             verttransform.o verttransform_nests.o readwind_gfs.o \
             calcpar_gfs.o verttransform_gfs.o gridcheck_gfs.o
Don Morton's avatar
Don Morton committed
20
21


22
23
24
25
26
27
# VPATH = ${FLEXPART_SRC}
FPMODOBJS=$(FPMODOBJS_:%=$(FLEXPART_SRC)/%)
FLXPRTOBJS=$(FLXPRTOBJS_:%=$(FLEXPART_SRC)/%)
INCPATH = -I$(PREFIX)/include
LIBPATH = -L$(PREFIX)/lib
FFLAGS = -O2 -mcmodel=medium $(INCPATH) -I$(FLEXPART_SRC)
Don Morton's avatar
Don Morton committed
28

29
30
31

### NetCDF link flags - use the first one for dynamic libs, the second
### one for static libs
32
### LDFLAGS_NETCDF = -L${NETCDFF}/lib -lnetcdff -L${NETCDF}/lib -lnetcdf 
Don Morton's avatar
Don Morton committed
33
#LDFLAGS_NETCDF=-static -L${NETCDFF}/lib -lnetcdff -L${NETCDF}/lib -lnetcdf -lnetcdf -L${HDF5}/lib -lhdf5_fortran -lhdf5_hl -lhdf5hl_fortran -lhdf5 -ldl -lz
34
35
### LDFLAGS = -L${GRIBAPI}/lib -lgrib_api_f90 -lgrib_api ${LDFLAGS_NETCDF} -ljasper -L${FLEXPART_SRC}
LDFLAGS = $(FFLAGS) $(LIBPATH) $(LIBPATH1) -lgrib_api_f90 -lgrib_api -ljasper -lnetcdff -lnetcdf -lnetcdf -lhdf5_hl -lhdf5 -ldl -lm -lcurl
Don Morton's avatar
Don Morton committed
36
37
38
39
40
41
42
43
44
45


#------------ Creating the binary ------------------

${BINARY} : ${BINARY}.o fp2nc4io_mod.o ${FLXPRTOBJS} ${FPMODOBJS} ${OBJS}
	${FC} -o ${BINARY} ${BINARY}.o fp2nc4io_mod.o ${FLXPRTOBJS} ${FPMODOBJS} ${OBJS} ${LDFLAGS}

${BINARY}.o : ${BINARY}.F90 fp2nc4io_mod.mod ${FPMODOBJS} Makefile
	${FC} -c ${BINARY}.F90 ${FFLAGS} ${INCLUDES}

Don Morton's avatar
Don Morton committed
46
47
48
49
50
51
52
#-----------  NC4 compare ------------------------
${CMP_BINARY} : ${CMP_BINARY}.o
	${FC} -o ${CMP_BINARY} ${CMP_BINARY}.o ${LDFLAGS}

${CMP_BINARY}.o : ${CMP_BINARY}.F90 Makefile
	${FC} -c ${CMP_BINARY}.F90 ${FFLAGS} ${INCLUDES}

Don Morton's avatar
Don Morton committed
53
54
55
56
57
58
fp2nc4io_mod.mod : ${FPMODOBJS} 
	${FC} -c fp2nc4io_mod.F90 ${FFLAGS} ${INCLUDES}

#-----------  Entries for testing ----------------
test : clean_test test/${BINARY}_test
	mv ${BINARY}_test test/
59
	(cd test; export LD_LIBRARY_PATH=${NETCDFF}/lib:${NETCDF}/lib:${GRIBAPI}/lib:${LD_LIBRARY_PATH}; ./${BINARY}_test EL14091912 testout.nc4 w q)
Don Morton's avatar
Don Morton committed
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83

test/${BINARY}_test : ${BINARY}_test.o fp2nc4io_mod.o ${FLXPRTOBJS} ${FPMODOBJS} ${OBJS} 
	${FC} -o ${BINARY}_test ${BINARY}_test.o fp2nc4io_mod.o ${FLXPRTOBJS} ${FPMODOBJS} ${OBJS} ${LDFLAGS}


${BINARY}_test.o : ${BINARY}.F90 fp2nc4io_mod_test ${FPMODOBJS} Makefile
	${FC} -c ${BINARY}.F90 -o ${BINARY}_test.o ${FFLAGS} ${INCLUDES} -DTESTING

fp2nc4io_mod_test : ${FPMODOBJS}
	${FC} -c fp2nc4io_mod.F90 ${FFLAGS} ${INCLUDES} -DTESTING 

#---------------------------------------------------
clean :
	rm -f *.o *.mod

clean_test : clean
	rm -f test/${BINARY}_test

#---------------------------------------------------
%.o: %.f90
	${FC} -c ${FFLAGS} ${INCLUDES} $<

%.o: %.F90
	${FC} -c ${FFLAGS} ${INCLUDES} $<