summaryrefslogtreecommitdiff
path: root/gi/_glib/Makefile.am
blob: c15203963a70bb3c9560831ecb8322afe62acddc (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
AUTOMAKE_OPTIONS = 1.7

extension_cppflags = \
	$(PYTHON_INCLUDES) \
	-DPY_SSIZE_T_CLEAN

extension_ldflags = \
	-module \
	-avoid-version

if OS_WIN32
# Windows requires Python modules to be explicitly linked to libpython.
# Extension modules are shared libaries (.dll), but need to be
# called .pyd for Python to load it as an extension module.
extension_libadd = \
	$(PYTHON_LIBS)

extension_ldflags += \
	-no-undefined \
	-shrext ".pyd"
endif


pyglibdir = $(pyexecdir)/gi/_glib

pyglib_PYTHON = \
	__init__.py \
	option.py

lib_LTLIBRARIES = libpyglib-gi-2.0-@PYTHON_BASENAME@.la

libpyglib_gi_2_0_@PYTHON_BASENAME@_la_SOURCES = \
	pyglib.c \
	pyglib.h \
	pyglib-private.h \
	pyglib-python-compat.h
libpyglib_gi_2_0_@PYTHON_BASENAME@_la_CPPFLAGS = \
	$(extension_cppflags)
libpyglib_gi_2_0_@PYTHON_BASENAME@_la_CFLAGS = \
	$(GLIB_CFLAGS)
libpyglib_gi_2_0_@PYTHON_BASENAME@_la_LIBADD = \
	$(extension_libadd) \
	$(FFI_LIBS) \
	$(GLIB_LIBS)

if OS_WIN32
libpyglib_gi_2_0_@PYTHON_BASENAME@_la_LDFLAGS = \
	-no-undefined
endif

pyglib_LTLIBRARIES = _glib.la

_glib_la_SOURCES = \
	glibmodule.c \
	pygiochannel.c \
	pygiochannel.h \
	pygoptioncontext.c \
	pygoptioncontext.h \
	pygoptiongroup.c \
	pygoptiongroup.h \
	pygmaincontext.c \
	pygmaincontext.h \
	pygmainloop.c \
	pygmainloop.h \
	pygsource.c \
	pygsource.h \
	pygspawn.c \
	pygspawn.h
_glib_la_CFLAGS = \
	$(GLIB_CFLAGS)
_glib_la_CPPFLAGS = \
	$(extension_cppflags)
_glib_la_LIBADD = \
	$(extension_libadd) \
	$(GLIB_LIBS) \
	libpyglib-gi-2.0-@PYTHON_BASENAME@.la
_glib_la_LDFLAGS = \
	$(extension_ldflags) \
	-export-symbols-regex "_glib|PyInit__glib"

if PLATFORM_WIN32
_glib_la_CFLAGS += -DPLATFORM_WIN32
endif

# if we build in a separate tree, we need to symlink the *.py files from the
# source tree; Python does not accept the extensions and modules in different
# paths
build_pylinks:
	for f in $(pyglib_PYTHON); do \
	    [ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \
	done


all: $(pyglib_LTLIBRARIES:.la=.so) build_pylinks
check-local: $(pyglib_LTLIBRARIES:.la=.so) build_pylinks
clean-local:
	rm -f $(pyglib_LTLIBRARIES:.la=.so)
.la.so:
	$(LN_S) .libs/$@ $@ || true


-include $(top_srcdir)/git.mk