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