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