Imported Upstream version 3.7.3
[platform/upstream/python-gobject.git] / gi / Makefile.am
1 SUBDIRS = \
2         repository \
3         overrides \
4         _glib \
5         _gobject
6
7 extension_cppflags = \
8         $(PYTHON_INCLUDES) \
9         -DPY_SSIZE_T_CLEAN
10
11 extension_ldflags = \
12         -module \
13         -avoid-version
14
15 if OS_WIN32
16 # Windows requires Python modules to be explicitly linked to libpython.
17 # Extension modules are shared libaries (.dll), but need to be
18 # called .pyd for Python to load it as an extension module.
19 extension_libadd = \
20         $(PYTHON_LIBS)
21
22 extension_ldflags += \
23         -no-undefined \
24         -shrext ".pyd"
25 endif
26
27 pygidir = $(pyexecdir)/gi
28
29 pygi_PYTHON = \
30         __init__.py \
31         types.py \
32         module.py \
33         importer.py \
34         pygtkcompat.py
35
36 pygi_LTLIBRARIES = _gi.la
37
38 _gi_la_SOURCES = \
39         pygi-repository.c \
40         pygi-repository.h \
41         pygi-info.c \
42         pygi-info.h \
43         pygi-foreign.c \
44         pygi-foreign.h \
45         pygi-struct.c \
46         pygi-struct.h \
47         pygi-source.c \
48         pygi-source.h \
49         pygi-argument.c \
50         pygi-argument.h \
51         pygi-type.c \
52         pygi-type.h \
53         pygi-boxed.c \
54         pygi-boxed.h \
55         pygi-closure.c \
56         pygi-closure.h \
57         pygi-ccallback.c \
58         pygi-ccallback.h \
59         pygi.h \
60         pygi-private.h \
61         pygi-property.c \
62         pygi-property.h \
63         pygi-signal-closure.c \
64         pygi-signal-closure.h \
65         pygobject-external.h \
66         gimodule.c \
67         pygi-invoke.c \
68         pygi-invoke.h \
69         pygi-invoke-state-struct.h \
70         pygi-cache.h \
71         pygi-cache.c \
72         pygi-marshal-from-py.c \
73         pygi-marshal-from-py.h \
74         pygi-marshal-to-py.c \
75         pygi-marshal-to-py.h \
76         pygi-marshal-cleanup.c \
77         pygi-marshal-cleanup.h
78 _gi_la_CFLAGS = \
79         $(GI_CFLAGS)
80 _gi_la_CPPFLAGS = \
81         $(extension_cppflags) \
82         -I$(top_srcdir)/gi/_glib \
83         -I$(top_srcdir)/gi/_gobject
84 _gi_la_LIBADD = \
85         $(extension_libadd) \
86         $(GI_LIBS) \
87         $(top_builddir)/gi/_glib/libpyglib-gi-2.0-@PYTHON_BASENAME@.la
88 _gi_la_LDFLAGS = \
89         $(extension_ldflags) \
90         -export-symbols-regex "init_gi|PyInit__gi"
91
92 if ENABLE_CAIRO
93 pygi_LTLIBRARIES += _gi_cairo.la
94 endif
95
96 _gi_cairo_la_SOURCES = \
97         pygi-foreign-cairo.c
98 _gi_cairo_la_CFLAGS = \
99         $(GI_CFLAGS) \
100         $(PYCAIRO_CFLAGS)
101 _gi_cairo_la_CPPFLAGS = \
102         $(extension_cppflags) \
103         -I$(top_srcdir)/gi/_glib \
104         -I$(top_srcdir)/gi/_gobject
105 _gi_cairo_la_LIBADD = \
106         $(extension_libadd) \
107         $(GI_LIBS) \
108         $(PYCAIRO_LIBS)
109 _gi_cairo_la_LDFLAGS = \
110         $(extension_ldflags) \
111         -export-symbols-regex "init_gi_cairo|PyInit__gi_cairo"
112
113
114 # This is to ensure we have a symlink to the .so in the
115 # build directory, which the Python interpreter can load
116 # directly without having to know how to parse .la files.
117 .la.so:
118         $(LN_S) -f .libs/$@ $@
119
120 # if we build in a separate tree, we need to symlink the *.py files from the
121 # source tree; Python does not accept the extensions and modules in different
122 # paths
123 build_pylinks:
124         for f in $(pygi_PYTHON); do \
125             [ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \
126         done
127
128 all-local: $(LTLIBRARIES:.la=.so) build_pylinks
129
130 check-local: $(LTLIBRARIES:.la=.so) build_pylinks
131 clean-local:
132         rm -f $(LTLIBRARIES:.la=.so)