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