More Makefile.am cleanup
[geda-gaf/whiteaudio.git] / Makefile.am
blob3df82fa8bd51760f1356cc826f68311f2e775ce6
1 SUBDIRS = intl libgeda gschem gattrib gsymcheck gnetlist utils symbols docs \
2         examples
4 ACLOCAL_AMFLAGS = -I m4
6 # We need to ensure that `make distcheck' *doesn't* find a git
7 # repository!
8 DISTCHECK_CONFIGURE_FLAGS = GIT="/bin/sh -c '! :'" --disable-update-xdg-database
10 BUILT_SOURCES = version.h
11 EXTRA_DIST = autogen.sh version.h version.h.in README.Cygwin update-versions.sh
13 # Generate version.h. This works by looking at any git repository that
14 # is present in the source directory (detected at configure time). If
15 # there is a git repository, the HEAD commitid is checked every time
16 # the package is built to see if it has changed. If so, version.h is
17 # regenerated. If there isn't a git repository, version.h is just
18 # assumed to be present (since the generated version.h is distributed
19 # in the source tarball).
20 if HAVE_GIT_REPO
21 version.h: stamp-git $(top_builddir)/configure $(srcdir)/version.h.in
22         @if test ! -f version.h; then \
23           rm -f stamp-git; \
24           $(MAKE) $(AM_MAKEFLAGS) stamp-git; \
25         else :; fi
27         @date_ver=$(DATE_VERSION); dotted_ver=$(DOTTED_VERSION); \
28         git_commit=`cd $(srcdir) && $(GIT) rev-parse HEAD`; \
29         git_ver=`cd $(srcdir) && $(GIT) describe --always HEAD`; \
30         sed -e"s:^.*\(PACKAGE_DATE_VERSION\).*$$:#define \1 \"$$date_ver\":" \
31             -e"s:^.*\(PACKAGE_DOTTED_VERSION\).*$$:#define \1 \"$$dotted_ver\":" \
32             -e"s:^.*\(PACKAGE_GIT_VERSION\).*$$:#define \1 \"$$git_ver\":" \
33             -e"s:^.*\(PACKAGE_GIT_COMMIT\).*$$:#define \1 \"$$git_commit\":" \
34               < $(srcdir)/version.h.in > version.h.new; \
35         if diff version.h version.h.new > /dev/null 2>&1; then \
36           echo "version.h is unchanged"; \
37           rm version.h.new; \
38         else \
39           echo "Recreating version.h"; \
40           mv version.h.new version.h; \
41         fi
42 stamp-git:
43         @last_version=`if test -f stamp-git; then cat stamp-git; else :; fi`; \
44         now_version=`cd $(srcdir) && $(GIT) rev-parse HEAD`; \
45         if test "X$$now_version" != "X$$last_version"; then \
46           echo $$now_version > stamp-git; \
47           echo "Now at git commit $$now_version..."; \
48         fi
49 .PHONY: stamp-git
50 endif HAVE_GIT_REPO
52 DISTCLEANFILES = stamp-git
53 MAINTAINERCLEANFILES=Makefile.in aclocal.m4 config.h.in configure