1## -*- coding: utf-8 -*-
2## Copyright (C) 2011-2017, 2020 Laboratoire de Recherche et Développement
3## de l'Epita (LRDE).
4## Copyright (C) 2003, 2005  Laboratoire d'Informatique de Paris 6 (LIP6),
5## département Systèmes Répartis Coopératifs (SRC), Université Pierre
6## et Marie Curie.
7##
8## This file is part of Spot, a model checking library.
9##
10## Spot is free software; you can redistribute it and/or modify it
11## under the terms of the GNU General Public License as published by
12## the Free Software Foundation; either version 3 of the License, or
13## (at your option) any later version.
14##
15## Spot is distributed in the hope that it will be useful, but WITHOUT
16## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
18## License for more details.
19##
20## You should have received a copy of the GNU General Public License
21## along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
23if NEVER
24  # For Automake a, conditional directory
25  # is conditionally built, but unconditionally distributed.
26  # So using NEVER here ensures that `make all' will not
27  # recurse in bench/, but `make dist' will.
28  NEVER_SUBDIRS = bench elisp
29endif
30
31if USE_PYTHON
32  PYTHON_SUBDIR = python
33endif
34
35DOC_SUBDIR = doc
36SUBDIRS = picosat buddy lib ltdl spot bin tests $(PYTHON_SUBDIR) $(DOC_SUBDIR) \
37					$(NEVER_SUBDIRS)
38
39UTF8 = utf8/README.md utf8/utf8.h	\
40  utf8/utf8/checked.h utf8/utf8/core.h utf8/utf8/unchecked.h
41
42DEBIAN =					\
43  debian/changelog				\
44  debian/changelog.in				\
45  debian/compat					\
46  debian/control				\
47  debian/copyright				\
48  debian/docs					\
49  debian/libbddx0.install			\
50  debian/libbddx-dev.install			\
51  debian/libspot0.install			\
52  debian/libspotltsmin0.install			\
53  debian/libspotgen0.install \
54  debian/libspot-dev.install			\
55  debian/python3-spot.examples			\
56  debian/python3-spot.install			\
57  debian/rules					\
58  debian/source/format				\
59  debian/source/lintian-overrides		\
60  debian/spot-doc.doc-base			\
61  debian/spot-doc.install			\
62  debian/spot.install
63
64debian/changelog: configure.ac
65	$(top_builddir)/config.status --file debian/changelog
66
67EXTRA_DIST = HACKING ChangeLog.1 tools/gitlog-to-changelog	\
68	     tools/help2man tools/man2html.pl			\
69	     tools/test-driver-teamcity $(UTF8) $(DEBIAN)	\
70	     m4/gnulib-cache.m4 .dir-locals.el			\
71	     spot.spec spot.spec.in
72
73dist-hook: gen-ChangeLog
74
75gen_start = 2012-03-10
76gen_start_buddy = 2014-02-13
77.PHONY: gen-ChangeLog deb
78gen-ChangeLog:
79	if test -d .git; then						\
80## Generate all commits in the form "SHA1 subject"
81	  git log --since=$(gen_start) --pretty=oneline |		\
82## Filter out commits whose subject start with '['.  These are usually
83## [buddy] or [lbtt] tags to indicate we are committing on a subproject.
84	    grep -v '........................................ \[' |	\
85## Keep the SHA1
86	    cut -c 1-40 |						\
87## Feed all that to gitlog-to-changelog
88	    $(top_srcdir)/tools/gitlog-to-changelog			\
89	      --no-cluster --format='%s%n%n%b%n' --			\
90	      --stdin --no-walk > $(distdir)/cl-t;			\
91	  rm -f $(distdir)/ChangeLog;					\
92	  mv $(distdir)/cl-t $(distdir)/ChangeLog;			\
93## Now do the same for BuDDy
94	  git log --since=$(gen_start_buddy) --pretty=oneline |		\
95	    grep '........................................ \[buddy\]' |	\
96	    cut -c 1-40 |						\
97	    $(top_srcdir)/tools/gitlog-to-changelog			\
98	      --no-cluster --format='%s%n%n%b%n' --			\
99	      --stdin --no-walk |					\
100	    sed 's/^	\[buddy\] /	/g' >$(distdir)/cl-t;		\
101	  rm -f $(distdir)/buddy/ChangeLog;				\
102	  mv $(distdir)/cl-t $(distdir)/buddy/ChangeLog;		\
103	fi
104
105# Build Debian packages.
106# Run it with:  make DEBUILDFLAGS=-j8 deb -j8
107deb: dist
108	rm -rf spot-$(VERSION) spot-$(VERSION)$(GITPATCH)
109	tar zxvf spot-$(VERSION).tar.gz
110	mv spot-$(VERSION) spot-$(VERSION)$(GITPATCH)
111	tar Jcvf spot_$(VERSION)$(GITPATCH).orig.tar.xz \
112	         spot-$(VERSION)$(GITPATCH)
113	cd spot-$(VERSION)$(GITPATCH) && debuild $(DEBUILDFLAGS) -us -uc
114
115spot.spec: configure.ac spot.spec.in
116	sed 's/[@]VERSION[@]/$(VERSION)/;s/[@]GITPATCH[@]/@@@$(GITPATCH)/;s/@@@\.//' spot.spec.in > $@.tmp && mv $@.tmp $@
117