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