forked from adversary-org/pyme3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
104 lines (91 loc) · 3.43 KB
/
Makefile
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
# $Id$
# Copyright (C) 2004,2008 Igor Belyi <[email protected]>
# Copyright (C) 2002 John Goerzen <[email protected]>
#
# This library 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.
#
# This library 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 library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
PYTHON = python3
MODULE = pygpgme
FILE = gpgme
PYPATH = pyme
PYFILE = $(MODULE).py
CFILE = $(FILE)_wrap.c
HFILE = $(FILE).h
USRHFILE = $(shell gpgme-config --prefix)/include/$(HFILE)
SWIGSOURCE = $(FILE).i
DOCMODSDIRS := $(shell find pyme -type d | grep -v CVS | sed 'sx/x.xg')
DOCMODSFILES := $(shell find pyme -name "*.py" | egrep -v __init__ | grep -v gpgme.py | sed 'sx/x.xg')
DOCMODS := $(DOCMODSDIRS) $(DOCMODSFILES:.py=)
SWIGOPT := $(shell gpgme-config --cflags) -I/usr/include
PYMEVERS := $(shell python3 -c "from pyme.version import *;print(versionstr)")
SYSTEM = $(shell uname -s | sed 's/_.*//')
ifeq ($(SYSTEM),MINGW32)
DLLDIR := $(shell gpgme-config --exec-prefix)/bin
DLLFILES := $(DLLDIR)/libgpg-error-0.dll $(DLLDIR)/libgpgme-11.dll
SWIG = /c/cygwin/bin/swig
else
SWIG = swig
endif
build: swig
ifeq ($(SYSTEM),MINGW32)
$(PYTHON) setup.py build -b build --compiler=mingw32
cp $(DLLFILES) build/lib.win32-*/pyme
else
$(PYTHON) setup.py build -b build
endif
install: build
$(PYTHON) setup.py install --skip-build
info:
@echo $(DOCMODS)
swig: $(CFILE) $(PYPATH)/$(PYFILE)
# Cleanup gpgme.h from deprecated functions and typedefs.
$(HFILE): $(USRHFILE)
$(PYTHON) gpgme-h-clean.py $(USRHFILE) >$(HFILE)
$(CFILE) $(PYPATH)/$(PYFILE): $(SWIGSOURCE) $(HFILE) helpers.h
$(SWIG) -python -py3 $(SWIGOPT) $(SWIGSOURCE)
mv $(PYFILE) $(PYPATH)/$(PYFILE)
clean:
python3 setup.py clean --all
rm -rf build dist
rm -f `find . -name "*~"` `find . -name "*.pyc"` `find . -name "*.so"`
find . -name auth -exec rm -vf {}/password {}/username \;
#changelog:
# svn log -v > ChangeLog
reallyclean: clean
rm -f doc/*.html doc/gpgme/*.html $(CFILE) $(PYPATH)/$(PYFILE) $(HFILE)
docs: build
rm -f doc/*.html
cd doc; for MOD in $(DOCMODS); do PYTHONPATH=`echo ../build/lib* | sed -e "s# #:#"` pydoc -w $$MOD; done
ifneq (, $(PYSRCURL))
cd doc; for MOD in $(DOCMODS); do sed -i -e "s#\"file:.*/site-packages/\(pyme/.*\)\">[^<]*</a>#\"$(PYSRCURL)\">\1</a>#" $$MOD.html; done
endif
nondeb-dist: reallyclean
rm -rf ../pyme-$(PYMEVERS)
mkdir ../pyme-$(PYMEVERS)
tar -c --exclude="debian" --exclude="CVS" * | tar -x -C ../pyme-$(PYMEVERS)
tar -czf ../pyme-$(PYMEVERS).tar.gz -C .. pyme-$(PYMEVERS)
rm -rf ../pyme-$(PYMEVERS)
dist:
ifeq ($(SYSTEM),MINGW32)
$(PYTHON) setup.py bdist_wininst --skip-build
else
fakeroot debian/rules clean
fakeroot debian/rules binary
fakeroot debian/rules clean
rm -rf ../pyme-$(PYMEVERS)
mkdir ../pyme-$(PYMEVERS)
tar -c --exclude="CVS" * | tar -x -C ../pyme-$(PYMEVERS)
tar -czf ../pyme-$(PYMEVERS).tar.gz -C .. pyme-$(PYMEVERS)
rm -rf ../pyme-$(PYMEVERS)
endif