post release commit
[hkl.git] / Makefile.am
blob69c5ed4fb7c92fad93381d365d29d2eacb718cc2
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 --enable-hkl3d
6 SUBDIRS = hkl
7 if HKL3D
8 SUBDIRS += hkl3d data
9 endif
10 if GUI
11 SUBDIRS += gui
12 endif
13 if HKL_DOC
14 SUBDIRS += Documentation
15 endif
16 SUBDIRS += tests
17 if CONTRIB
18 SUBDIRS += contrib
19 endif
21 EXTRA_DIST = hkl.pc.in hkl3d.pc.in
23 installed_mainheaderdir = $(includedir)/hkl-@VMAJ@
24 dist_installed_mainheader_DATA = hkl.h
26 pkgconfigdir = $(libdir)/pkgconfig
27 pkgconfig_DATA = hkl.pc
29 if HKL3D
30 #for not do not install
31 noinst_DATA = hkl3d.pc
32 endif
34 ## lcov part
35 .PHONY: lcov genlcov lcov-clean
36 # use recursive makes in order to ignore errors during check
37 lcov:
38         -$(MAKE) $(AM_MAKEFLAGS) -k check
39         $(MAKE) $(AM_MAKEFLAGS) genlcov
41 # we have to massage the lcov.info file slightly to hide the effect of libtool
42 # placing the objects files in the .libs/ directory separate from the *.c
43 # we also have to delete tests/.libs/*.gcda
44 genlcov:
45         rm -f $(top_builddir)/test/hkl/.libs/*.gcda
46         $(LTP) --directory $(top_builddir) --capture --output-file hkl-lcov.info --test-name hkl-lcov --no-checksum --compat-libtool
47         LANG=C $(LTP_GENHTML) --prefix $(top_builddir) --output-directory hkl-lcov --title "hkl Code Coverage" --legend --show-details hkl-lcov.info
49 lcov-clean:
50         -$(LTP) --directory $(top_builddir) -z
51         -rm -rf hkl-lcov.info hkl-lcov
52         -find -name '*.gcda' -print | xargs rm
53         -find -name '*.gcno' -print | xargs rm
55 distclean-local: lcov-clean
57 ## Generate the Changelog file for the distribution.
58 dist-hook:
59         @if test -d "$(srcdir)/.git"; \
60         then \
61                 echo Creating ChangeLog && \
62                 ( cd "$(top_srcdir)" && \
63                   echo '# Generated by Makefile. Do not edit.'; echo; \
64                   $(top_srcdir)/config/missing --run git log --stat ) > ChangeLog.tmp \
65                 && mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \
66                 || ( rm -f ChangeLog.tmp ; \
67                      echo Failed to generate ChangeLog >&2 ); \
68         else \
69                 echo A git clone is required to generate a ChangeLog >&2; \
70         fi
72 ## Update the ccan library
74 CCAN_PUBLIC_MODULES=darray
75 CCAN_PRIVATE_MODULES=array_size container_of autodata list
76 CCAN_LOCAL_REPO=/tmp/ccan
77 CCAN_LOCAL_EXTRACT=/tmp/ccan.tmp
78 CCAN_URL=git://git.ozlabs.org/~ccan/ccan
79 CCAN_CREATE_TREE=rm -rf $(CCAN_LOCAL_EXTRACT) && cd $(CCAN_LOCAL_REPO) && tools/create-ccan-tree -b automake $(CCAN_LOCAL_EXTRACT)
80 CCAN_DEST=$(top_srcdir)/hkl/
81 CCAN_TMP_DEST=/tmp/ccan.next
82 ccan-update:
83         @if test -d $(CCAN_LOCAL_REPO); \
84         then \
85                 cd $(CCAN_LOCAL_REPO) && git pull; \
86         else \
87                 git clone $(CCAN_URL) $(CCAN_LOCAL_REPO); \
88         fi
90         @echo Extracting all the modules
91         @$(CCAN_CREATE_TREE) $(CCAN_PUBLIC_MODULES) $(CCAN_PRIVATE_MODULES)
93         @rm -rf $(CCAN_TMP_DEST) && mkdir -p $(CCAN_TMP_DEST)
94         @rsync -av --exclude=Makefile.am $(CCAN_LOCAL_EXTRACT)/* $(CCAN_TMP_DEST)
95         @find $(CCAN_TMP_DEST)/ccan -maxdepth 2 -name '*.[ch]' | xargs sed -i -e 's,ccan/,hkl/ccan/,'
96         @find $(CCAN_TMP_DEST)/ccan -maxdepth 2 -name '*.[ch]' | xargs sed -i -e 's,"config.h",<hkl/ccan/ccan_config.h>,'
98         @$(CCAN_CREATE_TREE) $(CCAN_PUBLIC_MODULES)
100         @echo Generating the Makefile.am
101         @(\
102                 echo "AM_CFLAGS=-I\$$(top_srcdir)"; echo;\
103                 echo "noinst_PROGRAMS=configurator";\
104                 echo "BUILT_SOURCES=ccan_config.h";\
105                 echo "ccan_config.h: configurator";\
106                 (\
107                         echo -e "\t\$$(builddir)/configurator \$$(CC) \$$(CCAN_CFLAGS) > \$$@.tmp && mv \$$@.tmp \$$@";\
108                 );\
109                 echo "noinst_LTLIBRARIES=libccan.la";\
110                 echo "libccan_la_SOURCES = \\";\
111                 (\
112                         echo -e "\tccan_config.h \\";\
113                         cd $(CCAN_TMP_DEST)/ccan && find . -maxdepth 2 -name '*.[ch]'\
114                                 | sed -e 's,^./,\t,;$$!s,$$, \\,'; echo;\
115                 );\
116                 echo "ccanincludedir=\$$(includedir)/hkl-@""VMAJ@/hkl/ccan";\
117                 echo "nobase_ccaninclude_HEADERS= \\";\
118                 (\
119                         cd $(CCAN_LOCAL_EXTRACT)/ccan && find . -maxdepth 2 -name '*.[h]'\
120                                 | sed -e 's,^./,\t,;$$!s,$$, \\,';\
121                 );\
122                 echo "nodist_ccaninclude_HEADERS=ccan_config.h";\
123                 echo "EXTRA_DIST=configurator.c";\
124                 echo "CLEANFILES=configurator ccan_config.h";\
125         ) > $(CCAN_TMP_DEST)/ccan/Makefile.am
127         @echo Extracting the configurator
128         @rsync -av $(CCAN_LOCAL_REPO)/tools/configurator/configurator.c $(CCAN_TMP_DEST)/ccan
130         @echo purge the previous ccan directory
131         cd $(CCAN_DEST) && rm -rf licenses && find ccan -mindepth 1 -type d \! -name ".*" | xargs rm -rf
132         rsync -av $(CCAN_TMP_DEST)/* $(top_srcdir)/hkl