Imported Upstream version 3.3.1
[platform/upstream/pygobject2.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-foreign-gvariant.c \
46         pygi-foreign-gvariant.h \
47         pygi-struct.c \
48         pygi-struct.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-callbacks.c \
60         pygi-callbacks.h \
61         pygi.h \
62         pygi-private.h \
63         pygi-property.c \
64         pygi-property.h \
65         pygi-signal-closure.c \
66         pygi-signal-closure.h \
67         pygobject-external.h \
68         gimodule.c \
69         pygi-invoke.c \
70         pygi-invoke.h \
71         pygi-invoke-state-struct.h \
72         pygi-cache.h \
73         pygi-cache.c \
74         pygi-marshal-from-py.c \
75         pygi-marshal-from-py.h \
76         pygi-marshal-to-py.c \
77         pygi-marshal-to-py.h \
78         pygi-marshal-cleanup.c \
79         pygi-marshal-cleanup.h
80 _gi_la_CFLAGS = \
81         $(GI_CFLAGS)
82 _gi_la_CPPFLAGS = \
83         $(extension_cppflags) \
84         -I$(top_srcdir)/gi/_glib \
85         -I$(top_srcdir)/gi/_gobject
86 _gi_la_LIBADD = \
87         $(extension_libadd) \
88         $(GI_LIBS) \
89         $(top_builddir)/gi/_glib/libpyglib-gi-2.0-@PYTHON_BASENAME@.la
90 _gi_la_LDFLAGS = \
91         $(extension_ldflags) \
92         -export-symbols-regex "init_gi|PyInit__gi"
93
94 if ENABLE_CAIRO
95 pygi_LTLIBRARIES += _gi_cairo.la
96 endif
97
98 _gi_cairo_la_SOURCES = \
99         pygi-foreign-cairo.c
100 _gi_cairo_la_CFLAGS = \
101         $(GI_CFLAGS) \
102         $(PYCAIRO_CFLAGS)
103 _gi_cairo_la_CPPFLAGS = \
104         $(extension_cppflags) \
105         -I$(top_srcdir)/gi/_glib \
106         -I$(top_srcdir)/gi/_gobject
107 _gi_cairo_la_LIBADD = \
108         $(extension_libadd) \
109         $(GI_LIBS) \
110         $(PYCAIRO_LIBS)
111 _gi_cairo_la_LDFLAGS = \
112         $(extension_ldflags) \
113         -export-symbols-regex "init_gi_cairo|PyInit__gi_cairo"
114
115
116 # This is to ensure we have a symlink to the .so in the
117 # build directory, which the Python interpreter can load
118 # directly without having to know how to parse .la files.
119 .la.so:
120         $(LN_S) .libs/$@ $@ || true
121
122 # if we build in a separate tree, we need to symlink the *.py files from the
123 # source tree; Python does not accept the extensions and modules in different
124 # paths
125 build_pylinks:
126         for f in $(pygi_PYTHON); do \
127             [ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \
128         done
129
130 all-local: $(LTLIBRARIES:.la=.so) build_pylinks
131
132 check-local: $(LTLIBRARIES:.la=.so) build_pylinks
133 clean-local:
134         rm -f $(LTLIBRARIES:.la=.so)
135
136
137 -include $(top_srcdir)/git.mk