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