summaryrefslogtreecommitdiff
path: root/lang/python/Makefile.am
blob: 224a91ad27247dbba2cd6cbbcee897bd876d4c33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Makefile.am for the Python bindings.
# Copyright (C) 2016 g10 Code GmbH
#
# This file is part of GPGME.
#
# GPGME is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of the
# License, or (at your option) any later version.
#
# GPGME is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
# Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, see <http://www.gnu.org/licenses/>.

EXTRA_DIST = \
	README \
	MANIFEST.in \
	gpgme.i \
	helpers.c helpers.h private.h \
	gpgme-h-clean.py \
	examples \
	pyme

SUBDIRS = . tests

COPY_FILES = \
	$(srcdir)/gpgme.i \
	$(srcdir)/README \
	$(srcdir)/MANIFEST.in \
	$(srcdir)/gpgme-h-clean.py \
	$(srcdir)/examples \
	$(srcdir)/helpers.c $(srcdir)/helpers.h $(srcdir)/private.h

COPY_FILES_PYME = \
	$(srcdir)/pyme/callbacks.py \
	$(srcdir)/pyme/constants \
	$(srcdir)/pyme/core.py \
	$(srcdir)/pyme/errors.py \
	$(srcdir)/pyme/__init__.py \
	$(srcdir)/pyme/results.py \
	$(srcdir)/pyme/util.py

# For VPATH builds we need to copy some files because Python's
# distutils are not VPATH-aware.
copystamp: $(COPY_FILES) $(COPY_FILES_PYME) data.h config.h
	if test "$(srcdir)" != "$(builddir)" ; then \
	  cp -R $(COPY_FILES) . ; \
	  cp -R $(COPY_FILES_PYME) pyme ; \
	fi
	touch $@

data.h:
	ln -s "$(top_srcdir)/src/data.h" .

config.h:
	ln -s "$(top_builddir)/config.h" .

all-local: copystamp
	for PYTHON in $(PYTHONS); do \
	  CFLAGS="$(CFLAGS)" \
	    $$PYTHON setup.py build --verbose ; \
	done

dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc: copystamp
	CFLAGS="$(CFLAGS)" \
	  $(PYTHON) setup.py sdist --verbose
	gpg2 --detach-sign --armor dist/pyme3-$(VERSION).tar.gz

.PHONY: prepare
prepare: copystamp

.PHONY: sdist
sdist: dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc

.PHONY: upload
upload: dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc
	twine upload $^

CLEANFILES = gpgme.h errors.i gpgme_wrap.c pyme/gpgme.py \
	  data.h config.h copystamp

# Remove the rest.
#
# 'make distclean' clears the write bit, breaking rm -rf.  Fix the
# permissions.
clean-local:
	rm -rf -- build
	if test "$(srcdir)" != "$(builddir)" ; then \
	  find . -type d ! -perm -200 -exec chmod u+w {} ';' ; \
	  for F in $(COPY_FILES); do rm -rf -- `basename $$F` ; done ; \
	  for F in $(COPY_FILES_PYME); do \
	      rm -rf -- pyme/`basename $$F` ; \
	  done ; \
	fi

install-exec-local:
	rm -f install_files.txt
	for PYTHON in $(PYTHONS); do \
	  $$PYTHON setup.py install \
	  --prefix $(DESTDIR)$(prefix) \
	  --record files.txt \
	  --verbose ; \
	  cat files.txt >> install_files.txt ; \
	  rm files.txt ; \
	done
	$(MKDIR_P) $(DESTDIR)$(pythondir)/pyme
	mv install_files.txt $(DESTDIR)$(pythondir)/pyme

uninstall-local:
	xargs <$(DESTDIR)$(pythondir)/pyme/install_files.txt -- rm -rf --
	rm -rf -- $(DESTDIR)$(pythondir)/pyme