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