Move the GThread implementations to glib/
[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         garray.c                \
117         gasyncqueue.c           \
118         gatomic.c               \
119         gbacktrace.c            \
120         gbase64.c               \
121         gbitlock.c              \
122         gbookmarkfile.c         \
123         gbsearcharray.h         \
124         gbuffer.c               \
125         gbufferprivate.h        \
126         gcache.c                \
127         gchecksum.c             \
128         gcompletion.c           \
129         gconvert.c              \
130         gdataset.c              \
131         gdatasetprivate.h       \
132         gdate.c                 \
133         gdatetime.c             \
134         gdir.c                  \
135         gerror.c                \
136         gfileutils.c            \
137         ghash.c                 \
138         ghmac.c                 \
139         ghook.c                 \
140         ghostutils.c            \
141         giochannel.c            \
142         gkeyfile.c              \
143         glibintl.h              \
144         glib_trace.h            \
145         glist.c                 \
146         gmain-internal.h        \
147         gmain.c                 \
148         gmappedfile.c           \
149         gmarkup.c               \
150         gmem.c                  \
151         gmessages.c             \
152         gmirroringtable.h       \
153         gnode.c                 \
154         goption.c               \
155         gpattern.c              \
156         gpoll.c                 \
157         gprimes.c               \
158         gqsort.c                \
159         gqueue.c                \
160         grel.c                  \
161         grand.c                 \
162         $(gregex_c)             \
163         gscanner.c              \
164         gscripttable.h          \
165         gsequence.c             \
166         gshell.c                \
167         gslice.c                \
168         gslist.c                \
169         gstdio.c                \
170         gstrfuncs.c             \
171         gstring.c               \
172         gtestutils.c            \
173         gthread.c               \
174         gthreadprivate.h        \
175         gthreadpool.c           \
176         gtimer.c                \
177         gtimezone.c             \
178         gtree.c                 \
179         guniprop.c              \
180         gutf8.c                 \
181         gunibreak.h             \
182         gunibreak.c             \
183         gunichartables.h        \
184         gunicollate.c           \
185         gunicomp.h              \
186         gunidecomp.h            \
187         gunidecomp.c            \
188         gunicodeprivate.h       \
189         gurifuncs.c             \
190         gutils.c                \
191         gvariant.h              \
192         gvariant.c              \
193         gvariant-core.h         \
194         gvariant-core.c         \
195         gvariant-internal.h     \
196         gvariant-parser.c       \
197         gvariant-serialiser.h   \
198         gvariant-serialiser.c   \
199         gvarianttypeinfo.h      \
200         gvarianttypeinfo.c      \
201         gvarianttype.c          \
202         gwakeup.h               \
203         gwakeup.c               \
204         gdebug.h                \
205         gprintf.c               \
206         gprintfint.h
207
208 if OS_UNIX
209 libglib_2_0_la_SOURCES += glib-unix.c
210 endif
211
212 if OS_WIN32
213 libglib_2_0_la_SOURCES += gthread-win32.c
214 else
215 libglib_2_0_la_SOURCES += gthread-posix.c
216 endif
217
218 EXTRA_libglib_2_0_la_SOURCES = \
219         giounix.c       \
220         giowin32.c      \
221         gspawn.c        \
222         gspawn-win32.c  \
223         gwin32.c
224
225 glibincludedir=$(includedir)/glib-2.0
226 glibinclude_HEADERS =   \
227         glib-unix.h     \
228         glib-object.h   \
229         glib.h
230
231
232 glibsubincludedir=$(includedir)/glib-2.0/glib
233 glibsubinclude_HEADERS =   \
234         galloca.h       \
235         garray.h        \
236         gasyncqueue.h   \
237         gatomic.h       \
238         gbacktrace.h    \
239         gbase64.h       \
240         gbitlock.h      \
241         gbookmarkfile.h \
242         gcache.h        \
243         gchecksum.h     \
244         gcompletion.h   \
245         gconvert.h      \
246         gdataset.h      \
247         gdate.h         \
248         gdatetime.h     \
249         gdir.h          \
250         gerror.h        \
251         gfileutils.h    \
252         ghash.h         \
253         ghmac.h         \
254         ghook.h         \
255         ghostutils.h    \
256         gi18n.h         \
257         gi18n-lib.h     \
258         giochannel.h    \
259         gkeyfile.h      \
260         glist.h         \
261         gmacros.h       \
262         gmain.h         \
263         gmappedfile.h   \
264         gmarkup.h       \
265         gmem.h          \
266         gmessages.h     \
267         gnode.h         \
268         goption.h       \
269         gpattern.h      \
270         gpoll.h         \
271         gprimes.h       \
272         gqsort.h        \
273         gquark.h        \
274         gqueue.h        \
275         grand.h         \
276         $(gregex_h)     \
277         grel.h          \
278         gscanner.h      \
279         gsequence.h     \
280         gshell.h        \
281         gslice.h        \
282         gslist.h        \
283         gspawn.h        \
284         gstdio.h        \
285         gstrfuncs.h     \
286         gtestutils.h    \
287         gstring.h       \
288         gthread.h       \
289         gthreadpool.h   \
290         gtimer.h        \
291         gtimezone.h     \
292         gtree.h         \
293         gtypes.h        \
294         gunicode.h      \
295         gurifuncs.h     \
296         gutils.h        \
297         gvarianttype.h  \
298         gvariant.h      \
299         gwin32.h        \
300         gprintf.h
301
302 # This is read by gobject-introspection/misc/ and gtk-doc
303 glib-public-headers.txt: Makefile
304         echo $(glibinclude_HEADERS) $(glibsubinclude_HEADERS) > $@.tmp && mv $@.tmp $@
305
306 CLEANFILES += glib-public-headers.txt
307
308 all-local: glib-public-headers.txt
309
310 install-data-local: install-ms-lib install-def-file
311         @if test -f $(glibincludedir)/glist.h ; then                                    \
312           echo "*** Old headers found in $(glibincludedir). You should remove the" ;    \
313           echo "*** contents of this directory and type 'make install' again." ;        \
314           false ;                                                                       \
315         fi
316
317 uninstall-local: uninstall-ms-lib uninstall-def-file
318
319 if PLATFORM_WIN32
320 no_undefined = -no-undefined
321 endif
322
323 if OS_WIN32_AND_DLL_COMPILATION
324 export_symbols = -export-symbols glib.def
325
326 glib_win32_res = glib-win32-res.o
327 glib_win32_res_ldflag = -Wl,$(glib_win32_res)
328
329 glib_def = glib.def
330
331 install-def-file:
332         $(INSTALL) glib.def $(DESTDIR)$(libdir)/glib-2.0.def
333
334 uninstall-def-file:
335         -rm $(DESTDIR)$(libdir)/glib-2.0.def
336 else
337 install-def-file:
338 uninstall-def-file:
339
340 export_symbols = $(LIBTOOL_EXPORT_OPTIONS)
341 endif
342
343 if ENABLE_REGEX
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 else
352 pcre_lib =
353 pcre_inc =
354 endif
355
356 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)
357 libglib_2_0_la_DEPENDENCIES = libcharset/libcharset.la $(printf_la) @GIO@ @GSPAWN@ @PLATFORMDEP@ $(glib_win32_res) $(glib_def)
358
359 libglib_2_0_la_LDFLAGS = $(GLIB_LINK_FLAGS) \
360          $(glib_win32_res_ldflag) \
361         -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
362         -export-dynamic $(no_undefined) $(export_symbols)
363
364 INSTALL_PROGS=
365
366 if ENABLE_DTRACE
367 glib_probes.h: glib_probes.d Makefile
368         $(AM_V_GEN) $(DTRACE) -C -h -s $< -o $@.tmp
369         @$(SED) -e "s,define STAP_HAS_SEMAPHORES 1,undef STAP_HAS_SEMAPHORES," < $@.tmp > $@ && rm -f $@.tmp
370 glib_probes.o: glib_probes.d Makefile
371         $(AM_V_GEN) $(DTRACE) -G -s $< -o $@
372 BUILT_SOURCES += glib_probes.h glib_probes.o
373 CLEANFILES += glib_probes.h glib_probes.h.tmp
374 libglib_2_0_la_LIBADD += glib_probes.o
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\([0-9]\+\(\.[0-9]\+\)\?\)\?|#!${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: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 $(libglib_2_0_la_SOURCES); do \
453                 case $$F in \
454                 *-gcc.c|*-unix.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 $(libglib_2_0_la_SOURCES); do \
465                 case $$F in \
466                 *-gcc.c|*-unix.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 $(libglib_2_0_la_SOURCES); do \
477                 case $$F in \
478                 *-gcc.c|*-unix.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 distclean-local:
488         if test $(srcdir) = .; then :; else \
489             rm -f libglib-gdb.py; \
490         fi
491
492 # install gdb scripts
493 gdbdir = $(datadir)/glib-2.0/gdb
494 dist_gdb_SCRIPTS = glib.py
495
496 libglib-gdb.py: libglib-gdb.py.in
497         $(AM_V_GEN) $(SED) -e "s|\@datadir\@|$(datadir)|" $(srcdir)/libglib-gdb.py.in > libglib-gdb.py
498
499
500 install-data-hook: libglib-gdb.py
501         mkdir -p $(DESTDIR)$(datadir)/gdb/auto-load$(ABS_GLIB_RUNTIME_LIBDIR)
502         $(INSTALL) libglib-gdb.py $(DESTDIR)$(datadir)/gdb/auto-load$(ABS_GLIB_RUNTIME_LIBDIR)/libglib-2.0.so.0.$(LT_CURRENT).$(LT_REVISION)-gdb.py
503 if HAVE_GLIB_RUNTIME_LIBDIR
504         mkdir -p $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
505         mv $(DESTDIR)$(libdir)/libglib-2.0.so.0 $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
506         mv $(DESTDIR)$(libdir)/libglib-2.0.so.0.$(LT_CURRENT).$(LT_REVISION) $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
507         rm -f $(DESTDIR)$(libdir)/libglib-2.0.so
508         ln -s $(GLIB_RUNTIME_LIBDIR)/libglib-2.0.so.0.$(LT_CURRENT).$(LT_REVISION) $(DESTDIR)$(libdir)/libglib-2.0.so
509 endif