upgrading copyright year from 2013 to 2014
[hkl.git] / Makefile.am
blobc1b33f5fc00451f17571b845f7f50bd709eef20a
1 ## Process this file with automake to produce Makefile.in
3 ACLOCAL_AMFLAGS = -I m4
4 AM_DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-introspection
6 SUBDIRS = hkl
7 if HKL3D
8 SUBDIRS += hkl3d data
9 endif
10 if GUI
11 SUBDIRS += gui
12 endif
13 SUBDIRS += tests Documentation
15 EXTRA_DIST = hkl.pc.in hkl3d.pc.in
17 installed_mainheaderdir = $(includedir)/hkl-@VMAJ@
18 dist_installed_mainheader_DATA = hkl.h
20 pkgconfigdir = $(libdir)/pkgconfig
21 pkgconfig_DATA = hkl.pc
23 if HKL3D
24 pkgconfig_DATA += hkl3d.pc
25 endif
27 ## lcov part
28 .PHONY: lcov genlcov lcov-clean
29 # use recursive makes in order to ignore errors during check
30 lcov:
31         -$(MAKE) $(AM_MAKEFLAGS) -k check
32         $(MAKE) $(AM_MAKEFLAGS) genlcov
34 # we have to massage the lcov.info file slightly to hide the effect of libtool
35 # placing the objects files in the .libs/ directory separate from the *.c
36 # we also have to delete tests/.libs/*.gcda
37 genlcov:
38         rm -f $(top_builddir)/test/hkl/.libs/*.gcda
39         $(LTP) --directory $(top_builddir) --capture --output-file hkl-lcov.info --test-name hkl-lcov --no-checksum --compat-libtool
40         LANG=C $(LTP_GENHTML) --prefix $(top_builddir) --output-directory hkl-lcov --title "hkl Code Coverage" --legend --show-details hkl-lcov.info
42 lcov-clean:
43         -$(LTP) --directory $(top_builddir) -z
44         -rm -rf hkl-lcov.info hkl-lcov
45         -find -name '*.gcda' -print | xargs rm
46         -find -name '*.gcno' -print | xargs rm
48 distclean-local: lcov-clean
50 ## Generate the Changelog file for the distribution.
51 dist-hook:
52         @if test -d "$(srcdir)/.git"; \
53         then \
54                 echo Creating ChangeLog && \
55                 ( cd "$(top_srcdir)" && \
56                   echo '# Generated by Makefile. Do not edit.'; echo; \
57                   $(top_srcdir)/config/missing --run git log --stat ) > ChangeLog.tmp \
58                 && mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \
59                 || ( rm -f ChangeLog.tmp ; \
60                      echo Failed to generate ChangeLog >&2 ); \
61         else \
62                 echo A git clone is required to generate a ChangeLog >&2; \
63         fi
65 ## Update the ccan library
67 CCAN_PUBLIC_MODULES=darray
68 CCAN_PRIVATE_MODULES=array_size container_of autodata list
69 CCAN_LOCAL_REPO=/tmp/ccan
70 CCAN_LOCAL_EXTRACT=/tmp/ccan.tmp
71 CCAN_URL=git://git.ozlabs.org/~ccan/ccan
72 CCAN_CREATE_TREE=rm -rf $(CCAN_LOCAL_EXTRACT) && $(CCAN_LOCAL_REPO)/tools/create-ccan-tree -b automake $(CCAN_LOCAL_EXTRACT)
73 CCAN_DEST=$(top_srcdir)/hkl/
74 CCAN_TMP_DEST=/tmp/ccan.next
75 ccan-update:
76         @if test -d $(CCAN_LOCAL_REPO); \
77         then \
78                 cd $(CCAN_LOCAL_REPO) && git pull; \
79         else \
80                 git clone $(CCAN_URL) $(CCAN_LOCAL_REPO); \
81         fi
83         @echo Extracting all the modules
84         @$(CCAN_CREATE_TREE) $(CCAN_PUBLIC_MODULES) $(CCAN_PRIVATE_MODULES)
86         @rm -rf $(CCAN_TMP_DEST) && mkdir -p $(CCAN_TMP_DEST)
87         @rsync -av --exclude=Makefile.am $(CCAN_LOCAL_EXTRACT)/* $(CCAN_TMP_DEST)
88         @find $(CCAN_TMP_DEST)/ccan -maxdepth 2 -name '*.[ch]' | xargs sed -i -e 's,ccan/,hkl/ccan/,'
90         @$(CCAN_CREATE_TREE) $(CCAN_PUBLIC_MODULES)
92         @echo Generating the Makefile.am
93         @(\
94                 echo "AM_CFLAGS=-I\$$(top_srcdir)"; echo;\
95                 echo "noinst_LTLIBRARIES=libccan.la";\
96                 echo "libccan_la_SOURCES = \\";\
97                 (\
98                         cd $(CCAN_TMP_DEST)/ccan && find . -maxdepth 2 -name '*.[ch]'\
99                                 | sed -e 's,^./,\t,;$$!s,$$, \\,'; echo;\
100                 );\
101                 echo "ccanincludedir=\$$(includedir)/hkl-@""VMAJ@/hkl/ccan";\
102                 echo "nobase_ccaninclude_HEADERS= \\";\
103                 (\
104                         cd $(CCAN_LOCAL_EXTRACT)/ccan && find . -maxdepth 2 -name '*.[h]'\
105                                 | sed -e 's,^./,\t,;$$!s,$$, \\,';\
106                 );\
107         ) > $(CCAN_TMP_DEST)/ccan/Makefile.am
109         @echo purge the previous ccan directory
110         cd $(CCAN_DEST) && rm -rf licenses && find ccan -mindepth 1 -type d \! -name ".*" | xargs rm -rf
111         rsync -av $(CCAN_TMP_DEST)/* $(top_srcdir)/hkl