Make things compile again
[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         -DGLIB_COMPILATION              \
55         -DPCRE_STATIC
56
57 glib.def: glib.symbols
58         $(AM_V_GEN) (echo EXPORTS; $(CPP) -P -DG_OS_WIN32 - <$(srcdir)/glib.symbols | sed -e '/^$$/d' -e 's/^/  /') > glib.def
59
60 if OS_LINUX
61 if HAVE_GNUC_VISIBILITY
62 TESTS_ENVIRONMENT = GLIB_DEBUG_FLAGS="$(GLIB_DEBUG_FLAGS)"
63 TESTS = abicheck.sh
64 endif
65 endif
66
67 MIRRORING_TAB_SOURCE =                          \
68         glib-mirroring-tab/Makefile             \
69         glib-mirroring-tab/gen-mirroring-tab.c  \
70         glib-mirroring-tab/packtab.h            \
71         glib-mirroring-tab/packtab.c
72
73 # The compilation of GRegex can be disabled, but the source files must
74 # be distributed.
75 EXTRA_DIST +=                   \
76         makefile.msc.in         \
77         glib.rc.in              \
78         gen-iswide-table.py     \
79         gen-unicode-tables.pl   \
80         gen-script-table.pl     \
81         glibconfig.h.win32.in   \
82         abicheck.sh             \
83         glib.symbols            \
84         gregex.c                \
85         gregex.h                \
86         win_iconv.c             \
87         libglib-gdb.py.in       \
88         $(MIRRORING_TAB_SOURCE)
89
90 # These may be in the builddir too
91 BUILT_EXTRA_DIST =              \
92         makefile.msc            \
93         glibconfig.h.win32      \
94         glib.rc
95
96 lib_LTLIBRARIES = libglib-2.0.la
97
98 if OS_WIN32_AND_DLL_COMPILATION
99 if MS_LIB_AVAILABLE
100 noinst_DATA = glib-2.0.lib
101
102 install_ms_lib_cmd = $(INSTALL) glib-2.0.lib $(DESTDIR)$(libdir)
103 uninstall_ms_lib_cmd = -rm $(DESTDIR)$(libdir)/glib-2.0.lib
104 endif
105 endif
106
107 install-ms-lib:
108         $(install_ms_lib_cmd)
109
110 uninstall-ms-lib:
111         $(uninstall_ms_lib_cmd)
112
113 deprecated_sources = \
114         deprecated/gallocator.c         \
115         deprecated/gcache.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         gcharset.c              \
135         gchecksum.c             \
136         gconvert.c              \
137         gdataset.c              \
138         gdatasetprivate.h       \
139         gdate.c                 \
140         gdatetime.c             \
141         gdir.c                  \
142         genviron.c              \
143         gerror.c                \
144         gfileutils.c            \
145         ggettext.c              \
146         ghash.c                 \
147         ghmac.c                 \
148         ghook.c                 \
149         ghostutils.c            \
150         giochannel.c            \
151         gkeyfile.c              \
152         glibintl.h              \
153         glib_trace.h            \
154         glib-init.h             \
155         glib-init.c             \
156         glib-private.h          \
157         glib-private.c          \
158         glist.c                 \
159         gmain-internal.h        \
160         gmain.c                 \
161         gmappedfile.c           \
162         gmarkup.c               \
163         gmem.c                  \
164         gmessages.c             \
165         gmirroringtable.h       \
166         gnode.c                 \
167         goption.c               \
168         gpattern.c              \
169         gpoll.c                 \
170         gprimes.c               \
171         gqsort.c                \
172         gqueue.c                \
173         grand.c                 \
174         $(gregex_c)             \
175         gscanner.c              \
176         gscripttable.h          \
177         gsequence.c             \
178         gshell.c                \
179         gslice.c                \
180         gslist.c                \
181         gstdio.c                \
182         gstrfuncs.c             \
183         gstring.c               \
184         gstringchunk.c          \
185         gtestutils.c            \
186         gthread.c               \
187         gthreadprivate.h        \
188         gthreadpool.c           \
189         gtimer.c                \
190         gtimezone.c             \
191         gtrashstack.c           \
192         gtree.c                 \
193         guniprop.c              \
194         gutf8.c                 \
195         gunibreak.h             \
196         gunibreak.c             \
197         gunichartables.h        \
198         gunicollate.c           \
199         gunicomp.h              \
200         gunidecomp.h            \
201         gunidecomp.c            \
202         gunicodeprivate.h       \
203         gurifuncs.c             \
204         gutils.c                \
205         gvariant.h              \
206         gvariant.c              \
207         gvariant-core.h         \
208         gvariant-core.c         \
209         gvariant-internal.h     \
210         gvariant-parser.c       \
211         gvariant-serialiser.h   \
212         gvariant-serialiser.c   \
213         gvarianttypeinfo.h      \
214         gvarianttypeinfo.c      \
215         gvarianttype.c          \
216         gversion.c              \
217         gwakeup.h               \
218         gwakeup.c               \
219         gprintf.c               \
220         gprintfint.h
221
222 if OS_UNIX
223 libglib_2_0_la_SOURCES += glib-unix.c
224 endif
225
226 if OS_WIN32
227 libglib_2_0_la_SOURCES += gthread-win32.c
228 else
229 libglib_2_0_la_SOURCES += gthread-posix.c
230 endif
231
232 EXTRA_libglib_2_0_la_SOURCES = \
233         giounix.c       \
234         giowin32.c      \
235         gspawn.c        \
236         gspawn-win32.c  \
237         gwin32.c
238
239 glibincludedir=$(includedir)/glib-2.0
240 glibinclude_HEADERS =   \
241         glib-unix.h     \
242         glib-object.h   \
243         glib.h
244
245 deprecatedincludedir=$(includedir)/glib-2.0/glib/deprecated
246 deprecatedinclude_HEADERS = \
247         deprecated/gallocator.h         \
248         deprecated/gcache.h             \
249         deprecated/gcompletion.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         gcharset.h      \
264         gchecksum.h     \
265         gconvert.h      \
266         gdataset.h      \
267         gdate.h         \
268         gdatetime.h     \
269         gdir.h          \
270         genviron.h      \
271         gerror.h        \
272         gfileutils.h    \
273         ggettext.h      \
274         ghash.h         \
275         ghmac.h         \
276         ghook.h         \
277         ghostutils.h    \
278         gi18n.h         \
279         gi18n-lib.h     \
280         giochannel.h    \
281         gkeyfile.h      \
282         glist.h         \
283         gmacros.h       \
284         gmain.h         \
285         gmappedfile.h   \
286         gmarkup.h       \
287         gmem.h          \
288         gmessages.h     \
289         gnode.h         \
290         goption.h       \
291         gpattern.h      \
292         gpoll.h         \
293         gprimes.h       \
294         gqsort.h        \
295         gquark.h        \
296         gqueue.h        \
297         grand.h         \
298         $(gregex_h)     \
299         gscanner.h      \
300         gsequence.h     \
301         gshell.h        \
302         gslice.h        \
303         gslist.h        \
304         gspawn.h        \
305         gstdio.h        \
306         gstrfuncs.h     \
307         gtestutils.h    \
308         gstring.h       \
309         gstringchunk.h  \
310         gthread.h       \
311         gthreadpool.h   \
312         gtimer.h        \
313         gtimezone.h     \
314         gtrashstack.h   \
315         gtree.h         \
316         gtypes.h        \
317         gunicode.h      \
318         gurifuncs.h     \
319         gutils.h        \
320         gvarianttype.h  \
321         gvariant.h      \
322         gversion.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
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 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) 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 ENABLE_REGEX
368 if USE_SYSTEM_PCRE
369 pcre_lib = $(PCRE_LIBS)
370 pcre_inc = $(PCRE_CFLAGS)
371 else
372 pcre_lib = pcre/libpcre.la
373 pcre_inc =
374 endif
375 else
376 pcre_lib =
377 pcre_inc =
378 endif
379
380 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)
381 libglib_2_0_la_DEPENDENCIES = libcharset/libcharset.la $(printf_la) @GIO@ @GSPAWN@ @PLATFORMDEP@ $(glib_win32_res) $(glib_def)
382
383 libglib_2_0_la_LDFLAGS = $(GLIB_LINK_FLAGS) \
384          $(glib_win32_res_ldflag) \
385         -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
386         -export-dynamic $(no_undefined) $(export_symbols)
387
388 INSTALL_PROGS=
389
390 if ENABLE_DTRACE
391 glib_probes.h: glib_probes.d Makefile
392         $(AM_V_GEN) $(DTRACE) -C -h -s $< -o $@.tmp
393         @$(SED) -e "s,define STAP_HAS_SEMAPHORES 1,undef STAP_HAS_SEMAPHORES," < $@.tmp > $@ && rm -f $@.tmp
394 glib_probes.o: glib_probes.d Makefile
395         $(AM_V_GEN) $(DTRACE) -G -s $< -o $@
396 BUILT_SOURCES += glib_probes.h glib_probes.o
397 CLEANFILES += glib_probes.h glib_probes.h.tmp
398 libglib_2_0_la_LIBADD += glib_probes.o
399 endif
400
401 if ENABLE_SYSTEMTAP
402 tapset_in_files = glib.stp.in
403 tapsetdir   = @ABS_TAPSET_DIR@
404 tapset_DATA = $(tapset_in_files:.stp.in=.stp)
405 EXTRA_DIST += $(tapset_in_files)
406 endif
407
408 gspawn-win32-helper-console.c:
409         echo '#define HELPER_CONSOLE' >$@
410         echo '#include "gspawn-win32-helper.c"' >>$@
411
412 gspawn-win64-helper.c:
413         echo '#include "gspawn-win32-helper.c"' >$@
414
415 gspawn-win64-helper-console.c:
416         echo '#define HELPER_CONSOLE' >$@
417         echo '#include "gspawn-win32-helper.c"' >>$@
418
419
420 if OS_WIN32
421 if OS_WIN32_X64
422 INSTALL_PROGS += gspawn-win64-helper gspawn-win64-helper-console
423 gspawn_win64_helper_LDADD = libglib-2.0.la
424 gspawn_win64_helper_LDFLAGS = -mwindows
425 gspawn_win64_helper_console_LDADD = libglib-2.0.la
426 else
427 INSTALL_PROGS += gspawn-win32-helper gspawn-win32-helper-console
428 gspawn_win32_helper_LDADD = libglib-2.0.la
429 gspawn_win32_helper_LDFLAGS = -mwindows
430 gspawn_win32_helper_console_LDADD = libglib-2.0.la
431 endif
432 endif
433
434 glib-win32-res.o: glib.rc
435         $(WINDRES) glib.rc $@
436
437 bin_PROGRAMS     = ${INSTALL_PROGS}
438
439 if OS_UNIX
440
441 INSTALL_PROGS   += gtester
442 gtester_SOURCES  = gtester.c
443 gtester_LDADD    = libglib-2.0.la 
444
445 auto_config_binscripts = gtester-report
446 bin_SCRIPTS = ${auto_config_binscripts}
447 EXTRA_DIST += ${auto_config_binscripts}
448
449 CONFIGVARS = \
450         "bindir"        : "${bindir}",          \
451         "glib-version"  : "${GLIB_VERSION}"
452
453 install-exec-hook:
454         for sf in ${auto_config_binscripts} ; do \
455           mv -f "$(DESTDIR)$(bindir)/$$sf" "$(DESTDIR)$(bindir)/$$sf".tmp \
456           && sed < "$(DESTDIR)$(bindir)/$$sf".tmp > "$(DESTDIR)$(bindir)/$$sf" \
457             -e '1,24s|^ *#@PKGINSTALL_CONFIGVARS_IN24LINES@|  ${CONFIGVARS}|' \
458             -e '1,1s|#! /usr/bin/env python\([0-9]\+\(\.[0-9]\+\)\?\)\?|#!${PYTHON}|' \
459           || exit $$? ; \
460           chmod a+x $(DESTDIR)$(bindir)/$$sf ; \
461           rm -f "$(DESTDIR)$(bindir)/$$sf".tmp ; \
462         done
463
464 endif
465
466 glib-2.0.lib: libglib-2.0.la glib.def
467         lib -machine:@LIB_EXE_MACHINE_FLAG@ -name:libglib-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:glib.def -out:$@
468
469 dist-hook: $(BUILT_EXTRA_DIST) ../build/win32/vs9/glib.vcproj ../build/win32/vs10/glib.vcxproj ../build/win32/vs10/glib.vcxproj.filters
470         files='$(BUILT_EXTRA_DIST)'; \
471         for f in $$files; do \
472           if test -f $$f; then d=.; else d=$(srcdir); fi; \
473           cp $$d/$$f $(distdir) || exit 1; done
474
475 ../build/win32/vs9/glib.vcproj: $(top_srcdir)/build/win32/vs9/glib.vcprojin
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 '   <File RelativePath="..\..\..\glib\'$$F'" />' \
481                         ;; \
482                 esac; \
483         done >libglib.sourcefiles
484         $(CPP) -P - <$(top_srcdir)/build/win32/vs9/glib.vcprojin >$@
485         rm libglib.sourcefiles
486
487 ../build/win32/vs10/glib.vcxproj: $(top_srcdir)/build/win32/vs10/glib.vcxprojin
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'" />' \
493                      ;; \
494                 esac; \
495         done >libglib.vs10.sourcefiles
496         $(CPP) -P - <$(top_srcdir)/build/win32/vs10/glib.vcxprojin >$@
497         rm libglib.vs10.sourcefiles
498
499 ../build/win32/vs10/glib.vcxproj.filters: $(top_srcdir)/build/win32/vs10/glib.vcxproj.filtersin
500         for F in `echo $(libglib_2_0_la_SOURCES) | tr '/' '\\'`; do \
501                 case $$F in \
502                 *-unix.c|gthread-*.c) \
503                         ;; \
504                 *.c) echo '    <ClCompile Include="..\..\..\glib\'$$F'"><Filter>Source Files</Filter></ClCompile>' \
505                      ;; \
506                 esac; \
507         done >libglib.vs10.sourcefiles.filters
508         $(CPP) -P - <$(top_srcdir)/build/win32/vs10/glib.vcxproj.filtersin >$@  
509         rm libglib.vs10.sourcefiles.filters
510
511 distclean-local:
512         if test $(srcdir) = .; then :; else \
513             rm -f libglib-gdb.py; \
514         fi
515
516 # install gdb scripts
517 gdbdir = $(datadir)/glib-2.0/gdb
518 dist_gdb_SCRIPTS = glib.py
519
520 libglib-gdb.py: libglib-gdb.py.in
521         $(AM_V_GEN) $(SED) -e "s|\@datadir\@|$(datadir)|" $(srcdir)/libglib-gdb.py.in > libglib-gdb.py
522
523
524 install-data-hook: libglib-gdb.py
525         mkdir -p $(DESTDIR)$(datadir)/gdb/auto-load$(ABS_GLIB_RUNTIME_LIBDIR)
526         $(INSTALL) libglib-gdb.py $(DESTDIR)$(datadir)/gdb/auto-load$(ABS_GLIB_RUNTIME_LIBDIR)/libglib-2.0.so.0.$(LT_CURRENT).$(LT_REVISION)-gdb.py
527 if HAVE_GLIB_RUNTIME_LIBDIR
528         mkdir -p $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
529         mv $(DESTDIR)$(libdir)/libglib-2.0.so.0 $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
530         mv $(DESTDIR)$(libdir)/libglib-2.0.so.0.$(LT_CURRENT).$(LT_REVISION) $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
531         rm -f $(DESTDIR)$(libdir)/libglib-2.0.so
532         ln -s $(GLIB_RUNTIME_LIBDIR)/libglib-2.0.so.0.$(LT_CURRENT).$(LT_REVISION) $(DESTDIR)$(libdir)/libglib-2.0.so
533 endif