Read version header from source
[pspp-builds.git] / perl-module / automake.mk
1 ## Process this file with automake to produce Makefile.in  -*- makefile -*-
2
3 # PSPP
4
5 module_sources = \
6  perl-module/Changes \
7  perl-module/COPYING \
8  perl-module/Examples.pod \
9  perl-module/Makefile.PL \
10  perl-module/MANIFEST \
11  perl-module/ppport.h \
12  perl-module/PSPP.xs \
13  perl-module/README \
14  perl-module/typemap \
15  perl-module/lib/PSPP.pm \
16  perl-module/t/Pspp.t
17
18 perl-module/pspp-module-config: Makefile
19         target=`mktemp`;\
20         echo '%Locations = (' > $$target ;\
21         printf "  SourceDir => '" >> $$target ;\
22         (cd $(top_srcdir) && echo `pwd`\', ) >> $$target ;\
23         printf "  BuildDir => '" >> $$target ;\
24         (cd $(top_builddir) && echo `pwd`\' ) >> $$target ;\
25         echo ');' >> $$target ;\
26         cp $$target $(top_builddir)/perl-module/pspp-module-config
27
28
29
30 perl-module/Makefile: perl-module/Makefile.PL perl-module/pspp-module-config
31         cd perl-module && $(PERL) Makefile.PL PREFIX=$(prefix)
32
33 module-make: perl-module/Makefile
34         cd perl-module && $(MAKE) $(AM_MAKEFLAGS)
35
36 perl-module/lib/pspp-vers.pl: src/libpspp/version.c
37         mkdir -p perl-module/lib
38         $(GREP) '^\$$VERSION' $(top_builddir)/src/libpspp/version.c | $(SED) -e 's/VERSION/PSPP::VERSION/' > $@
39
40 all-local: perl-module/lib/pspp-vers.pl
41         if test x"$(top_builddir)" != x"$(top_srcdir)" ; then \
42          for f in $(module_sources); do \
43           destdir=`dirname $$f` ;\
44           mkdir -p $$destdir ;\
45           if test "$(top_srcdir)/$$f" -nt "$(top_builddir)/$$f" ; then \
46                  cp $(top_srcdir)/$$f $$destdir ; \
47           fi ; \
48          done \
49         fi
50         $(MAKE) $(AM_MAKEFLAGS) module-make
51
52 check-local:
53         cd perl-module && $(MAKE) $(AM_MAKEFLAGS) test
54
55
56 clean-local:
57         cd perl-module && $(MAKE) $(AM_MAKEFLAGS) clean
58         if test x"$(top_builddir)" != x"$(top_srcdir)" ; then \
59           $(RM) $(module_sources) ; \
60         fi
61         $(RM) perl-module/Makefile.old
62
63
64 CLEANFILES += \
65         perl-module/pspp-module-config \
66         perl-module/lib/pspp-vers.pl \
67         perl-module/const-c.inc \
68         perl-module/const-xs.inc 
69
70 EXTRA_DIST +=  $(module_sources)