## This is an automake file, part of Unidata's netCDF package.
# Copyright 2005, see the COPYRIGHT file for more information.

## This file controls the building of the fortran convenience library.

# $Id: Makefile.am,v 1.29 2007/03/01 19:46:09 ed Exp $

AM_CPPFLAGS =

# The F77 API man page.
man_MANS = netcdf_f77.3

# This rule generates the F77 manpage.
netcdf_f77.3: $(top_srcdir)/man/netcdf.m4
	m4 $(M4FLAGS) -DAPI=FORTRAN $? >$@ || rm $@

# Does the user wants separate fortran libraries? See the comments in
# libsrc/Makefile.am about the version-info number.
if BUILD_SEPARATE_FORTRAN
lib_LTLIBRARIES = libnetcdff.la
else
noinst_LTLIBRARIES = libnetcdff.la
endif

# These are the source files for the fortran library.
libnetcdff_la_SOURCES = fort-attio.c fort-control.c fort-dim.c		\
fort-genatt.c fort-geninq.c fort-genvar.c fort-lib.c fort-misc.c	\
fort-v2compat.c fort-vario.c fort-var1io.c fort-varaio.c fort-varmio.c	\
fort-varsio.c cfortran.h fort-lib.h ncfortran.h

# Tell make to install this as a header file.
include_HEADERS = netcdf.inc

# Tell make to rebuld fortran library if nfconfig.inc has changed
# (it's generated by the configure script from nfconfig.in), or if
# netcdf.inc has changed.
libnetcdff_la_DEPENDENCIES = nfconfig.inc netcdf.inc 

# Is the user building netCDF-4?
if USE_NETCDF4

if BUILD_SEPARATE_FORTRAN
libnetcdff_la_LDFLAGS = $(AM_LDFLAGS) -version-info 5:0:0 
endif

# If the user specified a root for HDF5, use it.
if USE_HDF5_DIR

AM_CPPFLAGS += -I@HDF5DIR@/include
AM_LDFLAGS = -L@HDF5DIR@/lib
libnetcdff_la_SOURCES += fort-nc4.c
endif

# Find netCDF header file in libsrc4.
AM_CPPFLAGS += -I$(top_srcdir)/libsrc4

# Extra inc file for netcdf-4.
include_HEADERS += netcdf4.inc
libnetcdff_la_DEPENDENCIES += netcdf4.inc 

else # not USE_NETCDF4

# Find netCDF header file in libsrc.
AM_CPPFLAGS += -I$(top_srcdir)/libsrc

if BUILD_SEPARATE_FORTRAN
libnetcdff_la_LDFLAGS = $(AM_LDFLAGS) -version-info 4:0:0 
endif

endif # USE_NETCDF4

# If F90 is built, include it's convenience library.
if BUILD_F90
libnetcdff_la_LIBADD = ../f90/libnetcdff90.la
endif

# If we are building the dll (under MinGW) then set the correct flags.
if BUILD_DLL
AM_CPPFLAGS += -DNC_DLL_EXPORT
#libnetcdff_la_LDFLAGS = += -no-undefined
endif

# The nfconfig.in file is turned into nfconfig.inc by the configure
# script. The man page is generated on the developers machine for the
# dist.
EXTRA_DIST = nfconfig.in $(man_MANS)

# These files need to be cleaned up my make.
CLEANFILES = nfconfig1.inc
DISTCLEANFILES = nfconfig.inc

test: check


syntax highlighted by Code2HTML, v. 0.9.1