Bug 586675 – Runtime library location
[platform/upstream/glib.git] / glib / Makefile.am
1 ## Process this file with automake to produce Makefile.in
2 include $(top_srcdir)/Makefile.decl
3
4 if HAVE_GOOD_PRINTF
5 else
6 PRINTF_SUBDIR = gnulib
7 printf_la = gnulib/libgnulib.la
8 endif 
9
10 if ENABLE_REGEX
11 if USE_SYSTEM_PCRE
12 else
13 MAYBE_PCRE = pcre 
14 endif
15 gregex_c = gregex.c
16 gregex_h = gregex.h
17 else
18 gregex_c =
19 gregex_h =
20 endif
21
22 SUBDIRS = libcharset $(PRINTF_SUBDIR) $(MAYBE_PCRE) update-pcre . tests
23
24 DIST_SUBDIRS = libcharset gnulib pcre update-pcre tests
25
26 AM_CPPFLAGS =                           \
27         -I$(top_srcdir)                 \
28         $(pcre_inc)                     \
29         -DG_LOG_DOMAIN=\"GLib\"         \
30         $(GLIB_DEBUG_FLAGS)             \
31         -DG_DISABLE_DEPRECATED          \
32         -DGLIB_COMPILATION              \
33         -DPCRE_STATIC
34
35 glib.def: glib.symbols
36         (echo -e EXPORTS; $(CPP) -P -DINCLUDE_VARIABLES -DINCLUDE_INTERNAL_SYMBOLS -DG_OS_WIN32 -DALL_FILES - <$(srcdir)/glib.symbols | sed -e '/^$$/d' -e 's/^/        /' -e 's/G_GNUC_[^ ]*//g') > glib.def
37
38 galias.h: glib.symbols
39           $(PERL) $(srcdir)/makegalias.pl < $(srcdir)/glib.symbols > galias.h
40
41 galiasdef.c: glib.symbols
42           $(PERL) $(srcdir)/makegalias.pl -def < $(srcdir)/glib.symbols > galiasdef.c
43
44 if OS_LINUX
45 if HAVE_GNUC_VISIBILITY
46 TESTS_ENVIRONMENT = GLIB_DEBUG_FLAGS="$(GLIB_DEBUG_FLAGS)"
47 TESTS = abicheck.sh pltcheck.sh
48 endif
49 endif
50
51 BUILT_SOURCES = galias.h galiasdef.c
52
53 MIRRORING_TAB_SOURCE =                          \
54         glib-mirroring-tab/Makefile             \
55         glib-mirroring-tab/gen-mirroring-tab.c  \
56         glib-mirroring-tab/packtab.h            \
57         glib-mirroring-tab/packtab.c
58
59 # The compilation of GRegex can be disabled, but the source files must
60 # be distributed.
61 EXTRA_DIST +=                   \
62         makefile.msc.in         \
63         glib.rc.in              \
64         gen-unicode-tables.pl   \
65         gen-script-table.pl     \
66         makegalias.pl           \
67         abicheck.sh             \
68         pltcheck.sh             \
69         glib.symbols            \
70         gregex.c                \
71         gregex.h                \
72         win_iconv.c             \
73         $(MIRRORING_TAB_SOURCE)
74
75 # These may be in the builddir too
76 BUILT_EXTRA_DIST =              \
77         makefile.msc            \
78         glib.rc                 \
79         galias.h                \
80         galiasdef.c
81
82 lib_LTLIBRARIES = libglib-2.0.la
83
84 if OS_WIN32_AND_DLL_COMPILATION
85 if MS_LIB_AVAILABLE
86 noinst_DATA = glib-2.0.lib
87
88 install_ms_lib_cmd = $(INSTALL) glib-2.0.lib $(DESTDIR)$(libdir)
89 uninstall_ms_lib_cmd = -rm $(DESTDIR)$(libdir)/glib-2.0.lib
90 endif
91 endif
92
93 install-ms-lib:
94         $(install_ms_lib_cmd)
95
96 uninstall-ms-lib:
97         $(uninstall_ms_lib_cmd)
98
99 libglib_2_0_la_SOURCES =        \
100         garray.c                \
101         gasyncqueue.c           \
102         gatomic.c               \
103         gbacktrace.c            \
104         gbase64.c               \
105         gbookmarkfile.c         \
106         gbsearcharray.h         \
107         gcache.c                \
108         gchecksum.c             \
109         gcompletion.c           \
110         gconvert.c              \
111         gdataset.c              \
112         gdatasetprivate.h       \
113         gdate.c                 \
114         gdir.c                  \
115         gerror.c                \
116         gfileutils.c            \
117         ghash.c                 \
118         ghook.c                 \
119         ghostutils.c            \
120         giochannel.c            \
121         gkeyfile.c              \
122         glibintl.h              \
123         glist.c                 \
124         gmain.c                 \
125         gmappedfile.c           \
126         gmarkup.c               \
127         gmem.c                  \
128         gmessages.c             \
129         gmirroringtable.h       \
130         gnode.c                 \
131         goption.c               \
132         gpattern.c              \
133         gpoll.c                 \
134         gprimes.c               \
135         gqsort.c                \
136         gqueue.c                \
137         grel.c                  \
138         grand.c                 \
139         $(gregex_c)             \
140         gscanner.c              \
141         gscripttable.h          \
142         gsequence.c             \
143         gshell.c                \
144         gslice.c                \
145         gslist.c                \
146         gstdio.c                \
147         gstrfuncs.c             \
148         gstring.c               \
149         gtestutils.c            \
150         gthread.c               \
151         gthreadprivate.h        \
152         gthreadpool.c           \
153         gtimer.c                \
154         gtree.c                 \
155         guniprop.c              \
156         gutf8.c                 \
157         gunibreak.h             \
158         gunibreak.c             \
159         gunichartables.h        \
160         gunicollate.c           \
161         gunicomp.h              \
162         gunidecomp.h            \
163         gunidecomp.c            \
164         gunicodeprivate.h       \
165         gurifuncs.c             \
166         gutils.c                \
167         gdebug.h                \
168         gprintf.c               \
169         gprintfint.h
170
171 EXTRA_libglib_2_0_la_SOURCES = \
172         giounix.c       \
173         giowin32.c      \
174         gspawn.c        \
175         gspawn-win32.c  \
176         gwin32.c
177
178 glibincludedir=$(includedir)/glib-2.0
179 glibinclude_HEADERS =   \
180         glib-object.h   \
181         glib.h
182
183 glibsubincludedir=$(includedir)/glib-2.0/glib
184 glibsubinclude_HEADERS =   \
185         galloca.h       \
186         garray.h        \
187         gasyncqueue.h   \
188         gatomic.h       \
189         gbacktrace.h    \
190         gbase64.h       \
191         gbookmarkfile.h \
192         gcache.h        \
193         gchecksum.h     \
194         gcompletion.h   \
195         gconvert.h      \
196         gdataset.h      \
197         gdate.h         \
198         gdir.h          \
199         gerror.h        \
200         gfileutils.h    \
201         ghash.h         \
202         ghook.h         \
203         ghostutils.h    \
204         gi18n.h         \
205         gi18n-lib.h     \
206         giochannel.h    \
207         gkeyfile.h      \
208         glist.h         \
209         gmacros.h       \
210         gmain.h         \
211         gmappedfile.h   \
212         gmarkup.h       \
213         gmem.h          \
214         gmessages.h     \
215         gnode.h         \
216         goption.h       \
217         gpattern.h      \
218         gpoll.h         \
219         gprimes.h       \
220         gqsort.h        \
221         gquark.h        \
222         gqueue.h        \
223         grand.h         \
224         $(gregex_h)     \
225         grel.h          \
226         gscanner.h      \
227         gsequence.h     \
228         gshell.h        \
229         gslice.h        \
230         gslist.h        \
231         gspawn.h        \
232         gstdio.h        \
233         gstrfuncs.h     \
234         gtestutils.h    \
235         gstring.h       \
236         gthread.h       \
237         gthreadpool.h   \
238         gtimer.h        \
239         gtree.h         \
240         gtypes.h        \
241         gunicode.h      \
242         gurifuncs.h             \
243         gutils.h        \
244         gwin32.h        \
245         gprintf.h
246
247 install-data-local: install-ms-lib install-def-file
248         @if test -f $(glibincludedir)/glist.h ; then                                    \
249           echo "*** Old headers found in $(glibincludedir). You should remove the" ;    \
250           echo "*** contents of this directory and type 'make install' again." ;        \
251           false ;                                                                       \
252         fi
253
254 uninstall-local: uninstall-ms-lib uninstall-def-file
255
256 if PLATFORM_WIN32
257 no_undefined = -no-undefined
258 endif
259
260 if OS_WIN32_AND_DLL_COMPILATION
261 export_symbols = -export-symbols glib.def
262
263 glib_win32_res = glib-win32-res.o
264 glib_win32_res_ldflag = -Wl,$(glib_win32_res)
265
266 glib_def = glib.def
267
268 install-def-file:
269         $(INSTALL) glib.def $(DESTDIR)$(libdir)/glib-2.0.def
270
271 uninstall-def-file:
272         -rm $(DESTDIR)$(libdir)/glib-2.0.def
273 else
274 install-def-file:
275 uninstall-def-file:
276
277 export_symbols = $(LIBTOOL_EXPORT_OPTIONS)
278 endif
279
280 if ENABLE_REGEX
281 if USE_SYSTEM_PCRE
282 pcre_lib = $(PCRE_LIBS)
283 pcre_inc = $(PCRE_CFLAGS)
284 else
285 pcre_lib = pcre/libpcre.la
286 pcre_inc =
287 endif
288 else
289 pcre_lib =
290 pcre_inc =
291 endif
292
293 libglib_2_0_la_LIBADD = libcharset/libcharset.la $(printf_la) @GIO@ @GSPAWN@ @PLATFORMDEP@ @ICONV_LIBS@ @G_LIBS_EXTRA@ $(pcre_lib)
294 libglib_2_0_la_DEPENDENCIES = libcharset/libcharset.la $(printf_la) @GIO@ @GSPAWN@ @PLATFORMDEP@ $(glib_win32_res) $(glib_def)
295
296 libglib_2_0_la_LDFLAGS = \
297          $(glib_win32_res_ldflag) \
298         -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
299         -export-dynamic $(no_undefined) $(export_symbols)
300
301 INSTALL_PROGS=
302
303 gspawn-win32-helper-console.c:
304         echo '#define HELPER_CONSOLE' >$@
305         echo '#include "gspawn-win32-helper.c"' >>$@
306
307 gspawn-win64-helper.c:
308         echo '#include "gspawn-win32-helper.c"' >$@
309
310 gspawn-win64-helper-console.c:
311         echo '#define HELPER_CONSOLE' >$@
312         echo '#include "gspawn-win32-helper.c"' >>$@
313
314 if OS_WIN32
315 if OS_WIN32_X64
316 INSTALL_PROGS += gspawn-win64-helper gspawn-win64-helper-console
317 gspawn_win64_helper_LDADD = libglib-2.0.la
318 gspawn_win64_helper_LDFLAGS = -mwindows
319 gspawn_win64_helper_console_LDADD = libglib-2.0.la
320 else
321 INSTALL_PROGS += gspawn-win32-helper gspawn-win32-helper-console
322 gspawn_win32_helper_LDADD = libglib-2.0.la
323 gspawn_win32_helper_LDFLAGS = -mwindows
324 gspawn_win32_helper_console_LDADD = libglib-2.0.la
325 endif
326 endif
327
328 glib-win32-res.o: glib.rc
329         $(WINDRES) glib.rc $@
330
331 bin_PROGRAMS     = ${INSTALL_PROGS}
332
333 if OS_UNIX
334
335 INSTALL_PROGS   += gtester
336 gtester_SOURCES  = gtester.c
337 gtester_LDADD    = libglib-2.0.la 
338
339 auto_config_binscripts = gtester-report
340 bin_SCRIPTS = ${auto_config_binscripts}
341 EXTRA_DIST += ${auto_config_binscripts}
342
343 CONFIGVARS = \
344         "bindir"        : "${bindir}",          \
345         "glib-version"  : "${GLIB_VERSION}"
346
347 install-exec-hook:
348         for sf in ${auto_config_binscripts} ; do \
349           mv -f "$(DESTDIR)$(bindir)/$$sf" "$(DESTDIR)$(bindir)/$$sf".tmp \
350           && sed < "$(DESTDIR)$(bindir)/$$sf".tmp > "$(DESTDIR)$(bindir)/$$sf" \
351             -e '1,24s|^ *#@PKGINSTALL_CONFIGVARS_IN24LINES@|  ${CONFIGVARS}|' \
352             -e '1,1s|#! /usr/bin/env python\([0-9]\+\(\.[0-9]\+\)\?\)\?|#!${PYTHON}|' \
353           || exit $$? ; \
354           rm -f "$(DESTDIR)$(bindir)/$$sf".tmp ; \
355         done
356
357 endif
358
359 glib-2.0.lib: libglib-2.0.la glib.def
360         lib -machine:@LIB_EXE_MACHINE_FLAG@ -name:libglib-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:glib.def -out:$@
361
362 dist-hook: $(BUILT_EXTRA_DIST)
363         files='$(BUILT_EXTRA_DIST)'; \
364         for f in $$files; do \
365           if test -f $$f; then d=.; else d=$(srcdir); fi; \
366           cp $$d/$$f $(distdir) || exit 1; done
367
368 if HAVE_GLIB_RUNTIME_LIBDIR
369 install-data-hook:
370         mkdir -p $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
371         mv $(DESTDIR)$(libdir)/libglib-2.0.so.0 $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
372         mv $(DESTDIR)$(libdir)/libglib-2.0.so.0.$(LT_CURRENT).0 $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
373         rm -f $(DESTDIR)$(libdir)/libglib-2.0.so
374         ln -s $(GLIB_RUNTIME_LIBDIR)/libglib-2.0.so.0.$(LT_CURRENT).0 $(DESTDIR)$(libdir)/libglib-2.0.so
375 endif