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