314fd4130a3696f86eecb3800d2df3a9acdca6d5
[platform/upstream/python-gobject.git] / gi / Makefile.am
1 PLATFORM_VERSION = 3.0
2
3 SUBDIRS = \
4         repository \
5         overrides \
6         _gobject
7
8 extension_cppflags = \
9         $(PYTHON_INCLUDES) \
10         -DPY_SSIZE_T_CLEAN
11
12 extension_ldflags = \
13         -module \
14         -avoid-version \
15         -shrext $(PYTHON_SO)
16
17 if OS_WIN32
18 # Windows requires Python modules to be explicitly linked to libpython.
19 # Extension modules are shared libaries (.dll), but need to be
20 # called .pyd for Python to load it as an extension module.
21 extension_libadd = \
22         $(PYTHON_LIBS)
23
24 extension_ldflags += \
25         -no-undefined
26 endif
27
28 pkgincludedir = $(includedir)/pygobject-$(PLATFORM_VERSION)
29 if WITH_COMMON
30 pkginclude_HEADERS = pygobject.h
31 endif
32
33 pygidir = $(pyexecdir)/gi
34
35 pygi_LTLIBRARIES = _gi.la
36
37 _gi_la_SOURCES = \
38         gobjectmodule.c \
39         pygboxed.c \
40         pygboxed.h \
41         pygenum.c \
42         pygenum.h \
43         pygflags.c \
44         pygflags.h \
45         pyginterface.c \
46         pyginterface.h \
47         pygobject.c \
48         pygobject.h \
49         pygobject-private.h \
50         pygparamspec.c \
51         pygparamspec.h \
52         pygpointer.c \
53         pygpointer.h \
54         pygtype.c \
55         pygtype.h \
56         glibmodule.c \
57         pygoptioncontext.c \
58         pygoptioncontext.h \
59         pygoptiongroup.c \
60         pygoptiongroup.h \
61         pygspawn.c \
62         pygspawn.h \
63         pyglib.c \
64         pyglib.h \
65         pyglib-private.h \
66         pyglib-python-compat.h \
67         gimodule.c \
68         pygi-repository.c \
69         pygi-repository.h \
70         pygi-info.c \
71         pygi-info.h \
72         pygi-foreign.c \
73         pygi-foreign.h \
74         pygi-foreign-api.h \
75         pygi-struct.c \
76         pygi-struct.h \
77         pygi-source.c \
78         pygi-source.h \
79         pygi-argument.c \
80         pygi-argument.h \
81         pygi-resulttuple.c \
82         pygi-resulttuple.h \
83         pygi-type.c \
84         pygi-type.h \
85         pygi-boxed.c \
86         pygi-boxed.h \
87         pygi-closure.c \
88         pygi-closure.h \
89         pygi-ccallback.c \
90         pygi-ccallback.h \
91         pygi.h \
92         pygi-private.h \
93         pygi-property.c \
94         pygi-property.h \
95         pygi-signal-closure.c \
96         pygi-signal-closure.h \
97         pygobject-external.h \
98         pygi-invoke.c \
99         pygi-invoke.h \
100         pygi-invoke-state-struct.h \
101         pygi-cache.h \
102         pygi-cache.c \
103         pygi-marshal-cleanup.c \
104         pygi-marshal-cleanup.h \
105         pygi-basictype.c \
106         pygi-basictype.h \
107         pygi-list.c \
108         pygi-list.h \
109         pygi-array.c \
110         pygi-array.h \
111         pygi-error.c \
112         pygi-error.h \
113         pygi-object.c \
114         pygi-object.h \
115         pygi-value.c \
116         pygi-value.h \
117         pygi-enum-marshal.c \
118         pygi-enum-marshal.h \
119         pygi-struct-marshal.c \
120         pygi-struct-marshal.h \
121         pygi-hashtable.c \
122         pygi-hashtable.h
123 _gi_la_CFLAGS = \
124         $(extension_cppflags) \
125         $(GLIB_CFLAGS) \
126         $(GI_CFLAGS)
127 _gi_la_CPPFLAGS = \
128         $(extension_cppflags)
129 _gi_la_LIBADD = \
130         $(extension_libadd) \
131         $(GLIB_LIBS) \
132         $(GI_LIBS) \
133         $(FFI_LIBS)
134 _gi_la_LDFLAGS = \
135         $(extension_ldflags) \
136         -export-symbols-regex "init_gi|PyInit__gi"
137
138 if ENABLE_CAIRO
139 pygi_LTLIBRARIES += _gi_cairo.la
140 endif
141
142 _gi_cairo_la_SOURCES = \
143         pygi-foreign-cairo.c
144 _gi_cairo_la_CFLAGS = \
145         $(GI_CFLAGS) \
146         $(CAIRO_CFLAGS) \
147         $(PYCAIRO_CFLAGS)
148 _gi_cairo_la_CPPFLAGS = \
149         $(extension_cppflags)
150 _gi_cairo_la_LIBADD = \
151         $(extension_libadd) \
152         $(GI_LIBS) \
153         $(CAIRO_LIBS) \
154         $(PYCAIRO_LIBS)
155 _gi_cairo_la_LDFLAGS = \
156         $(extension_ldflags) \
157         -export-symbols-regex "init_gi_cairo|PyInit__gi_cairo"
158
159
160 # This is to ensure we have a symlink to the .so in the
161 # build directory, which the Python interpreter can load
162 # directly without having to know how to parse .la files.
163 %$(PYTHON_SO): %.la
164         $(LN_S) -f .libs/$@ $@
165
166 all-local: $(LTLIBRARIES:.la=$(PYTHON_SO))
167
168 check-local: $(LTLIBRARIES:.la=$(PYTHON_SO))
169 clean-local:
170         rm -f $(LTLIBRARIES:.la=$(PYTHON_SO))