Add a test for g_atexit
[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         gmirroringtable.h       \
149         gnode.c                 \
150         goption.c               \
151         gpattern.c              \
152         gpoll.c                 \
153         gprimes.c               \
154         gqsort.c                \
155         gquark.c                \
156         gqueue.c                \
157         grand.c                 \
158         gregex.c                \
159         gscanner.c              \
160         gscripttable.h          \
161         gsequence.c             \
162         gshell.c                \
163         gslice.c                \
164         gslist.c                \
165         gstdio.c                \
166         gstrfuncs.c             \
167         gstring.c               \
168         gstringchunk.c          \
169         gtestutils.c            \
170         gthread.c               \
171         gthreadprivate.h        \
172         gthreadpool.c           \
173         gtimer.c                \
174         gtimezone.c             \
175         gtrashstack.c           \
176         gtree.c                 \
177         guniprop.c              \
178         gutf8.c                 \
179         gunibreak.h             \
180         gunibreak.c             \
181         gunichartables.h        \
182         gunicollate.c           \
183         gunicomp.h              \
184         gunidecomp.h            \
185         gunidecomp.c            \
186         gunicodeprivate.h       \
187         gurifuncs.c             \
188         gutils.c                \
189         gvariant.h              \
190         gvariant.c              \
191         gvariant-core.h         \
192         gvariant-core.c         \
193         gvariant-internal.h     \
194         gvariant-parser.c       \
195         gvariant-serialiser.h   \
196         gvariant-serialiser.c   \
197         gvarianttypeinfo.h      \
198         gvarianttypeinfo.c      \
199         gvarianttype.c          \
200         gversion.c              \
201         gwakeup.h               \
202         gwakeup.c               \
203         gprintf.c               \
204         gprintfint.h            \
205         valgrind.h
206
207 if OS_UNIX
208 libglib_2_0_la_SOURCES += glib-unix.c
209 endif
210
211 if THREADS_WIN32
212 libglib_2_0_la_SOURCES += gthread-win32.c
213 else
214 if THREADS_POSIX
215 libglib_2_0_la_SOURCES += gthread-posix.c
216 endif
217 endif
218
219 EXTRA_libglib_2_0_la_SOURCES = \
220         giounix.c       \
221         giowin32.c      \
222         gspawn.c        \
223         gspawn-win32.c  \
224         gwin32.c
225
226 glibincludedir=$(includedir)/glib-2.0
227 glibinclude_HEADERS =   \
228         glib-unix.h     \
229         glib-object.h   \
230         glib.h
231
232 deprecatedincludedir=$(includedir)/glib-2.0/glib/deprecated
233 deprecatedinclude_HEADERS = \
234         deprecated/gallocator.h         \
235         deprecated/gcache.h             \
236         deprecated/gcompletion.h        \
237         deprecated/gmain.h              \
238         deprecated/grel.h               \
239         deprecated/gthread.h
240
241 glibsubincludedir=$(includedir)/glib-2.0/glib
242 glibsubinclude_HEADERS = \
243         galloca.h       \
244         garray.h        \
245         gasyncqueue.h   \
246         gatomic.h       \
247         gbacktrace.h    \
248         gbase64.h       \
249         gbitlock.h      \
250         gbookmarkfile.h \
251         gbytes.h        \
252         gcharset.h      \
253         gchecksum.h     \
254         gconvert.h      \
255         gdataset.h      \
256         gdate.h         \
257         gdatetime.h     \
258         gdir.h          \
259         genviron.h      \
260         gerror.h        \
261         gfileutils.h    \
262         ggettext.h      \
263         ghash.h         \
264         ghmac.h         \
265         ghook.h         \
266         ghostutils.h    \
267         gi18n.h         \
268         gi18n-lib.h     \
269         giochannel.h    \
270         gkeyfile.h      \
271         glist.h         \
272         gmacros.h       \
273         gmain.h         \
274         gmappedfile.h   \
275         gmarkup.h       \
276         gmem.h          \
277         gmessages.h     \
278         gnode.h         \
279         goption.h       \
280         gpattern.h      \
281         gpoll.h         \
282         gprimes.h       \
283         gqsort.h        \
284         gquark.h        \
285         gqueue.h        \
286         grand.h         \
287         gregex.h        \
288         gscanner.h      \
289         gsequence.h     \
290         gshell.h        \
291         gslice.h        \
292         gslist.h        \
293         gspawn.h        \
294         gstdio.h        \
295         gstrfuncs.h     \
296         gtestutils.h    \
297         gstring.h       \
298         gstringchunk.h  \
299         gthread.h       \
300         gthreadpool.h   \
301         gtimer.h        \
302         gtimezone.h     \
303         gtrashstack.h   \
304         gtree.h         \
305         gtypes.h        \
306         gunicode.h      \
307         gurifuncs.h     \
308         gutils.h        \
309         gvarianttype.h  \
310         gvariant.h      \
311         gversion.h      \
312         gversionmacros.h \
313         gwin32.h        \
314         gprintf.h
315
316 # This is read by gobject-introspection/misc/ and gtk-doc
317 glib-public-headers.txt: Makefile
318         echo $(glibinclude_HEADERS) $(glibsubinclude_HEADERS) > $@.tmp && mv $@.tmp $@
319
320 CLEANFILES += glib-public-headers.txt
321
322 all-local: glib-public-headers.txt
323
324 install-data-local: install-ms-lib
325         @if test -f $(glibincludedir)/glist.h ; then                                    \
326           echo "*** Old headers found in $(glibincludedir). You should remove the" ;    \
327           echo "*** contents of this directory and type 'make install' again." ;        \
328           false ;                                                                       \
329         fi
330
331 uninstall-local: uninstall-ms-lib uninstall-gdb
332
333 if PLATFORM_WIN32
334 no_undefined = -no-undefined
335 endif
336
337 if OS_WIN32_AND_DLL_COMPILATION
338 glib_win32_res = glib-win32-res.o
339 glib_win32_res_ldflag = -Wl,$(glib_win32_res)
340 endif
341
342 if USE_SYSTEM_PCRE
343 pcre_lib = $(PCRE_LIBS)
344 pcre_inc = $(PCRE_CFLAGS)
345 else
346 pcre_lib = pcre/libpcre.la
347 pcre_inc =
348 endif
349
350 libglib_2_0_la_CFLAGS = $(AM_CFLAGS) $(GLIB_HIDDEN_VISIBILITY_CFLAGS)
351 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)
352 libglib_2_0_la_DEPENDENCIES = libcharset/libcharset.la $(printf_la) @GIO@ @GSPAWN@ @PLATFORMDEP@ $(glib_win32_res) $(glib_def)
353
354 libglib_2_0_la_LDFLAGS = $(GLIB_LINK_FLAGS) \
355          $(glib_win32_res_ldflag) \
356         -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
357         -export-dynamic $(no_undefined)
358
359 INSTALL_PROGS=
360
361 if ENABLE_DTRACE
362 DTCOMPILE = $(patsubst -W%,,$(LTCOMPILE))
363 DTCFLAGS = $(patsubst -W%,,$(CFLAGS))
364
365 glib_probes.h: glib_probes.d
366         $(AM_V_GEN) $(DTRACE) -C -h -s $< -o $@.tmp
367         @$(SED) -e "s,define STAP_HAS_SEMAPHORES 1,undef STAP_HAS_SEMAPHORES," < $@.tmp > $@ && rm -f $@.tmp
368
369 glib_probes.lo: glib_probes.d
370         $(AM_V_GEN) env CC="$(DTCOMPILE)" CFLAGS="$(DTCFLAGS)" $(DTRACE) -G -s $< -o $@
371
372 BUILT_SOURCES += glib_probes.h glib_probes.lo
373 CLEANFILES += glib_probes.h glib_probes.h.tmp
374 libglib_2_0_la_LIBADD += glib_probes.lo
375 endif
376
377 if ENABLE_SYSTEMTAP
378 tapset_in_files = glib.stp.in
379 tapsetdir   = @ABS_TAPSET_DIR@
380 tapset_DATA = $(tapset_in_files:.stp.in=.stp)
381 EXTRA_DIST += $(tapset_in_files)
382 endif
383
384 gspawn-win32-helper-console.c:
385         echo '#define HELPER_CONSOLE' >$@
386         echo '#include "gspawn-win32-helper.c"' >>$@
387
388 gspawn-win64-helper.c:
389         echo '#include "gspawn-win32-helper.c"' >$@
390
391 gspawn-win64-helper-console.c:
392         echo '#define HELPER_CONSOLE' >$@
393         echo '#include "gspawn-win32-helper.c"' >>$@
394
395
396 if OS_WIN32
397 if OS_WIN32_X64
398 INSTALL_PROGS += gspawn-win64-helper gspawn-win64-helper-console
399 gspawn_win64_helper_LDADD = libglib-2.0.la
400 gspawn_win64_helper_LDFLAGS = -mwindows
401 gspawn_win64_helper_console_LDADD = libglib-2.0.la
402 else
403 INSTALL_PROGS += gspawn-win32-helper gspawn-win32-helper-console
404 gspawn_win32_helper_LDADD = libglib-2.0.la
405 gspawn_win32_helper_LDFLAGS = -mwindows
406 gspawn_win32_helper_console_LDADD = libglib-2.0.la
407 endif
408 endif
409
410 glib-win32-res.o: glib.rc
411         $(WINDRES) glib.rc $@
412
413 bin_PROGRAMS     = ${INSTALL_PROGS}
414
415 if OS_UNIX
416
417 INSTALL_PROGS   += gtester
418 gtester_SOURCES  = gtester.c
419 gtester_LDADD    = libglib-2.0.la 
420
421 auto_config_binscripts = gtester-report
422 bin_SCRIPTS = ${auto_config_binscripts}
423 EXTRA_DIST += ${auto_config_binscripts}
424
425 CONFIGVARS = \
426         "bindir"        : "${bindir}",          \
427         "glib-version"  : "${GLIB_VERSION}"
428
429 install-exec-hook:
430         for sf in ${auto_config_binscripts} ; do \
431           mv -f "$(DESTDIR)$(bindir)/$$sf" "$(DESTDIR)$(bindir)/$$sf".tmp \
432           && sed < "$(DESTDIR)$(bindir)/$$sf".tmp > "$(DESTDIR)$(bindir)/$$sf" \
433             -e '1,24s|^ *#@PKGINSTALL_CONFIGVARS_IN24LINES@|  ${CONFIGVARS}|' \
434             -e '1,1s|#! /usr/bin/env python.*|#!${PYTHON}|' \
435           || exit $$? ; \
436           chmod a+x $(DESTDIR)$(bindir)/$$sf ; \
437           rm -f "$(DESTDIR)$(bindir)/$$sf".tmp ; \
438         done
439
440 endif
441
442 glib-2.0.lib: libglib-2.0.la glib.def
443         lib -machine:@LIB_EXE_MACHINE_FLAG@ -name:libglib-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:$(builddir)/glib.def -out:$@
444
445 dist-hook: $(BUILT_EXTRA_DIST) ../build/win32/vs9/glib.vcproj ../build/win32/vs10/glib.vcxproj ../build/win32/vs10/glib.vcxproj.filters
446         files='$(BUILT_EXTRA_DIST)'; \
447         for f in $$files; do \
448           if test -f $$f; then d=.; else d=$(srcdir); fi; \
449           cp $$d/$$f $(distdir) || exit 1; done
450
451 ../build/win32/vs9/glib.vcproj: $(top_srcdir)/build/win32/vs9/glib.vcprojin
452         for F in `echo $(libglib_2_0_la_SOURCES) | tr '/' '\\'`; do \
453                 case $$F in \
454                 *-unix.c|gthread-*.c) \
455                         ;; \
456                 *.c)    echo '   <File RelativePath="..\..\..\glib\'$$F'" />' \
457                         ;; \
458                 esac; \
459         done >libglib.sourcefiles
460         $(CPP) -P - <$(top_srcdir)/build/win32/vs9/glib.vcprojin >$@
461         rm libglib.sourcefiles
462
463 ../build/win32/vs10/glib.vcxproj: $(top_srcdir)/build/win32/vs10/glib.vcxprojin
464         for F in `echo $(libglib_2_0_la_SOURCES) | tr '/' '\\'`; do \
465                 case $$F in \
466                 *-unix.c|gthread-*.c) \
467                         ;; \
468                 *.c) echo '    <ClCompile Include="..\..\..\glib\'$$F'" />' \
469                      ;; \
470                 esac; \
471         done >libglib.vs10.sourcefiles
472         $(CPP) -P - <$(top_srcdir)/build/win32/vs10/glib.vcxprojin >$@
473         rm libglib.vs10.sourcefiles
474
475 ../build/win32/vs10/glib.vcxproj.filters: $(top_srcdir)/build/win32/vs10/glib.vcxproj.filtersin
476         for F in `echo $(libglib_2_0_la_SOURCES) | tr '/' '\\'`; do \
477                 case $$F in \
478                 *-unix.c|gthread-*.c) \
479                         ;; \
480                 *.c) echo '    <ClCompile Include="..\..\..\glib\'$$F'"><Filter>Source Files</Filter></ClCompile>' \
481                      ;; \
482                 esac; \
483         done >libglib.vs10.sourcefiles.filters
484         $(CPP) -P - <$(top_srcdir)/build/win32/vs10/glib.vcxproj.filtersin >$@  
485         rm libglib.vs10.sourcefiles.filters
486
487 # install gdb scripts
488 gdbdir = $(datadir)/glib-2.0/gdb
489 dist_gdb_SCRIPTS = glib.py
490
491 libglib-gdb.py: libglib-gdb.py.in
492         $(AM_V_GEN) $(SED) -e "s|\@datadir\@|$(datadir)|" $(srcdir)/libglib-gdb.py.in > $(builddir)/libglib-gdb.py
493
494
495 install-data-hook: libglib-gdb.py
496         mkdir -p $(DESTDIR)$(datadir)/gdb/auto-load$(ABS_GLIB_RUNTIME_LIBDIR)
497         $(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
498 if HAVE_GLIB_RUNTIME_LIBDIR
499         mkdir -p $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
500         mv $(DESTDIR)$(libdir)/libglib-2.0.so.0 $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
501         mv $(DESTDIR)$(libdir)/libglib-2.0.so.0.$(LT_CURRENT).$(LT_REVISION) $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
502         rm -f $(DESTDIR)$(libdir)/libglib-2.0.so
503         ln -s $(GLIB_RUNTIME_LIBDIR)/libglib-2.0.so.0.$(LT_CURRENT).$(LT_REVISION) $(DESTDIR)$(libdir)/libglib-2.0.so
504 endif
505
506 uninstall-gdb:
507         -rm -r $(DESTDIR)$(datadir)/gdb