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