summaryrefslogtreecommitdiff
path: root/gi/_gobject/Makefile.am
blob: 2537f99a535014a5b3cd35f9a1d8ab4efeea2961 (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
AUTOMAKE_OPTIONS = 1.7
PLATFORM_VERSION = 3.0

pkgincludedir = $(includedir)/pygobject-$(PLATFORM_VERSION)
pkginclude_HEADERS = pygobject.h

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

pygobjectdir = $(pyexecdir)/gi/_gobject

pygobject_PYTHON = \
	__init__.py \
	constants.py \
	propertyhelper.py

pygobject_LTLIBRARIES = _gobject.la

_gobject_la_SOURCES = \
        gobjectmodule.c \
        pygboxed.c \
        pygboxed.h \
        pygenum.c \
        pygenum.h \
        pygflags.c \
        pygflags.h \
        pyginterface.c \
        pyginterface.h \
        pygobject.c \
        pygobject.h \
        pygobject-private.h \
        pygparamspec.c \
        pygparamspec.h \
        pygpointer.c \
        pygpointer.h \
        pygtype.c \
        pygtype.h
_gobject_la_CFLAGS = \
	$(extension_cppflags) \
	-I$(top_srcdir)/gi/_glib \
	-I$(top_srcdir)/gi \
	$(GLIB_CFLAGS) \
	$(GI_CFLAGS)
_gi_la_CPPFLAGS = \
	$(extension_cppflags)
_gobject_la_LIBADD = \
	$(extension_libadd) \
	$(GLIB_LIBS) \
	$(GI_LIBS) \
	$(top_builddir)/gi/_glib/libpyglib-gi-2.0-@PYTHON_BASENAME@.la
_gobject_la_LDFLAGS = \
	$(extension_ldflags) \
	-export-symbols-regex "_gobject|PyInit__gobject"

# 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 $(pygobject_PYTHON); do \
	    [ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \
	done


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