[build] restore distcheck in the release target
[hkl.git] / Makefile.am
blob8c329d54824a7785b642d9dade998c596df1a238
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 --enable-binoculars
6 SUBDIRS = hkl third-party
7 if BINOCULARS
8 SUBDIRS += binoculars-ng
9 endif
10 if HKL3D
11 SUBDIRS += hkl3d data
12 endif
13 SUBDIRS += tests
14 if GUI
15 SUBDIRS += gui
16 endif
17 if HKL_DOC
18 SUBDIRS += Documentation
19 endif
20 if CONTRIB
21 SUBDIRS += contrib
22 endif
24 EXTRA_DIST = hkl.pc.in hkl3d.pc.in
26 installed_mainheaderdir = $(includedir)/hkl-@VMAJ@
27 dist_installed_mainheader_DATA = hkl.h
29 pkgconfigdir = $(libdir)/pkgconfig
30 pkgconfig_DATA = hkl.pc
32 if HKL3D
33 #for not do not install
34 noinst_DATA = hkl3d.pc
35 endif
37 release:
38 #       cd scripts && ./clean-all
39 #       -git commit -a -m "pre-release"
40         ./autogen.sh
41         ./configure $(AM_DISTCHECK_CONFIGURE_FLAGS)
42         $(MAKE) -j
43         $(MAKE) distcheck
44         git tag v`./configure -V | head -n 1 | awk '{print $$3}'`
46 tag:
47         git tag v`./configure -V | head -n 1 | awk '{print $$3}'`
49 ## lcov part
50 .PHONY: lcov genlcov lcov-clean release tag
51 # use recursive makes in order to ignore errors during check
52 lcov:
53         -$(MAKE) $(AM_MAKEFLAGS) -k check
54         $(MAKE) $(AM_MAKEFLAGS) genlcov
56 # we have to massage the lcov.info file slightly to hide the effect of libtool
57 # placing the objects files in the .libs/ directory separate from the *.c
58 # we also have to delete tests/.libs/*.gcda
59 genlcov:
60         rm -f $(top_builddir)/test/hkl/.libs/*.gcda
61         $(LTP) --directory $(top_builddir) --capture --output-file hkl-lcov.info --test-name hkl-lcov --no-checksum --compat-libtool
62         LANG=C $(LTP_GENHTML) --prefix $(top_builddir) --output-directory hkl-lcov --title "hkl Code Coverage" --legend --show-details hkl-lcov.info
64 lcov-clean:
65         -$(LTP) --directory $(top_builddir) -z
66         -rm -rf hkl-lcov.info hkl-lcov
67         -find -name '*.gcda' -print | xargs rm
68         -find -name '*.gcno' -print | xargs rm
70 distclean-local: lcov-clean
72 ## Generate the Changelog file for the distribution.
73 dist-hook:
74         @if test -d "$(srcdir)/.git"; \
75         then \
76                 echo Creating ChangeLog && \
77                 ( cd "$(top_srcdir)" && \
78                   echo '# Generated by Makefile. Do not edit.'; echo; \
79                   $(top_srcdir)/config/missing --run git log --stat ) > ChangeLog.tmp \
80                 && mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \
81                 || ( rm -f ChangeLog.tmp ; \
82                      echo Failed to generate ChangeLog >&2 ); \
83         else \
84                 echo A git clone is required to generate a ChangeLog >&2; \
85         fi
87 ## Update the ccan library
89 CCAN_PUBLIC_MODULES=darray
90 CCAN_PRIVATE_MODULES=array_size container_of autodata list generator
91 CCAN_LOCAL_REPO=/tmp/ccan
92 CCAN_LOCAL_EXTRACT=/tmp/ccan.tmp
93 CCAN_URL=https://github.com/rustyrussell/ccan.git
94 CCAN_CREATE_TREE=rm -rf $(CCAN_LOCAL_EXTRACT) && cd $(CCAN_LOCAL_REPO) && tools/create-ccan-tree -b automake $(CCAN_LOCAL_EXTRACT)
95 CCAN_DEST=$(top_srcdir)/hkl/
96 CCAN_TMP_DEST=/tmp/ccan.next
97 ccan-update:
98         @if test -d $(CCAN_LOCAL_REPO); \
99         then \
100                 cd $(CCAN_LOCAL_REPO) && git pull; \
101         else \
102                 git clone $(CCAN_URL) $(CCAN_LOCAL_REPO); \
103         fi
105         @echo Extracting all the modules
106         @$(CCAN_CREATE_TREE) $(CCAN_PUBLIC_MODULES) $(CCAN_PRIVATE_MODULES)
108         @rm -rf $(CCAN_TMP_DEST) && mkdir -p $(CCAN_TMP_DEST)
109         @rsync -av --exclude=Makefile.am $(CCAN_LOCAL_EXTRACT)/* $(CCAN_TMP_DEST)
110         @find $(CCAN_TMP_DEST)/ccan -maxdepth 2 -name '*.[ch]' | xargs sed -i -e 's,ccan/,hkl/ccan/,'
111         @find $(CCAN_TMP_DEST)/ccan -maxdepth 2 -name '*.[ch]' | xargs sed -i -e 's,"config.h",<hkl/ccan/ccan_config.h>,'
112         @find $(CCAN_TMP_DEST)/ccan -maxdepth 2 -name '_info' | xargs rm -f
113         @find $(CCAN_TMP_DEST)/ccan -maxdepth 2 -name 'test' | xargs rm -rf
115         @$(CCAN_CREATE_TREE) $(CCAN_PUBLIC_MODULES)
117         @echo Generating the Makefile.am
118         @(\
119                 echo "AM_CFLAGS=-I\$$(top_srcdir)"; echo;\
120                 echo "noinst_PROGRAMS=configurator";\
121                 echo "BUILT_SOURCES=ccan_config.h";\
122                 echo "ccan_config.h: configurator";\
123                 (\
124                         echo -e "\t\$$(builddir)/configurator \$$(CC) \$$(CCAN_CFLAGS) > \$$@.tmp && mv \$$@.tmp \$$@";\
125                 );\
126                 echo "noinst_LTLIBRARIES=libccan.la";\
127                 echo "libccan_la_SOURCES = \\";\
128                 (\
129                         echo -e "\tccan_config.h \\";\
130                         cd $(CCAN_TMP_DEST)/ccan && find . -maxdepth 2 -name '*.[ch]'\
131                                 | sort\
132                                 | sed -e 's,^./,\t,;$$!s,$$, \\,'; echo;\
133                 );\
134                 echo "ccanincludedir=\$$(includedir)/hkl-@""VMAJ@/hkl/ccan";\
135                 echo "nobase_ccaninclude_HEADERS= \\";\
136                 (\
137                         cd $(CCAN_LOCAL_EXTRACT)/ccan && find . -maxdepth 2 -name '*.[h]'\
138                                 | sort\
139                                 | sed -e 's,^./,\t,;$$!s,$$, \\,';\
140                 );\
141                 echo "nodist_ccaninclude_HEADERS=ccan_config.h";\
142                 echo "EXTRA_DIST=configurator.c";\
143                 echo "CLEANFILES=configurator ccan_config.h";\
144         ) > $(CCAN_TMP_DEST)/ccan/Makefile.am
146         @echo Extracting the configurator
147         @rsync -av $(CCAN_LOCAL_REPO)/tools/configurator/configurator.c $(CCAN_TMP_DEST)/ccan
149         @echo purge the previous ccan directory
150         cd $(CCAN_DEST) && rm -rf licenses && find ccan -mindepth 1 -type d \! -name ".*" | xargs rm -rf
151         rsync -av $(CCAN_TMP_DEST)/* $(top_srcdir)/hkl
154 ## Update the metalang99 library
156 METALANG99_LOCAL_REPO=/tmp/metalang99
157 METALANG99_URL=https://github.com/Hirrolot/metalang99
158 METALANG99_DEST=$(top_srcdir)/third-party
159 metalang99-update:
160         @if [ -d $(METALANG99_LOCAL_REPO) ]; \
161         then \
162                 cd $(METALANG99_LOCAL_REPO) && git pull; \
163         else \
164                 git clone $(METALANG99_URL) $(METALANG99_LOCAL_REPO); \
165         fi
167         @echo Extracting all the modules
168         @rsync -av $(METALANG99_LOCAL_REPO)/include/* $(METALANG99_DEST)
170         @echo Generating the Makefile.am
171         @(\
172                 echo "EXTRA_DIST= \\";\
173                 (\
174                         cd $(METALANG99_DEST) && find . -name '*.[h]'\
175                                 | sort\
176                                 | sed -e 's,^./,\t,;$$!s,$$, \\,';\
177                 );\
178         ) > $(METALANG99_DEST)/Makefile.am
180         @echo Added all files to git
181         git add $(METALANG99_DEST)
183 ## Update the datatype99 library
185 DATATYPE99_LOCAL_REPO=/tmp/datatype99
186 DATATYPE99_URL=https://github.com/Hirrolot/datatype99
187 DATATYPE99_DEST=$(top_srcdir)/third-party
188 datatype99-update:
189         @if [ -d $(DATATYPE99_LOCAL_REPO) ]; \
190         then \
191                 cd $(DATATYPE99_LOCAL_REPO) && git pull; \
192         else \
193                 git clone $(DATATYPE99_URL) $(DATATYPE99_LOCAL_REPO); \
194         fi
196         @echo Extracting all the modules
197         @rsync -av $(DATATYPE99_LOCAL_REPO)/*.h $(DATATYPE99_DEST)
199         @echo Generating the Makefile.am
200         @(\
201                 echo "EXTRA_DIST= \\";\
202                 (\
203                         cd $(METALANG99_DEST) && find . -name '*.[h]'\
204                                 | sort\
205                                 | sed -e 's,^./,\t,;$$!s,$$, \\,';\
206                 );\
207         ) > $(METALANG99_DEST)/Makefile.am
209         @echo Added all files to git
210         git add $(METALANG99_DEST)