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