22dbe4defb4bdd185860bd99fe0ea9752780101e
[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/gcache.c             \
117         deprecated/gcompletion.c        \
118         deprecated/grel.c               \
119         deprecated/gthread-deprecated.c
120
121 libglib_2_0_la_SOURCES =        \
122         $(deprecated_sources)   \
123         glib_probes.d           \
124         garray.c                \
125         gasyncqueue.c           \
126         gasyncqueueprivate.h    \
127         gatomic.c               \
128         gbacktrace.c            \
129         gbase64.c               \
130         gbitlock.c              \
131         gbookmarkfile.c         \
132         gbsearcharray.h         \
133         gbuffer.c               \
134         gbufferprivate.h        \
135         gcharset.c              \
136         gchecksum.c             \
137         gconvert.c              \
138         gdataset.c              \
139         gdatasetprivate.h       \
140         gdate.c                 \
141         gdatetime.c             \
142         gdir.c                  \
143         genviron.c              \
144         gerror.c                \
145         gfileutils.c            \
146         ghash.c                 \
147         ghmac.c                 \
148         ghook.c                 \
149         ghostutils.c            \
150         giochannel.c            \
151         gkeyfile.c              \
152         glibintl.h              \
153         glib_trace.h            \
154         glib-init.h             \
155         glib-init.c             \
156         glib-private.h          \
157         glib-private.c          \
158         glist.c                 \
159         gmain-internal.h        \
160         gmain.c                 \
161         gmappedfile.c           \
162         gmarkup.c               \
163         gmem.c                  \
164         gmessages.c             \
165         gmirroringtable.h       \
166         gnode.c                 \
167         goption.c               \
168         gpattern.c              \
169         gpoll.c                 \
170         gprimes.c               \
171         gqsort.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/grel.h               \
251         deprecated/gthread.h
252
253 glibsubincludedir=$(includedir)/glib-2.0/glib
254 glibsubinclude_HEADERS = \
255         galloca.h       \
256         garray.h        \
257         gasyncqueue.h   \
258         gatomic.h       \
259         gbacktrace.h    \
260         gbase64.h       \
261         gbitlock.h      \
262         gbookmarkfile.h \
263         gcharset.h      \
264         gchecksum.h     \
265         gconvert.h      \
266         gdataset.h      \
267         gdate.h         \
268         gdatetime.h     \
269         gdir.h          \
270         genviron.h      \
271         gerror.h        \
272         gfileutils.h    \
273         ghash.h         \
274         ghmac.h         \
275         ghook.h         \
276         ghostutils.h    \
277         gi18n.h         \
278         gi18n-lib.h     \
279         giochannel.h    \
280         gkeyfile.h      \
281         glist.h         \
282         gmacros.h       \
283         gmain.h         \
284         gmappedfile.h   \
285         gmarkup.h       \
286         gmem.h          \
287         gmessages.h     \
288         gnode.h         \
289         goption.h       \
290         gpattern.h      \
291         gpoll.h         \
292         gprimes.h       \
293         gqsort.h        \
294         gquark.h        \
295         gqueue.h        \
296         grand.h         \
297         $(gregex_h)     \
298         gscanner.h      \
299         gsequence.h     \
300         gshell.h        \
301         gslice.h        \
302         gslist.h        \
303         gspawn.h        \
304         gstdio.h        \
305         gstrfuncs.h     \
306         gtestutils.h    \
307         gstring.h       \
308         gstringchunk.h  \
309         gthread.h       \
310         gthreadpool.h   \
311         gtimer.h        \
312         gtimezone.h     \
313         gtrashstack.h   \
314         gtree.h         \
315         gtypes.h        \
316         gunicode.h      \
317         gurifuncs.h     \
318         gutils.h        \
319         gvarianttype.h  \
320         gvariant.h      \
321         gversion.h      \
322         gwin32.h        \
323         gprintf.h
324
325 # This is read by gobject-introspection/misc/ and gtk-doc
326 glib-public-headers.txt: Makefile
327         echo $(glibinclude_HEADERS) $(glibsubinclude_HEADERS) > $@.tmp && mv $@.tmp $@
328
329 CLEANFILES += glib-public-headers.txt
330
331 all-local: glib-public-headers.txt
332
333 install-data-local: install-ms-lib install-def-file
334         @if test -f $(glibincludedir)/glist.h ; then                                    \
335           echo "*** Old headers found in $(glibincludedir). You should remove the" ;    \
336           echo "*** contents of this directory and type 'make install' again." ;        \
337           false ;                                                                       \
338         fi
339
340 uninstall-local: uninstall-ms-lib uninstall-def-file
341
342 if PLATFORM_WIN32
343 no_undefined = -no-undefined
344 endif
345
346 if OS_WIN32_AND_DLL_COMPILATION
347 export_symbols = -export-symbols glib.def
348
349 glib_win32_res = glib-win32-res.o
350 glib_win32_res_ldflag = -Wl,$(glib_win32_res)
351
352 glib_def = glib.def
353
354 install-def-file:
355         $(INSTALL) glib.def $(DESTDIR)$(libdir)/glib-2.0.def
356
357 uninstall-def-file:
358         -rm $(DESTDIR)$(libdir)/glib-2.0.def
359 else
360 install-def-file:
361 uninstall-def-file:
362
363 export_symbols = $(LIBTOOL_EXPORT_OPTIONS)
364 endif
365
366 if ENABLE_REGEX
367 if USE_SYSTEM_PCRE
368 pcre_lib = $(PCRE_LIBS)
369 pcre_inc = $(PCRE_CFLAGS)
370 else
371 pcre_lib = pcre/libpcre.la
372 pcre_inc =
373 endif
374 else
375 pcre_lib =
376 pcre_inc =
377 endif
378
379 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)
380 libglib_2_0_la_DEPENDENCIES = libcharset/libcharset.la $(printf_la) @GIO@ @GSPAWN@ @PLATFORMDEP@ $(glib_win32_res) $(glib_def)
381
382 libglib_2_0_la_LDFLAGS = $(GLIB_LINK_FLAGS) \
383          $(glib_win32_res_ldflag) \
384         -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
385         -export-dynamic $(no_undefined) $(export_symbols)
386
387 INSTALL_PROGS=
388
389 if ENABLE_DTRACE
390 glib_probes.h: glib_probes.d Makefile
391         $(AM_V_GEN) $(DTRACE) -C -h -s $< -o $@.tmp
392         @$(SED) -e "s,define STAP_HAS_SEMAPHORES 1,undef STAP_HAS_SEMAPHORES," < $@.tmp > $@ && rm -f $@.tmp
393 glib_probes.o: glib_probes.d Makefile
394         $(AM_V_GEN) $(DTRACE) -G -s $< -o $@
395 BUILT_SOURCES += glib_probes.h glib_probes.o
396 CLEANFILES += glib_probes.h glib_probes.h.tmp
397 libglib_2_0_la_LIBADD += glib_probes.o
398 endif
399
400 if ENABLE_SYSTEMTAP
401 tapset_in_files = glib.stp.in
402 tapsetdir   = @ABS_TAPSET_DIR@
403 tapset_DATA = $(tapset_in_files:.stp.in=.stp)
404 EXTRA_DIST += $(tapset_in_files)
405 endif
406
407 gspawn-win32-helper-console.c:
408         echo '#define HELPER_CONSOLE' >$@
409         echo '#include "gspawn-win32-helper.c"' >>$@
410
411 gspawn-win64-helper.c:
412         echo '#include "gspawn-win32-helper.c"' >$@
413
414 gspawn-win64-helper-console.c:
415         echo '#define HELPER_CONSOLE' >$@
416         echo '#include "gspawn-win32-helper.c"' >>$@
417
418
419 if OS_WIN32
420 if OS_WIN32_X64
421 INSTALL_PROGS += gspawn-win64-helper gspawn-win64-helper-console
422 gspawn_win64_helper_LDADD = libglib-2.0.la
423 gspawn_win64_helper_LDFLAGS = -mwindows
424 gspawn_win64_helper_console_LDADD = libglib-2.0.la
425 else
426 INSTALL_PROGS += gspawn-win32-helper gspawn-win32-helper-console
427 gspawn_win32_helper_LDADD = libglib-2.0.la
428 gspawn_win32_helper_LDFLAGS = -mwindows
429 gspawn_win32_helper_console_LDADD = libglib-2.0.la
430 endif
431 endif
432
433 glib-win32-res.o: glib.rc
434         $(WINDRES) glib.rc $@
435
436 bin_PROGRAMS     = ${INSTALL_PROGS}
437
438 if OS_UNIX
439
440 INSTALL_PROGS   += gtester
441 gtester_SOURCES  = gtester.c
442 gtester_LDADD    = libglib-2.0.la 
443
444 auto_config_binscripts = gtester-report
445 bin_SCRIPTS = ${auto_config_binscripts}
446 EXTRA_DIST += ${auto_config_binscripts}
447
448 CONFIGVARS = \
449         "bindir"        : "${bindir}",          \
450         "glib-version"  : "${GLIB_VERSION}"
451
452 install-exec-hook:
453         for sf in ${auto_config_binscripts} ; do \
454           mv -f "$(DESTDIR)$(bindir)/$$sf" "$(DESTDIR)$(bindir)/$$sf".tmp \
455           && sed < "$(DESTDIR)$(bindir)/$$sf".tmp > "$(DESTDIR)$(bindir)/$$sf" \
456             -e '1,24s|^ *#@PKGINSTALL_CONFIGVARS_IN24LINES@|  ${CONFIGVARS}|' \
457             -e '1,1s|#! /usr/bin/env python\([0-9]\+\(\.[0-9]\+\)\?\)\?|#!${PYTHON}|' \
458           || exit $$? ; \
459           chmod a+x $(DESTDIR)$(bindir)/$$sf ; \
460           rm -f "$(DESTDIR)$(bindir)/$$sf".tmp ; \
461         done
462
463 endif
464
465 glib-2.0.lib: libglib-2.0.la glib.def
466         lib -machine:@LIB_EXE_MACHINE_FLAG@ -name:libglib-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:glib.def -out:$@
467
468 dist-hook: $(BUILT_EXTRA_DIST) ../build/win32/vs9/glib.vcproj ../build/win32/vs10/glib.vcxproj ../build/win32/vs10/glib.vcxproj.filters
469         files='$(BUILT_EXTRA_DIST)'; \
470         for f in $$files; do \
471           if test -f $$f; then d=.; else d=$(srcdir); fi; \
472           cp $$d/$$f $(distdir) || exit 1; done
473
474 ../build/win32/vs9/glib.vcproj: $(top_srcdir)/build/win32/vs9/glib.vcprojin
475         for F in `echo $(libglib_2_0_la_SOURCES) | tr '/' '\\'`; do \
476                 case $$F in \
477                 *-unix.c|gthread-*.c) \
478                         ;; \
479                 *.c)    echo '   <File RelativePath="..\..\..\glib\'$$F'" />' \
480                         ;; \
481                 esac; \
482         done >libglib.sourcefiles
483         $(CPP) -P - <$(top_srcdir)/build/win32/vs9/glib.vcprojin >$@
484         rm libglib.sourcefiles
485
486 ../build/win32/vs10/glib.vcxproj: $(top_srcdir)/build/win32/vs10/glib.vcxprojin
487         for F in `echo $(libglib_2_0_la_SOURCES) | tr '/' '\\'`; do \
488                 case $$F in \
489                 *-unix.c|gthread-*.c) \
490                         ;; \
491                 *.c) echo '    <ClCompile Include="..\..\..\glib\'$$F'" />' \
492                      ;; \
493                 esac; \
494         done >libglib.vs10.sourcefiles
495         $(CPP) -P - <$(top_srcdir)/build/win32/vs10/glib.vcxprojin >$@
496         rm libglib.vs10.sourcefiles
497
498 ../build/win32/vs10/glib.vcxproj.filters: $(top_srcdir)/build/win32/vs10/glib.vcxproj.filtersin
499         for F in `echo $(libglib_2_0_la_SOURCES) | tr '/' '\\'`; do \
500                 case $$F in \
501                 *-unix.c|gthread-*.c) \
502                         ;; \
503                 *.c) echo '    <ClCompile Include="..\..\..\glib\'$$F'"><Filter>Source Files</Filter></ClCompile>' \
504                      ;; \
505                 esac; \
506         done >libglib.vs10.sourcefiles.filters
507         $(CPP) -P - <$(top_srcdir)/build/win32/vs10/glib.vcxproj.filtersin >$@  
508         rm libglib.vs10.sourcefiles.filters
509
510 distclean-local:
511         if test $(srcdir) = .; then :; else \
512             rm -f libglib-gdb.py; \
513         fi
514
515 # install gdb scripts
516 gdbdir = $(datadir)/glib-2.0/gdb
517 dist_gdb_SCRIPTS = glib.py
518
519 libglib-gdb.py: libglib-gdb.py.in
520         $(AM_V_GEN) $(SED) -e "s|\@datadir\@|$(datadir)|" $(srcdir)/libglib-gdb.py.in > libglib-gdb.py
521
522
523 install-data-hook: libglib-gdb.py
524         mkdir -p $(DESTDIR)$(datadir)/gdb/auto-load$(ABS_GLIB_RUNTIME_LIBDIR)
525         $(INSTALL) libglib-gdb.py $(DESTDIR)$(datadir)/gdb/auto-load$(ABS_GLIB_RUNTIME_LIBDIR)/libglib-2.0.so.0.$(LT_CURRENT).$(LT_REVISION)-gdb.py
526 if HAVE_GLIB_RUNTIME_LIBDIR
527         mkdir -p $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
528         mv $(DESTDIR)$(libdir)/libglib-2.0.so.0 $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
529         mv $(DESTDIR)$(libdir)/libglib-2.0.so.0.$(LT_CURRENT).$(LT_REVISION) $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
530         rm -f $(DESTDIR)$(libdir)/libglib-2.0.so
531         ln -s $(GLIB_RUNTIME_LIBDIR)/libglib-2.0.so.0.$(LT_CURRENT).$(LT_REVISION) $(DESTDIR)$(libdir)/libglib-2.0.so
532 endif