glib/Makefile.am: add gmain-internal.h to sources
[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 if HAVE_GCC_BUILTINS_FOR_ATOMIC_OPERATIONS
46 gatomic_c = gatomic-gcc.c
47 else
48 gatomic_c = gatomic.c
49 endif
50
51 SUBDIRS = libcharset $(PRINTF_SUBDIR) $(MAYBE_PCRE) update-pcre . tests
52
53 DIST_SUBDIRS = libcharset gnulib pcre update-pcre tests
54
55 AM_CPPFLAGS =                           \
56         $(glib_INCLUDES)                \
57         $(pcre_inc)                     \
58         -DG_LOG_DOMAIN=\"GLib\"         \
59         $(GLIB_DEBUG_FLAGS)             \
60         -DG_DISABLE_DEPRECATED          \
61         -DGLIB_COMPILATION              \
62         -DPCRE_STATIC
63
64 glib.def: glib.symbols
65         $(AM_V_GEN) (echo -e EXPORTS; $(CPP) -P -DINCLUDE_VARIABLES -DINCLUDE_INTERNAL_SYMBOLS -DG_OS_WIN32 -DALL_FILES - <$(srcdir)/glib.symbols | sed -e '/^$$/d' -e 's/^/    /' -e 's/G_GNUC_[^ ]*//g') > glib.def
66
67 if OS_LINUX
68 if HAVE_GNUC_VISIBILITY
69 TESTS_ENVIRONMENT = GLIB_DEBUG_FLAGS="$(GLIB_DEBUG_FLAGS)"
70 TESTS = abicheck.sh
71 endif
72 endif
73
74 MIRRORING_TAB_SOURCE =                          \
75         glib-mirroring-tab/Makefile             \
76         glib-mirroring-tab/gen-mirroring-tab.c  \
77         glib-mirroring-tab/packtab.h            \
78         glib-mirroring-tab/packtab.c
79
80 # The compilation of GRegex can be disabled, but the source files must
81 # be distributed.
82 EXTRA_DIST +=                   \
83         makefile.msc.in         \
84         glib.rc.in              \
85         gen-iswide-table.py     \
86         gen-unicode-tables.pl   \
87         gen-script-table.pl     \
88         glibconfig.h.win32.in   \
89         abicheck.sh             \
90         glib.symbols            \
91         gregex.c                \
92         gregex.h                \
93         win_iconv.c             \
94         libglib-gdb.py.in       \
95         $(MIRRORING_TAB_SOURCE)
96
97 # These may be in the builddir too
98 BUILT_EXTRA_DIST =              \
99         makefile.msc            \
100         glibconfig.h.win32      \
101         glib.rc
102
103 lib_LTLIBRARIES = libglib-2.0.la
104
105 if OS_WIN32_AND_DLL_COMPILATION
106 if MS_LIB_AVAILABLE
107 noinst_DATA = glib-2.0.lib
108
109 install_ms_lib_cmd = $(INSTALL) glib-2.0.lib $(DESTDIR)$(libdir)
110 uninstall_ms_lib_cmd = -rm $(DESTDIR)$(libdir)/glib-2.0.lib
111 endif
112 endif
113
114 install-ms-lib:
115         $(install_ms_lib_cmd)
116
117 uninstall-ms-lib:
118         $(uninstall_ms_lib_cmd)
119
120 libglib_2_0_la_SOURCES =        \
121         glib_probes.d           \
122         garray.c                \
123         gasyncqueue.c           \
124         $(gatomic_c)            \
125         gbacktrace.c            \
126         gbase64.c               \
127         gbitlock.c              \
128         gbookmarkfile.c         \
129         gbsearcharray.h         \
130         gbuffer.c               \
131         gbuffer.h               \
132         gcache.c                \
133         gchecksum.c             \
134         gcompletion.c           \
135         gconvert.c              \
136         gdataset.c              \
137         gdatasetprivate.h       \
138         gdate.c                 \
139         gdatetime.c             \
140         gdir.c                  \
141         gerror.c                \
142         gfileutils.c            \
143         ghash.c                 \
144         ghook.c                 \
145         ghostutils.c            \
146         giochannel.c            \
147         gkeyfile.c              \
148         glibintl.h              \
149         glib_trace.h            \
150         glist.c                 \
151         gmain-internal.h        \
152         gmain.c                 \
153         gmappedfile.c           \
154         gmarkup.c               \
155         gmem.c                  \
156         gmessages.c             \
157         gmirroringtable.h       \
158         gnode.c                 \
159         goption.c               \
160         gpattern.c              \
161         gpoll.c                 \
162         gprimes.c               \
163         gqsort.c                \
164         gqueue.c                \
165         grel.c                  \
166         grand.c                 \
167         $(gregex_c)             \
168         gscanner.c              \
169         gscripttable.h          \
170         gsequence.c             \
171         gshell.c                \
172         gslice.c                \
173         gslist.c                \
174         gstdio.c                \
175         gstrfuncs.c             \
176         gstring.c               \
177         gtestutils.c            \
178         gthread.c               \
179         gthreadprivate.h        \
180         gthreadpool.c           \
181         gtimer.c                \
182         gtimezone.c             \
183         gtree.c                 \
184         guniprop.c              \
185         gutf8.c                 \
186         gunibreak.h             \
187         gunibreak.c             \
188         gunichartables.h        \
189         gunicollate.c           \
190         gunicomp.h              \
191         gunidecomp.h            \
192         gunidecomp.c            \
193         gunicodeprivate.h       \
194         gurifuncs.c             \
195         gutils.c                \
196         gvariant.h              \
197         gvariant.c              \
198         gvariant-core.h         \
199         gvariant-core.c         \
200         gvariant-internal.h     \
201         gvariant-parser.c       \
202         gvariant-serialiser.h   \
203         gvariant-serialiser.c   \
204         gvarianttypeinfo.h      \
205         gvarianttypeinfo.c      \
206         gvarianttype.c          \
207         gdebug.h                \
208         gprintf.c               \
209         gprintfint.h
210
211 if OS_UNIX
212 libglib_2_0_la_SOURCES += glib-unix.c
213 endif   
214
215 EXTRA_libglib_2_0_la_SOURCES = \
216         giounix.c       \
217         giowin32.c      \
218         gspawn.c        \
219         gspawn-win32.c  \
220         gwin32.c
221
222 glibincludedir=$(includedir)/glib-2.0
223 glibinclude_HEADERS =   \
224         glib-object.h   \
225         glib.h
226
227 if OS_UNIX
228 glibinclude_HEADERS += glib-unix.h
229 endif
230
231 glibsubincludedir=$(includedir)/glib-2.0/glib
232 glibsubinclude_HEADERS =   \
233         galloca.h       \
234         garray.h        \
235         gasyncqueue.h   \
236         gatomic.h       \
237         gbacktrace.h    \
238         gbase64.h       \
239         gbitlock.h      \
240         gbookmarkfile.h \
241         gcache.h        \
242         gchecksum.h     \
243         gcompletion.h   \
244         gconvert.h      \
245         gdataset.h      \
246         gdate.h         \
247         gdatetime.h     \
248         gdir.h          \
249         gerror.h        \
250         gfileutils.h    \
251         ghash.h         \
252         ghook.h         \
253         ghostutils.h    \
254         gi18n.h         \
255         gi18n-lib.h     \
256         giochannel.h    \
257         gkeyfile.h      \
258         glist.h         \
259         gmacros.h       \
260         gmain.h         \
261         gmappedfile.h   \
262         gmarkup.h       \
263         gmem.h          \
264         gmessages.h     \
265         gnode.h         \
266         goption.h       \
267         gpattern.h      \
268         gpoll.h         \
269         gprimes.h       \
270         gqsort.h        \
271         gquark.h        \
272         gqueue.h        \
273         grand.h         \
274         $(gregex_h)     \
275         grel.h          \
276         gscanner.h      \
277         gsequence.h     \
278         gshell.h        \
279         gslice.h        \
280         gslist.h        \
281         gspawn.h        \
282         gstdio.h        \
283         gstrfuncs.h     \
284         gtestutils.h    \
285         gstring.h       \
286         gthread.h       \
287         gthreadpool.h   \
288         gtimer.h        \
289         gtimezone.h     \
290         gtree.h         \
291         gtypes.h        \
292         gunicode.h      \
293         gurifuncs.h     \
294         gutils.h        \
295         gvarianttype.h  \
296         gvariant.h      \
297         gwin32.h        \
298         gprintf.h
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         $(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         $(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) \
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) \
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) \
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