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