1# Makefile.am for the Python bindings.
2# Copyright (C) 2019 g10 Code GmbH
3#
4# This file is part of GPGME.
5#
6# GPGME is free software; you can redistribute it and/or modify it
7# under the terms of the GNU Lesser General Public License as
8# published by the Free Software Foundation; either version 2.1 of the
9# License, or (at your option) any later version.
10#
11# GPGME is distributed in the hope that it will be useful, but WITHOUT
12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
14# Public License for more details.
15#
16# You should have received a copy of the GNU Lesser General Public
17# License along with this program; if not, see <https://gnu.org/licenses/>.
18# SPDX-License-Identifier: LGPL-2.1-or-later
19
20EXTRA_DIST = README rst src texinfo
21
22if MAINTAINER_MODE
23
24ORGSRCS = index.org gpgme-python-howto.org maintenance-mode.org \
25	  short-history.org what-is-new.org what-was-new.org
26
27# Make sure we have 'rst' and 'texinfo' dirs in build directory
28.PHONY: the_doc_dirs gen_rst gen_texi
29
30the_doc_dirs:
31	@if test ! -d rst; then echo $(MKDIR_P) rst; $(MKDIR_P) rst; fi
32	@if test ! -d texinfo; then echo $(MKDIR_P) texinfo; $(MKDIR_P) texinfo; fi
33
34# Generate RST files from ORG
35gen_rst:
36	@for f in $(ORGSRCS); do if test ! -e rst/$${f%.org}.rst \
37	  -o rst/$${f%.org}.rst -ot $(srcdir)/src/$$f; then \
38	    echo pandoc -f org -t rst $(srcdir)/src/$$f -o rst/$${f%.org}.rst; \
39	    pandoc -f org -t rst $(srcdir)/src/$$f -o rst/$${f%.org}.rst;      \
40	  fi; \
41	done
42
43# Generate Texinfo files from ORG
44gen_texi:
45	@for f in $(ORGSRCS); do if test ! -e texinfo/$${f%.org}.texi \
46	  -o texinfo/$${f%.org}.texi -ot $(srcdir)/src/$$f; then \
47	    echo pandoc -f org -t texinfo $(srcdir)/src/$$f -o texinfo/$${f%.org}.texi; \
48	    pandoc -f org -t texinfo $(srcdir)/src/$$f -o texinfo/$${f%.org}.texi;      \
49	  fi; \
50	done
51
52all-local: gen_rst gen_texi
53
54gen_rst gen_texi: the_doc_dirs
55
56maintainer-clean-local:
57	@for f in $(ORGSRCS); do \
58	  echo rm -f rst/$${f%.org}.rst texinfo/$${f%.org}.texi; \
59	  rm -f rst/$${f%.org}.rst texinfo/$${f%.org}.texi; \
60	done
61endif
62