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