Use g_timeout_add_seconds for some long timeouts
[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 BUILT_SOURCES =
5 DISTCLEANFILES =
6 CLEANFILES =
7
8 #
9 # Generate glibconfig.h
10 #
11 # The timestamp of the stamp file is used to indicate if glibconfig.h is
12 # up to date with respect to config.status.  In the usual case, changes
13 # to config.status will not result in changes to glibconfig.h so we
14 # avoid touching its timestamp (in order not to rebuild the whole tree).
15 #
16 DISTCLEANFILES += glibconfig-stamp glibconfig.h
17 BUILT_SOURCES += glibconfig-stamp
18 configexecincludedir = $(libdir)/glib-2.0/include
19 nodist_configexecinclude_HEADERS = glibconfig.h
20 glibconfig-stamp: ../config.status
21         $(AM_V_GEN) cd $(top_builddir) && \
22           $(SHELL) ./config.status glib/glibconfig.h
23         @touch glibconfig-stamp
24
25
26
27 if HAVE_GOOD_PRINTF
28 else
29 PRINTF_SUBDIR = gnulib
30 printf_la = gnulib/libgnulib.la
31 endif 
32
33 if USE_SYSTEM_PCRE
34 else
35 MAYBE_PCRE = pcre 
36 endif
37
38 SUBDIRS = libcharset $(PRINTF_SUBDIR) $(MAYBE_PCRE) update-pcre .
39 DIST_SUBDIRS = libcharset gnulib pcre update-pcre tests
40 if BUILD_MODULAR_TESTS
41 SUBDIRS += tests 
42 endif
43
44 AM_CPPFLAGS =                           \
45         $(glib_INCLUDES)                \
46         $(pcre_inc)                     \
47         -DG_LOG_DOMAIN=\"GLib\"         \
48         $(GLIB_DEBUG_FLAGS)             \
49         -DGLIB_COMPILATION              \
50         -DPCRE_STATIC
51
52 MIRRORING_TAB_SOURCE =                          \
53         glib-mirroring-tab/Makefile             \
54         glib-mirroring-tab/gen-mirroring-tab.c  \
55         glib-mirroring-tab/packtab.h            \
56         glib-mirroring-tab/packtab.c
57
58 # The compilation of GRegex can be disabled, but the source files must
59 # be distributed.
60 EXTRA_DIST +=                   \
61         makefile.msc.in         \
62         glib.rc.in              \
63         gen-iswide-table.py     \
64         gen-unicode-tables.pl   \
65         gen-script-table.pl     \
66         glibconfig.h.win32.in   \
67         gregex.c                \
68         gregex.h                \
69         win_iconv.c             \
70         libglib-gdb.py.in       \
71         docs.c                  \
72         gconstructor.h          \
73         $(MIRRORING_TAB_SOURCE)
74
75 CLEANFILES += libglib-gdb.py
76
77 # These may be in the builddir too
78 BUILT_EXTRA_DIST =              \
79         makefile.msc            \
80         glibconfig.h.win32      \
81         glib.rc
82
83 lib_LTLIBRARIES = libglib-2.0.la
84
85 if OS_WIN32_AND_DLL_COMPILATION
86 if MS_LIB_AVAILABLE
87 noinst_DATA = glib-2.0.lib
88
89 install_ms_lib_cmd = $(INSTALL) glib-2.0.lib $(DESTDIR)$(libdir)
90 uninstall_ms_lib_cmd = -rm $(DESTDIR)$(libdir)/glib-2.0.lib
91 endif
92 endif
93
94 install-ms-lib:
95         $(install_ms_lib_cmd)
96
97 uninstall-ms-lib:
98         $(uninstall_ms_lib_cmd)
99
100 deprecated_sources = \
101         deprecated/gallocator.c         \
102         deprecated/gcache.c             \
103         deprecated/gcompletion.c        \
104         deprecated/grel.c               \
105         deprecated/gthread-deprecated.c
106
107 libglib_2_0_la_SOURCES =        \
108         $(deprecated_sources)   \
109         glib_probes.d           \
110         garray.c                \
111         gasyncqueue.c           \
112         gasyncqueueprivate.h    \
113         gatomic.c               \
114         gbacktrace.c            \
115         gbase64.c               \
116         gbitlock.c              \
117         gbookmarkfile.c         \
118         gbsearcharray.h         \
119         gbytes.c                \
120         gbytes.h                \
121         gcharset.c              \
122         gcharsetprivate.h       \
123         gchecksum.c             \
124         gconvert.c              \
125         gdataset.c              \
126         gdatasetprivate.h       \
127         gdate.c                 \
128         gdatetime.c             \
129         gdir.c                  \
130         genviron.c              \
131         gerror.c                \
132         gfileutils.c            \
133         ggettext.c              \
134         ghash.c                 \
135         ghmac.c                 \
136         ghook.c                 \
137         ghostutils.c            \
138         giochannel.c            \
139         gkeyfile.c              \
140         glibintl.h              \
141         glib_trace.h            \
142         glib-init.h             \
143         glib-init.c             \
144         glib-private.h          \
145         glib-private.c          \
146         glist.c                 \
147         gmain-internal.h        \
148         gmain.c                 \
149         gmappedfile.c           \
150         gmarkup.c               \
151         gmem.c                  \
152         gmessages.c             \
153         gmirroringtable.h       \
154         gnode.c                 \
155         goption.c               \
156         gpattern.c              \
157         gpoll.c                 \
158         gprimes.c               \
159         gqsort.c                \
160         gquark.c                \
161         gqueue.c                \
162         grand.c                 \
163         gregex.c                \
164         gscanner.c              \
165         gscripttable.h          \
166         gsequence.c             \
167         gshell.c                \
168         gslice.c                \
169         gslist.c                \
170         gstdio.c                \
171         gstrfuncs.c             \
172         gstring.c               \
173         gstringchunk.c          \
174         gtestutils.c            \
175         gthread.c               \
176         gthreadprivate.h        \
177         gthreadpool.c           \
178         gtimer.c                \
179         gtimezone.c             \
180         gtrashstack.c           \
181         gtree.c                 \
182         guniprop.c              \
183         gutf8.c                 \
184         gunibreak.h             \
185         gunibreak.c             \
186         gunichartables.h        \
187         gunicollate.c           \
188         gunicomp.h              \
189         gunidecomp.h            \
190         gunidecomp.c            \
191         gunicodeprivate.h       \
192         gurifuncs.c             \
193         gutils.c                \
194         gvariant.h              \
195         gvariant.c              \
196         gvariant-core.h         \
197         gvariant-core.c         \
198         gvariant-internal.h     \
199         gvariant-parser.c       \
200         gvariant-serialiser.h   \
201         gvariant-serialiser.c   \
202         gvarianttypeinfo.h      \
203         gvarianttypeinfo.c      \
204         gvarianttype.c          \
205         gversion.c              \
206         gwakeup.h               \
207         gwakeup.c               \
208         gprintf.c               \
209         gprintfint.h
210
211 if OS_UNIX
212 libglib_2_0_la_SOURCES += glib-unix.c
213 endif
214
215 if OS_WIN32
216 libglib_2_0_la_SOURCES += gthread-win32.c
217 else
218 libglib_2_0_la_SOURCES += gthread-posix.c
219 endif
220
221 EXTRA_libglib_2_0_la_SOURCES = \
222         giounix.c       \
223         giowin32.c      \
224         gspawn.c        \
225         gspawn-win32.c  \
226         gwin32.c
227
228 glibincludedir=$(includedir)/glib-2.0
229 glibinclude_HEADERS =   \
230         glib-unix.h     \
231         glib-object.h   \
232         glib.h
233
234 deprecatedincludedir=$(includedir)/glib-2.0/glib/deprecated
235 deprecatedinclude_HEADERS = \
236         deprecated/gallocator.h         \
237         deprecated/gcache.h             \
238         deprecated/gcompletion.h        \
239         deprecated/gmain.h              \
240         deprecated/grel.h               \
241         deprecated/gthread.h
242
243 glibsubincludedir=$(includedir)/glib-2.0/glib
244 glibsubinclude_HEADERS = \
245         galloca.h       \
246         garray.h        \
247         gasyncqueue.h   \
248         gatomic.h       \
249         gbacktrace.h    \
250         gbase64.h       \
251         gbitlock.h      \
252         gbookmarkfile.h \
253         gbytes.h        \
254         gcharset.h      \
255         gchecksum.h     \
256         gconvert.h      \
257         gdataset.h      \
258         gdate.h         \
259         gdatetime.h     \
260         gdir.h          \
261         genviron.h      \
262         gerror.h        \
263         gfileutils.h    \
264         ggettext.h      \
265         ghash.h         \
266         ghmac.h         \
267         ghook.h         \
268         ghostutils.h    \
269         gi18n.h         \
270         gi18n-lib.h     \
271         giochannel.h    \
272         gkeyfile.h      \
273         glist.h         \
274         gmacros.h       \
275         gmain.h         \
276         gmappedfile.h   \
277         gmarkup.h       \
278         gmem.h          \
279         gmessages.h     \
280         gnode.h         \
281         goption.h       \
282         gpattern.h      \
283         gpoll.h         \
284         gprimes.h       \
285         gqsort.h        \
286         gquark.h        \
287         gqueue.h        \
288         grand.h         \
289         gregex.h        \
290         gscanner.h      \
291         gsequence.h     \
292         gshell.h        \
293         gslice.h        \
294         gslist.h        \
295         gspawn.h        \
296         gstdio.h        \
297         gstrfuncs.h     \
298         gtestutils.h    \
299         gstring.h       \
300         gstringchunk.h  \
301         gthread.h       \
302         gthreadpool.h   \
303         gtimer.h        \
304         gtimezone.h     \
305         gtrashstack.h   \
306         gtree.h         \
307         gtypes.h        \
308         gunicode.h      \
309         gurifuncs.h     \
310         gutils.h        \
311         gvarianttype.h  \
312         gvariant.h      \
313         gversion.h      \
314         gversionmacros.h \
315         gwin32.h        \
316         gprintf.h
317
318 # This is read by gobject-introspection/misc/ and gtk-doc
319 glib-public-headers.txt: Makefile
320         echo $(glibinclude_HEADERS) $(glibsubinclude_HEADERS) > $@.tmp && mv $@.tmp $@
321
322 CLEANFILES += glib-public-headers.txt
323
324 all-local: glib-public-headers.txt
325
326 install-data-local: install-ms-lib
327         @if test -f $(glibincludedir)/glist.h ; then                                    \
328           echo "*** Old headers found in $(glibincludedir). You should remove the" ;    \
329           echo "*** contents of this directory and type 'make install' again." ;        \
330           false ;                                                                       \
331         fi
332
333 uninstall-local: uninstall-ms-lib uninstall-gdb
334
335 if PLATFORM_WIN32
336 no_undefined = -no-undefined
337 endif
338
339 if OS_WIN32_AND_DLL_COMPILATION
340 glib_win32_res = glib-win32-res.o
341 glib_win32_res_ldflag = -Wl,$(glib_win32_res)
342 endif
343
344 if USE_SYSTEM_PCRE
345 pcre_lib = $(PCRE_LIBS)
346 pcre_inc = $(PCRE_CFLAGS)
347 else
348 pcre_lib = pcre/libpcre.la
349 pcre_inc =
350 endif
351
352 libglib_2_0_la_CFLAGS = $(AM_CFLAGS) $(GLIB_HIDDEN_VISIBILITY_CFLAGS)
353 libglib_2_0_la_LIBADD = libcharset/libcharset.la $(printf_la) @GIO@ @GSPAWN@ @PLATFORMDEP@ @ICONV_LIBS@ @G_LIBS_EXTRA@ $(pcre_lib) $(G_THREAD_LIBS_EXTRA) $(G_THREAD_LIBS_FOR_GTHREAD)
354 libglib_2_0_la_DEPENDENCIES = libcharset/libcharset.la $(printf_la) @GIO@ @GSPAWN@ @PLATFORMDEP@ $(glib_win32_res) $(glib_def)
355
356 libglib_2_0_la_LDFLAGS = $(GLIB_LINK_FLAGS) \
357          $(glib_win32_res_ldflag) \
358         -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
359         -export-dynamic $(no_undefined)
360
361 INSTALL_PROGS=
362
363 if ENABLE_DTRACE
364 glib_probes.h: glib_probes.d Makefile
365         $(AM_V_GEN) $(DTRACE) -C -h -s $< -o $@.tmp
366         @$(SED) -e "s,define STAP_HAS_SEMAPHORES 1,undef STAP_HAS_SEMAPHORES," < $@.tmp > $@ && rm -f $@.tmp
367 glib_probes.o: glib_probes.d Makefile
368         $(AM_V_GEN) $(DTRACE) -G -s $< -o $@
369 BUILT_SOURCES += glib_probes.h glib_probes.o
370 CLEANFILES += glib_probes.h glib_probes.h.tmp
371 libglib_2_0_la_LIBADD += glib_probes.o
372 endif
373
374 if ENABLE_SYSTEMTAP
375 tapset_in_files = glib.stp.in
376 tapsetdir   = @ABS_TAPSET_DIR@
377 tapset_DATA = $(tapset_in_files:.stp.in=.stp)
378 EXTRA_DIST += $(tapset_in_files)
379 endif
380
381 gspawn-win32-helper-console.c:
382         echo '#define HELPER_CONSOLE' >$@
383         echo '#include "gspawn-win32-helper.c"' >>$@
384
385 gspawn-win64-helper.c:
386         echo '#include "gspawn-win32-helper.c"' >$@
387
388 gspawn-win64-helper-console.c:
389         echo '#define HELPER_CONSOLE' >$@
390         echo '#include "gspawn-win32-helper.c"' >>$@
391
392
393 if OS_WIN32
394 if OS_WIN32_X64
395 INSTALL_PROGS += gspawn-win64-helper gspawn-win64-helper-console
396 gspawn_win64_helper_LDADD = libglib-2.0.la
397 gspawn_win64_helper_LDFLAGS = -mwindows
398 gspawn_win64_helper_console_LDADD = libglib-2.0.la
399 else
400 INSTALL_PROGS += gspawn-win32-helper gspawn-win32-helper-console
401 gspawn_win32_helper_LDADD = libglib-2.0.la
402 gspawn_win32_helper_LDFLAGS = -mwindows
403 gspawn_win32_helper_console_LDADD = libglib-2.0.la
404 endif
405 endif
406
407 glib-win32-res.o: glib.rc
408         $(WINDRES) glib.rc $@
409
410 bin_PROGRAMS     = ${INSTALL_PROGS}
411
412 if OS_UNIX
413
414 INSTALL_PROGS   += gtester
415 gtester_SOURCES  = gtester.c
416 gtester_LDADD    = libglib-2.0.la 
417
418 auto_config_binscripts = gtester-report
419 bin_SCRIPTS = ${auto_config_binscripts}
420 EXTRA_DIST += ${auto_config_binscripts}
421
422 CONFIGVARS = \
423         "bindir"        : "${bindir}",          \
424         "glib-version"  : "${GLIB_VERSION}"
425
426 install-exec-hook:
427         for sf in ${auto_config_binscripts} ; do \
428           mv -f "$(DESTDIR)$(bindir)/$$sf" "$(DESTDIR)$(bindir)/$$sf".tmp \
429           && sed < "$(DESTDIR)$(bindir)/$$sf".tmp > "$(DESTDIR)$(bindir)/$$sf" \
430             -e '1,24s|^ *#@PKGINSTALL_CONFIGVARS_IN24LINES@|  ${CONFIGVARS}|' \
431             -e '1,1s|#! /usr/bin/env python\([0-9]\+\(\.[0-9]\+\)\?\)\?|#!${PYTHON}|' \
432           || exit $$? ; \
433           chmod a+x $(DESTDIR)$(bindir)/$$sf ; \
434           rm -f "$(DESTDIR)$(bindir)/$$sf".tmp ; \
435         done
436
437 endif
438
439 glib-2.0.lib: libglib-2.0.la glib.def
440         lib -machine:@LIB_EXE_MACHINE_FLAG@ -name:libglib-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:$(builddir)/glib.def -out:$@
441
442 dist-hook: $(BUILT_EXTRA_DIST) ../build/win32/vs9/glib.vcproj ../build/win32/vs10/glib.vcxproj ../build/win32/vs10/glib.vcxproj.filters
443         files='$(BUILT_EXTRA_DIST)'; \
444         for f in $$files; do \
445           if test -f $$f; then d=.; else d=$(srcdir); fi; \
446           cp $$d/$$f $(distdir) || exit 1; done
447
448 ../build/win32/vs9/glib.vcproj: $(top_srcdir)/build/win32/vs9/glib.vcprojin
449         for F in `echo $(libglib_2_0_la_SOURCES) | tr '/' '\\'`; do \
450                 case $$F in \
451                 *-unix.c|gthread-*.c) \
452                         ;; \
453                 *.c)    echo '   <File RelativePath="..\..\..\glib\'$$F'" />' \
454                         ;; \
455                 esac; \
456         done >libglib.sourcefiles
457         $(CPP) -P - <$(top_srcdir)/build/win32/vs9/glib.vcprojin >$@
458         rm libglib.sourcefiles
459
460 ../build/win32/vs10/glib.vcxproj: $(top_srcdir)/build/win32/vs10/glib.vcxprojin
461         for F in `echo $(libglib_2_0_la_SOURCES) | tr '/' '\\'`; do \
462                 case $$F in \
463                 *-unix.c|gthread-*.c) \
464                         ;; \
465                 *.c) echo '    <ClCompile Include="..\..\..\glib\'$$F'" />' \
466                      ;; \
467                 esac; \
468         done >libglib.vs10.sourcefiles
469         $(CPP) -P - <$(top_srcdir)/build/win32/vs10/glib.vcxprojin >$@
470         rm libglib.vs10.sourcefiles
471
472 ../build/win32/vs10/glib.vcxproj.filters: $(top_srcdir)/build/win32/vs10/glib.vcxproj.filtersin
473         for F in `echo $(libglib_2_0_la_SOURCES) | tr '/' '\\'`; do \
474                 case $$F in \
475                 *-unix.c|gthread-*.c) \
476                         ;; \
477                 *.c) echo '    <ClCompile Include="..\..\..\glib\'$$F'"><Filter>Source Files</Filter></ClCompile>' \
478                      ;; \
479                 esac; \
480         done >libglib.vs10.sourcefiles.filters
481         $(CPP) -P - <$(top_srcdir)/build/win32/vs10/glib.vcxproj.filtersin >$@  
482         rm libglib.vs10.sourcefiles.filters
483
484 # install gdb scripts
485 gdbdir = $(datadir)/glib-2.0/gdb
486 dist_gdb_SCRIPTS = glib.py
487
488 libglib-gdb.py: libglib-gdb.py.in
489         $(AM_V_GEN) $(SED) -e "s|\@datadir\@|$(datadir)|" $(srcdir)/libglib-gdb.py.in > $(builddir)/libglib-gdb.py
490
491
492 install-data-hook: libglib-gdb.py
493         mkdir -p $(DESTDIR)$(datadir)/gdb/auto-load$(ABS_GLIB_RUNTIME_LIBDIR)
494         $(INSTALL) $(builddir)/libglib-gdb.py $(DESTDIR)$(datadir)/gdb/auto-load$(ABS_GLIB_RUNTIME_LIBDIR)/libglib-2.0.so.0.$(LT_CURRENT).$(LT_REVISION)-gdb.py
495 if HAVE_GLIB_RUNTIME_LIBDIR
496         mkdir -p $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
497         mv $(DESTDIR)$(libdir)/libglib-2.0.so.0 $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
498         mv $(DESTDIR)$(libdir)/libglib-2.0.so.0.$(LT_CURRENT).$(LT_REVISION) $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
499         rm -f $(DESTDIR)$(libdir)/libglib-2.0.so
500         ln -s $(GLIB_RUNTIME_LIBDIR)/libglib-2.0.so.0.$(LT_CURRENT).$(LT_REVISION) $(DESTDIR)$(libdir)/libglib-2.0.so
501 endif
502
503 uninstall-gdb:
504         -rm -r $(DESTDIR)$(datadir)/gdb