Makefile.am 3.84 KB
Newer Older
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1
2
## Process this file with automake to produce Makefile.in
#
3
4
SWIG_FILE = $(abs_top_srcdir)/interfaces/cdi.i
BINDINGS  =
5
6
CLEANFILES =
BINDING_TESTS =
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

INTERFACES_FILES = \
	$(abs_top_srcdir)/interfaces/ruby/test.rb \
	$(abs_top_srcdir)/interfaces/ruby/setup.rb \
	$(abs_top_srcdir)/interfaces/python/test.py \
	$(abs_top_srcdir)/interfaces/python/setup.py \
	$(abs_top_srcdir)/interfaces/python/table.py \
	$(abs_top_srcdir)/interfaces/python/Cdi.py \
	$(abs_top_srcdir)/interfaces/CdiInfo.cpp \
	$(abs_top_srcdir)/interfaces/f2003/bindGen.rb

EXTRA_DIST = $(SWIG_FILE) $(INTERFACES_FILES)

MODULE_NAME         = Cdi
RUBY_WRAPPER_FILE   = $(abs_top_builddir)/interfaces/ruby/cdi_wrapper.cpp
RUBY_SHARED_LIB     = $(abs_top_builddir)/interfaces/ruby/$(MODULE_NAME).so
RUBY_MAKEFILE       = $(abs_top_builddir)/interfaces/ruby/Makefile
PYTHON_WRAPPER_FILE = $(abs_top_builddir)/interfaces/python/cdi_wrapper.cpp
PYTHON_SHARED_LIB   = $(abs_top_builddir)/interfaces/python/$(MODULE_NAME).so
PYTHON_MAKEFILE     = $(abs_top_builddir)/interfaces/python/Makefile
27

28
29
CLEANFILES += $(RUBY_WRAPPER_FILE) $(RUBY_MAKEFILE) $(RUBY_SHARED_LIB) $(PYTHON_MAKEFILE) $(PYTHON_SHARED_LIB) $(PYTHON_WRAPPER_FILE)

Uwe Schulzweida's avatar
Uwe Schulzweida committed
30
31
bin_PROGRAMS =
noinst_PROGRAMS = 
32
noinst_LTLIBRARIES = 
33
if CREATE_INTERFACES
Uwe Schulzweida's avatar
Uwe Schulzweida committed
34
noinst_PROGRAMS += CdiInfo
35
noinst_LTLIBRARIES += libcdipp.la
Uwe Schulzweida's avatar
Uwe Schulzweida committed
36
37
endif
#
38
locallibs = $(abs_top_builddir)/src/.libs/libcdi.so @LTLIBOBJS@ @NETCDF_LIBS@ @SZLIB_LIBS@
39
40

libcdipp_la_SOURCES = cdi.cpp cdi.hpp
Ralf Mueller's avatar
Ralf Mueller committed
41
libcdipp_la_LIBADD  = $(top_builddir)/src/libcdi.la
Uwe Schulzweida's avatar
Uwe Schulzweida committed
42
libcdipp_la_LDFLAGS = @NETCDF_LIBS@ @SZLIB_LIBS@ $(LDFLAGS)
43

44
CdiInfo_SOURCES     = CdiInfo.cpp mulval.grb mulval.nc
Ralf Mueller's avatar
Ralf Mueller committed
45
CdiInfo_LDADD       = libcdipp.la
Uwe Schulzweida's avatar
Uwe Schulzweida committed
46
CdiInfo_LDFLAGS     = @NETCDF_LIBS@ @SZLIB_LIBS@ $(LDFLAGS)
47
48
49

mulval.nc: $(abs_top_srcdir)/interfaces/mulval.nc.gz
	gunzip -c $< > $@
50
#
Uwe Schulzweida's avatar
Uwe Schulzweida committed
51
#
52
if ENABLE_RUBY
53
BINDINGS += ruby-binding
54
BINDING_TESTS += ruby-test
Uwe Schulzweida's avatar
Uwe Schulzweida committed
55
# Ruby ====================================================
56
57
58
$(RUBY_WRAPPER_FILE): $(SWIG_FILE)
	mkdir -p $(dir $@)
	$(SWIG) -ruby -c++ -globalmodule -debug-classes -o $@ $(AM_CPPFLAGS) $<
