Sprinkle some $(AM_V_GEN) around to make the build more silent.
[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 CLEANFILES=
5
6 if HAVE_GOOD_PRINTF
7 else
8 PRINTF_SUBDIR = gnulib
9 printf_la = gnulib/libgnulib.la
10 endif 
11
12 if ENABLE_REGEX
13 if USE_SYSTEM_PCRE
14 else
15 MAYBE_PCRE = pcre 
16 endif
17 gregex_c = gregex.c
18 gregex_h = gregex.h
19 else
20 gregex_c =
21 gregex_h =
22 endif
23
24 if HAVE_GCC_BUILTINS_FOR_ATOMIC_OPERATIONS
25 gatomic_c = gatomic-gcc.c
26 else
27 gatomic_c = gatomic.c
28 endif
29
30 SUBDIRS = libcharset $(PRINTF_SUBDIR) $(MAYBE_PCRE) update-pcre . tests
31
32 DIST_SUBDIRS = libcharset gnulib pcre update-pcre tests
33
34 AM_CPPFLAGS =                           \
35         -I$(top_srcdir)                 \
36         $(pcre_inc)                     \
37         -DG_LOG_DOMAIN=\"GLib\"         \
38         $(GLIB_DEBUG_FLAGS)             \
39         -DG_DISABLE_DEPRECATED          \
40         -DGLIB_COMPILATION              \
41         -DPCRE_STATIC
42
43 glib.def: glib.symbols
44         $(AM_V_GEN) (echo -e EXPORTS; $(CPP) -P -DINCLUDE_VARIABLES -DINCLUDE_INTERNAL_SYMBOLS -DG_OS_WIN32 -DALL_FILES - <$(srcdir)/glib.symbols | sed -e '/^$$/d' -e 's/^/    /' -e 's/G_GNUC_[^ ]*//g') > glib.def
45
46 galias.h: $(srcdir)/makegalias.pl glib.symbols
47           $(AM_V_GEN) $(PERL) $(srcdir)/makegalias.pl < $(srcdir)/glib.symbols > galias.h
48
49 galiasdef.c: $(srcdir)/makegalias.pl glib.symbols
50           $(AM_V_GEN) $(PERL) $(srcdir)/makegalias.pl -def < $(srcdir)/glib.symbols > galiasdef.c
51
52 if OS_LINUX
53 if HAVE_GNUC_VISIBILITY
54 TESTS_ENVIRONMENT = GLIB_DEBUG_FLAGS="$(GLIB_DEBUG_FLAGS)"
55 TESTS = abicheck.sh pltcheck.sh
56 endif
57 endif
58
59 BUILT_SOURCES = galias.h galiasdef.c
60
61 MIRRORING_TAB_SOURCE =                          \
62         glib-mirroring-tab/Makefile             \
63         glib-mirroring-tab/gen-mirroring-tab.c  \
64         glib-mirroring-tab/packtab.h            \
65         glib-mirroring-tab/packtab.c
66
67 # The compilation of GRegex can be disabled, but the source files must
68 # be distributed.
69 EXTRA_DIST +=                   \
70         makefile.msc.in         \
71         glib.rc.in              \
72         gen-unicode-tables.pl   \
73         gen-script-table.pl     \
74         makegalias.pl           \
75         abicheck.sh             \
76         pltcheck.sh             \
77         glib.symbols            \
78         gregex.c                \
79         gregex.h                \
80         win_iconv.c             \
81         libglib-gdb.py.in       \
82         $(MIRRORING_TAB_SOURCE)
83
84 # These may be in the builddir too
85 BUILT_EXTRA_DIST =              \
86         makefile.msc            \
87         glib.rc                 \
88         galias.h                \
89         galiasdef.c
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 libglib_2_0_la_SOURCES =        \
109         glib_probes.d           \
110         garray.c                \
111         gasyncqueue.c           \
112         $(gatomic_c)            \
113         gbacktrace.c            \
114         gbase64.c               \
115         gbitlock.c              \
116         gbookmarkfile.c         \
117         gbsearcharray.h         \
118         gbuffer.c               \
119         gbuffer.h               \
120         gcache.c                \
121         gchecksum.c             \
122         gcompletion.c           \
123         gconvert.c              \
124         gdataset.c              \
125         gdatasetprivate.h       \
126         gdate.c                 \
127         gdir.c                  \
128         gerror.c                \
129         gfileutils.c            \
130         ghash.c                 \
131         ghook.c                 \
132         ghostutils.c            \
133         giochannel.c            \
134         gkeyfile.c              \
135         glibintl.h              \
136         glib_trace.h            \
137         glist.c                 \
138         gmain.c                 \
139         gmappedfile.c           \
140         gmarkup.c               \
141         gmem.c                  \
142         gmessages.c             \
143         gmirroringtable.h       \
144         gnode.c                 \
145         goption.c               \
146         gpattern.c              \
147         gpoll.c                 \
148         gprimes.c               \
149         gqsort.c                \
150         gqueue.c                \
151         grel.c                  \
152         grand.c                 \
153         $(gregex_c)             \
154         gscanner.c              \
155         gscripttable.h          \
156         gsequence.c             \
157         gshell.c                \
158         gslice.c                \
159         gslist.c                \
160         gstdio.c                \
161         gstrfuncs.c             \
162         gstring.c               \
163         gtestutils.c            \
164         gthread.c               \
165         gthreadprivate.h        \
166         gthreadpool.c           \
167         gtimer.c                \
168         gtree.c                 \
169         guniprop.c              \
170         gutf8.c                 \
171         gunibreak.h             \
172         gunibreak.c             \
173         gunichartables.h        \
174         gunicollate.c           \
175         gunicomp.h              \
176         gunidecomp.h            \
177         gunidecomp.c            \
178         gunicodeprivate.h       \
179         gurifuncs.c             \
180         gutils.c                \
181         gvariant.h              \
182         gvariant.c              \
183         gvariant-core.h         \
184         gvariant-core.c         \
185         gvariant-internal.h     \
186         gvariant-parser.c       \
187         gvariant-serialiser.h   \
188         gvariant-serialiser.c   \
189         gvarianttypeinfo.h      \
190         gvarianttypeinfo.c      \
191         gvarianttype.c          \
192         gdebug.h                \
193         gprintf.c               \
194         gprintfint.h
195
196
197 EXTRA_libglib_2_0_la_SOURCES = \
198         giounix.c       \
199         giowin32.c      \
200         gspawn.c        \
201         gspawn-win32.c  \
202         gwin32.c
203
204 glibincludedir=$(includedir)/glib-2.0
205 glibinclude_HEADERS =   \
206         glib-object.h   \
207         glib.h
208
209 glibsubincludedir=$(includedir)/glib-2.0/glib
210 glibsubinclude_HEADERS =   \
211         galloca.h       \
212         garray.h        \
213         gasyncqueue.h   \
214         gatomic.h       \
215         gbacktrace.h    \
216         gbase64.h       \
217         gbitlock.h      \
218         gbookmarkfile.h \
219         gcache.h        \
220         gchecksum.h     \
221         gcompletion.h   \
222         gconvert.h      \
223         gdataset.h      \
224         gdate.h         \
225         gdir.h          \
226         gerror.h        \
227         gfileutils.h    \
228         ghash.h         \
229         ghook.h         \
230         ghostutils.h    \
231         gi18n.h         \
232         gi18n-lib.h     \
233         giochannel.h    \
234         gkeyfile.h      \
235         glist.h         \
236         gmacros.h       \
237         gmain.h         \
238         gmappedfile.h   \
239         gmarkup.h       \
240         gmem.h          \
241         gmessages.h     \
242         gnode.h         \
243         goption.h       \
244         gpattern.h      \
245         gpoll.h         \
246         gprimes.h       \
247         gqsort.h        \
248         gquark.h        \
249         gqueue.h        \
250         grand.h         \
251         $(gregex_h)     \
252         grel.h          \
253         gscanner.h      \
254         gsequence.h     \
255         gshell.h        \
256         gslice.h        \
257         gslist.h        \
258         gspawn.h        \
259         gstdio.h        \
260         gstrfuncs.h     \
261         gtestutils.h    \
262         gstring.h       \
263         gthread.h       \
264         gthreadpool.h   \
265         gtimer.h        \
266         gtree.h         \
267         gtypes.h        \
268         gunicode.h      \
269         gurifuncs.h             \
270         gutils.h        \
271         gvarianttype.h  \
272         gvariant.h      \
273         gwin32.h        \
274         gprintf.h
275
276 install-data-local: install-ms-lib install-def-file
277         @if test -f $(glibincludedir)/glist.h ; then                                    \
278           echo "*** Old headers found in $(glibincludedir). You should remove the" ;    \
279           echo "*** contents of this directory and type 'make install' again." ;        \
280           false ;                                                                       \
281         fi
282
283 uninstall-local: uninstall-ms-lib uninstall-def-file
284
285 if PLATFORM_WIN32
286 no_undefined = -no-undefined
287 endif
288
289 if OS_WIN32_AND_DLL_COMPILATION
290 export_symbols = -export-symbols glib.def
291
292 glib_win32_res = glib-win32-res.o
293 glib_win32_res_ldflag = -Wl,$(glib_win32_res)
294
295 glib_def = glib.def
296
297 install-def-file:
298         $(INSTALL) glib.def $(DESTDIR)$(libdir)/glib-2.0.def
299
300 uninstall-def-file:
301         -rm $(DESTDIR)$(libdir)/glib-2.0.def
302 else
303 install-def-file:
304 uninstall-def-file:
305
306 export_symbols = $(LIBTOOL_EXPORT_OPTIONS)
307 endif
308
309 if ENABLE_REGEX
310 if USE_SYSTEM_PCRE
311 pcre_lib = $(PCRE_LIBS)
312 pcre_inc = $(PCRE_CFLAGS)
313 else
314 pcre_lib = pcre/libpcre.la
315 pcre_inc =
316 endif
317 else
318 pcre_lib =
319 pcre_inc =
320 endif
321
322 libglib_2_0_la_LIBADD = libcharset/libcharset.la $(printf_la) @GIO@ @GSPAWN@ @PLATFORMDEP@ @ICONV_LIBS@ @G_LIBS_EXTRA@ $(pcre_lib)
323 libglib_2_0_la_DEPENDENCIES = libcharset/libcharset.la $(printf_la) @GIO@ @GSPAWN@ @PLATFORMDEP@ $(glib_win32_res) $(glib_def)
324
325 libglib_2_0_la_LDFLAGS = \
326          $(glib_win32_res_ldflag) \
327         -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
328         -export-dynamic $(no_undefined) $(export_symbols)
329
330 INSTALL_PROGS=
331
332
333 if ENABLE_DTRACE
334 glib_probes.h: glib_probes.d Makefile
335         $(DTRACE) -C -h -s $< -o $@.tmp
336         sed -e "s,define STAP_HAS_SEMAPHORES 1,undef STAP_HAS_SEMAPHORES," < $@.tmp > $@ && rm -f $@.tmp
337 glib_probes.o: glib_probes.d Makefile
338         $(DTRACE) -G -s $< -o $@
339 BUILT_SOURCES += glib_probes.h glib_probes.o
340 CLEANFILES += glib_probes.h glib_probes.h.tmp
341 libglib_2_0_la_LIBADD += glib_probes.o
342 endif
343
344 if ENABLE_SYSTEMTAP
345 tapset_in_files = glib.stp.in
346 tapsetdir   = $(DESTDIR)@ABS_TAPSET_DIR@
347 tapset_DATA = $(tapset_in_files:.stp.in=.stp)
348 EXTRA_DIST += $(tapset_in_files)
349 endif
350
351 gspawn-win32-helper-console.c:
352         echo '#define HELPER_CONSOLE' >$@
353         echo '#include "gspawn-win32-helper.c"' >>$@
354
355 gspawn-win64-helper.c:
356         echo '#include "gspawn-win32-helper.c"' >$@
357
358 gspawn-win64-helper-console.c:
359         echo '#define HELPER_CONSOLE' >$@
360         echo '#include "gspawn-win32-helper.c"' >>$@
361
362 if OS_WIN32
363 if OS_WIN32_X64
364 INSTALL_PROGS += gspawn-win64-helper gspawn-win64-helper-console
365 gspawn_win64_helper_LDADD = libglib-2.0.la
366 gspawn_win64_helper_LDFLAGS = -mwindows
367 gspawn_win64_helper_console_LDADD = libglib-2.0.la
368 else
369 INSTALL_PROGS += gspawn-win32-helper gspawn-win32-helper-console
370 gspawn_win32_helper_LDADD = libglib-2.0.la
371 gspawn_win32_helper_LDFLAGS = -mwindows
372 gspawn_win32_helper_console_LDADD = libglib-2.0.la
373 endif
374 endif
375
376 glib-win32-res.o: glib.rc
377         $(WINDRES) glib.rc $@
378
379 bin_PROGRAMS     = ${INSTALL_PROGS}
380
381 if OS_UNIX
382
383 INSTALL_PROGS   += gtester
384 gtester_SOURCES  = gtester.c
385 gtester_LDADD    = libglib-2.0.la 
386
387 auto_config_binscripts = gtester-report
388 bin_SCRIPTS = ${auto_config_binscripts}
389 EXTRA_DIST += ${auto_config_binscripts}
390
391 CONFIGVARS = \
392         "bindir"        : "${bindir}",          \
393         "glib-version"  : "${GLIB_VERSION}"
394
395 install-exec-hook:
396         for sf in ${auto_config_binscripts} ; do \
397           mv -f "$(DESTDIR)$(bindir)/$$sf" "$(DESTDIR)$(bindir)/$$sf".tmp \
398           && sed < "$(DESTDIR)$(bindir)/$$sf".tmp > "$(DESTDIR)$(bindir)/$$sf" \
399             -e '1,24s|^ *#@PKGINSTALL_CONFIGVARS_IN24LINES@|  ${CONFIGVARS}|' \
400             -e '1,1s|#! /usr/bin/env python\([0-9]\+\(\.[0-9]\+\)\?\)\?|#!${PYTHON}|' \
401           || exit $$? ; \
402           chmod a+x $(DESTDIR)$(bindir)/$$sf ; \
403           rm -f "$(DESTDIR)$(bindir)/$$sf".tmp ; \
404         done
405
406 endif
407
408 glib-2.0.lib: libglib-2.0.la glib.def
409         lib -machine:@LIB_EXE_MACHINE_FLAG@ -name:libglib-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:glib.def -out:$@
410
411 dist-hook: $(BUILT_EXTRA_DIST) ../build/win32/vs9/glib.vcproj
412         files='$(BUILT_EXTRA_DIST)'; \
413         for f in $$files; do \
414           if test -f $$f; then d=.; else d=$(srcdir); fi; \
415           cp $$d/$$f $(distdir) || exit 1; done
416
417 ../build/win32/vs9/glib.vcproj: $(top_srcdir)/build/win32/vs9/glib.vcprojin
418         for F in $(libglib_2_0_la_SOURCES); do \
419                 case $$F in \
420                 *-gcc.c) \
421                         ;; \
422                 *.c)    echo '   <File RelativePath="..\..\..\glib\'$$F'" />' \
423                         ;; \
424                 esac; \
425         done >libglib.sourcefiles
426         $(CPP) -P - <$(top_srcdir)/build/win32/vs9/glib.vcprojin >$@
427
428 distclean-local:
429         if test $(srcdir) = .; then :; else \
430             rm -f libglib-gdb.py; \
431         fi
432
433 # install gdb scripts
434 gdbdir = $(datadir)/glib-2.0/gdb
435 dist_gdb_SCRIPTS = glib.py
436
437 libglib-gdb.py: libglib-gdb.py.in
438         $(AM_V_GEN) $(SED) -e "s|\@datadir\@|$(datadir)|" $(srcdir)/libglib-gdb.py.in > libglib-gdb.py
439
440
441 install-data-hook: libglib-gdb.py
442         mkdir -p $(DESTDIR)$(datadir)/gdb/auto-load$(ABS_GLIB_RUNTIME_LIBDIR)
443         $(INSTALL) libglib-gdb.py $(DESTDIR)$(datadir)/gdb/auto-load$(ABS_GLIB_RUNTIME_LIBDIR)/libglib-2.0.so.0.$(LT_CURRENT).$(LT_REVISION)-gdb.py
444 if HAVE_GLIB_RUNTIME_LIBDIR
445         mkdir -p $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
446         mv $(DESTDIR)$(libdir)/libglib-2.0.so.0 $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
447         mv $(DESTDIR)$(libdir)/libglib-2.0.so.0.$(LT_CURRENT).$(LT_REVISION) $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
448         rm -f $(DESTDIR)$(libdir)/libglib-2.0.so
449         ln -s $(GLIB_RUNTIME_LIBDIR)/libglib-2.0.so.0.$(LT_CURRENT).$(LT_REVISION) $(DESTDIR)$(libdir)/libglib-2.0.so
450 endif