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