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