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