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