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