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