Uwe Schulzweida's avatar
Uwe Schulzweida committed
59

60
61
$(RUBY_MAKEFILE): $(abs_top_srcdir)/interfaces/ruby/setup.rb
	mkdir -p $(dir $@)
62
	cd ruby && CFLAGS="$(CFLAGS)" LIBS="$(LIBS)" LDFLAGS="$(LDFLAGS)" INCFLAGS="-I$(abs_top_srcdir)/src -I$(abs_top_srcdir)/interfaces" ruby $<
Uwe Schulzweida's avatar
Uwe Schulzweida committed
63

64
65
$(RUBY_SHARED_LIB): $(RUBY_WRAPPER_FILE) $(RUBY_MAKEFILE)
	cd ruby && make
Uwe Schulzweida's avatar
Uwe Schulzweida committed
66

67
ruby-binding: $(RUBY_SHARED_LIB)
Uwe Schulzweida's avatar
Uwe Schulzweida committed
68

69
ruby-test: $(RUBY_SHARED_LIB) mulval.nc
70
	cd ruby && ruby $(abs_top_srcdir)/interfaces/ruby/test.rb
Uwe Schulzweida's avatar
Uwe Schulzweida committed
71

72
73
install-ruby: $(RUBY_SHARED_LIB)
	cd ruby && make install
Uwe Schulzweida's avatar
Uwe Schulzweida committed
74
75
endif
# =========================================================
76
if ENABLE_PYTHON
77
BINDINGS += python-binding
78
BINDING_TESTS += python-test
Uwe Schulzweida's avatar
Uwe Schulzweida committed
79
# Python ==================================================
80
81
82
$(PYTHON_WRAPPER_FILE): $(SWIG_FILE)
	mkdir -p $(dir $@)
	$(SWIG) -python -c++ -debug-classes -o $(PYTHON_WRAPPER_FILE) $(AM_CPPFLAGS) $<
Uwe Schulzweida's avatar
Uwe Schulzweida committed
83

84
85
$(PYTHON_SHARED_LIB): $(PYTHON_WRAPPER_FILE) $(abs_top_srcdir)/interfaces/python/setup.py
	mkdir -p $(dir $@)
86
	cd python; CC="$(CC)" CXX="$(CXX)" BUILDLIBDIR="$(top_builddir)/src/.libs" LIBDIR=$(libdir) CFLAGS="$(CFLAGS)" LIBS="$(LIBS)" LDFLAGS="-L../../src/.libs $(LDFLAGS)" INCFLAGS="-I$(abs_top_srcdir)/src -I$(abs_top_srcdir)/interfaces" python $(abs_top_srcdir)/interfaces/python/setup.py build_ext --inplace -R "$(abs_top_builddir)/src/.libs"
Uwe Schulzweida's avatar
Uwe Schulzweida committed
87

88
python-binding: $(PYTHON_SHARED_LIB)
Uwe Schulzweida's avatar
Uwe Schulzweida committed
89

90
python-test: $(abs_top_srcdir)/interfaces/python/test.py mulval.nc
91
	@cd python; python $<
Uwe Schulzweida's avatar
Uwe Schulzweida committed
92

93
install-python: $(PYTHON_SHARED_LIB) mulval.nc
94
	cd python; CC="$(CC)" CXX="$(CXX)" BUILDLIBDIR="$(top_builddir)/src/.libs" LIBDIR=$(libdir) CFLAGS="$(CFLAGS)" LIBS="$(LIBS)" LDFLAGS="-L../../src/.libs $(LDFLAGS)" INCFLAGS="-I$(abs_top_srcdir)/src -I$(abs_top_srcdir)/interfaces" python setup.py install --prefix=$(prefix) -R $(libdir)
Uwe Schulzweida's avatar
Uwe Schulzweida committed
95
96
97
98
endif
#
AM_CPPFLAGS = -I$(top_srcdir)/src
#
99
all-local: $(BINDINGS)
Uwe Schulzweida's avatar
Uwe Schulzweida committed
100
#
101
102
103
test: $(BINDING_TESTS)
#
CLEANFILES  += `ls *~ *.o *.la`