Move this out of gmain.c and make it part of the public API. (Part of Bug
[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 if HAVE_GOOD_PRINTF
5 else
6 PRINTF_SUBDIR = gnulib
7 printf_la = gnulib/libgnulib.la
8 endif 
9
10 if ENABLE_REGEX
11 if USE_SYSTEM_PCRE
12 else
13 MAYBE_PCRE = pcre 
14 endif
15 gregex_c = gregex.c
16 gregex_h = gregex.h
17 else
18 gregex_c =
19 gregex_h =
20 endif
21
22 SUBDIRS = libcharset $(PRINTF_SUBDIR) $(MAYBE_PCRE) update-pcre . tests
23
24 DIST_SUBDIRS = libcharset gnulib pcre update-pcre tests
25
26 AM_CPPFLAGS =                           \
27         -I$(top_srcdir)                 \
28         $(pcre_inc)                     \
29         -DG_LOG_DOMAIN=\"GLib\"         \
30         $(GLIB_DEBUG_FLAGS)             \
31         -DG_DISABLE_DEPRECATED          \
32         -DGLIB_COMPILATION              \
33         -DPCRE_STATIC
34
35 glib.def: glib.symbols
36         (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
37
38 galias.h: glib.symbols
39           $(PERL) $(srcdir)/makegalias.pl < $(srcdir)/glib.symbols > galias.h
40
41 galiasdef.c: glib.symbols
42           $(PERL) $(srcdir)/makegalias.pl -def < $(srcdir)/glib.symbols > galiasdef.c
43
44 if OS_LINUX
45 if HAVE_GNUC_VISIBILITY
46 TESTS_ENVIRONMENT = GLIB_DEBUG_FLAGS="$(GLIB_DEBUG_FLAGS)"
47 TESTS = abicheck.sh pltcheck.sh
48 endif
49 endif
50
51 BUILT_SOURCES = galias.h galiasdef.c
52
53 MIRRORING_TAB_SOURCE =                          \
54         glib-mirroring-tab/Makefile             \
55         glib-mirroring-tab/gen-mirroring-tab.c  \
56         glib-mirroring-tab/packtab.h            \
57         glib-mirroring-tab/packtab.c
58
59 # The compilation of GRegex can be disabled, but the source files must
60 # be distributed.
61 EXTRA_DIST +=                   \
62         makefile.msc.in         \
63         glib.rc.in              \
64         gen-unicode-tables.pl   \
65         gen-script-table.pl     \
66         makegalias.pl           \
67         abicheck.sh             \
68         pltcheck.sh             \
69         glib.symbols            \
70         gregex.c                \
71         gregex.h                \
72         win_iconv.c             \
73         $(MIRRORING_TAB_SOURCE)
74
75 # These may be in the builddir too
76 BUILT_EXTRA_DIST =              \
77         makefile.msc            \
78         glib.rc                 \
79         galias.h                \
80         galiasdef.c
81
82 lib_LTLIBRARIES = libglib-2.0.la
83
84 if OS_WIN32_AND_DLL_COMPILATION
85 if MS_LIB_AVAILABLE
86 noinst_DATA = glib-2.0.lib
87
88 install_ms_lib_cmd = $(INSTALL) glib-2.0.lib $(DESTDIR)$(libdir)
89 uninstall_ms_lib_cmd = -rm $(DESTDIR)$(libdir)/glib-2.0.lib
90 endif
91 endif
92
93 install-ms-lib:
94         $(install_ms_lib_cmd)
95
96 uninstall-ms-lib:
97         $(uninstall_ms_lib_cmd)
98
99 libglib_2_0_la_SOURCES =        \
100         garray.c                \
101         gasyncqueue.c           \
102         gatomic.c               \
103         gbacktrace.c            \
104         gbase64.c               \
105         gbookmarkfile.c         \
106         gbsearcharray.h         \
107         gcache.c                \
108         gchecksum.c             \
109         gcompletion.c           \
110         gconvert.c              \
111         gdataset.c              \
112         gdatasetprivate.h       \
113         gdate.c                 \
114         gdir.c                  \
115         gerror.c                \
116         gfileutils.c            \
117         ghash.c                 \
118         ghook.c                 \
119         giochannel.c            \
120         gkeyfile.c              \
121         glibintl.h              \
122         glist.c                 \
123         gmain.c                 \
124         gmappedfile.c           \
125         gmarkup.c               \
126         gmem.c                  \
127         gmessages.c             \
128         gmirroringtable.h       \
129         gnode.c                 \
130         goption.c               \
131         gpattern.c              \
132         gpoll.c                 \
133         gprimes.c               \
134         gqsort.c                \
135         gqueue.c                \
136         grel.c                  \
137         grand.c                 \
138         $(gregex_c)             \
139         gscanner.c              \
140         gscripttable.h          \
141         gsequence.c             \
142         gshell.c                \
143         gslice.c                \
144         gslist.c                \
145         gstdio.c                \
146         gstrfuncs.c             \
147         gstring.c               \
148         gtestutils.c            \
149         gthread.c               \
150         gthreadprivate.h        \
151         gthreadpool.c           \
152         gtimer.c                \
153         gtree.c                 \
154         guniprop.c              \
155         gutf8.c                 \
156         gunibreak.h             \
157         gunibreak.c             \
158         gunichartables.h        \
159         gunicollate.c           \
160         gunicomp.h              \
161         gunidecomp.h            \
162         gunidecomp.c            \
163         gunicodeprivate.h       \
164         gurifuncs.c             \
165         gutils.c                \
166         gdebug.h                \
167         gprintf.c               \
168         gprintfint.h
169
170 EXTRA_libglib_2_0_la_SOURCES = \
171         giounix.c       \
172         giowin32.c      \
173         gspawn.c        \
174         gspawn-win32.c  \
175         gwin32.c
176
177 glibincludedir=$(includedir)/glib-2.0
178 glibinclude_HEADERS =   \
179         glib-object.h   \
180         glib.h
181
182 glibsubincludedir=$(includedir)/glib-2.0/glib
183 glibsubinclude_HEADERS =   \
184         galloca.h       \
185         garray.h        \
186         gasyncqueue.h   \
187         gatomic.h       \
188         gbacktrace.h    \
189         gbase64.h       \
190         gbookmarkfile.h \
191         gcache.h        \
192         gchecksum.h     \
193         gcompletion.h   \
194         gconvert.h      \
195         gdataset.h      \
196         gdate.h         \
197         gdir.h          \
198         gerror.h        \
199         gfileutils.h    \
200         ghash.h         \
201         ghook.h         \
202         gi18n.h         \
203         gi18n-lib.h     \
204         giochannel.h    \
205         gkeyfile.h      \
206         glist.h         \
207         gmacros.h       \
208         gmain.h         \
209         gmappedfile.h   \
210         gmarkup.h       \
211         gmem.h          \
212         gmessages.h     \
213         gnode.h         \
214         goption.h       \
215         gpattern.h      \
216         gpoll.h         \
217         gprimes.h       \
218         gqsort.h        \
219         gquark.h        \
220         gqueue.h        \
221         grand.h         \
222         $(gregex_h)     \
223         grel.h          \
224         gscanner.h      \
225         gsequence.h     \
226         gshell.h        \
227         gslice.h        \
228         gslist.h        \
229         gspawn.h        \
230         gstdio.h        \
231         gstrfuncs.h     \
232         gtestutils.h    \
233         gstring.h       \
234         gthread.h       \
235         gthreadpool.h   \
236         gtimer.h        \
237         gtree.h         \
238         gtypes.h        \
239         gunicode.h      \
240         gurifuncs.h             \
241         gutils.h        \
242         gwin32.h        \
243         gprintf.h
244
245 install-data-local: install-ms-lib install-def-file
246         @if test -f $(glibincludedir)/glist.h ; then                                    \
247           echo "*** Old headers found in $(glibincludedir). You should remove the" ;    \
248           echo "*** contents of this directory and type 'make install' again." ;        \
249           false ;                                                                       \
250         fi
251
252 uninstall-local: uninstall-ms-lib uninstall-def-file
253
254 if PLATFORM_WIN32
255 no_undefined = -no-undefined
256 endif
257
258 if OS_WIN32_AND_DLL_COMPILATION
259 export_symbols = -export-symbols glib.def
260
261 glib_win32_res = glib-win32-res.o
262 glib_win32_res_ldflag = -Wl,$(glib_win32_res)
263
264 glib_def = glib.def
265
266 install-def-file:
267         $(INSTALL) glib.def $(DESTDIR)$(libdir)/glib-2.0.def
268
269 uninstall-def-file:
270         -rm $(DESTDIR)$(libdir)/glib-2.0.def
271 else
272 install-def-file:
273 uninstall-def-file:
274
275 export_symbols = $(LIBTOOL_EXPORT_OPTIONS)
276 endif
277
278 if ENABLE_REGEX
279 if USE_SYSTEM_PCRE
280 pcre_lib = $(PCRE_LIBS)
281 pcre_inc = $(PCRE_CFLAGS)
282 else
283 pcre_lib = pcre/libpcre.la
284 pcre_inc =
285 endif
286 else
287 pcre_lib =
288 pcre_inc =
289 endif
290
291 libglib_2_0_la_LIBADD = libcharset/libcharset.la $(printf_la) @GIO@ @GSPAWN@ @PLATFORMDEP@ @ICONV_LIBS@ @G_LIBS_EXTRA@ $(pcre_lib)
292 libglib_2_0_la_DEPENDENCIES = libcharset/libcharset.la $(printf_la) @GIO@ @GSPAWN@ @PLATFORMDEP@ $(glib_win32_res) $(glib_def)
293
294 libglib_2_0_la_LDFLAGS = \
295          $(glib_win32_res_ldflag) \
296         -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
297         -export-dynamic $(no_undefined) $(export_symbols)
298
299 INSTALL_PROGS=
300
301 gspawn-win32-helper-console.c:
302         echo '#define HELPER_CONSOLE' >$@
303         echo '#include "gspawn-win32-helper.c"' >>$@
304
305 gspawn-win64-helper.c:
306         echo '#include "gspawn-win32-helper.c"' >$@
307
308 gspawn-win64-helper-console.c:
309         echo '#define HELPER_CONSOLE' >$@
310         echo '#include "gspawn-win32-helper.c"' >>$@
311
312 if OS_WIN32
313 if OS_WIN32_X64
314 INSTALL_PROGS += gspawn-win64-helper gspawn-win64-helper-console
315 gspawn_win64_helper_LDADD = libglib-2.0.la
316 gspawn_win64_helper_LDFLAGS = -mwindows
317 gspawn_win64_helper_console_LDADD = libglib-2.0.la
318 else
319 INSTALL_PROGS += gspawn-win32-helper gspawn-win32-helper-console
320 gspawn_win32_helper_LDADD = libglib-2.0.la
321 gspawn_win32_helper_LDFLAGS = -mwindows
322 gspawn_win32_helper_console_LDADD = libglib-2.0.la
323 endif
324 endif
325
326 glib-win32-res.o: glib.rc
327         $(WINDRES) glib.rc $@
328
329 bin_PROGRAMS     = ${INSTALL_PROGS}
330
331 if OS_UNIX
332
333 INSTALL_PROGS   += gtester
334 gtester_SOURCES  = gtester.c
335 gtester_LDADD    = libglib-2.0.la 
336
337 auto_config_binscripts = gtester-report
338 bin_SCRIPTS = ${auto_config_binscripts}
339 EXTRA_DIST += ${auto_config_binscripts}
340
341 CONFIGVARS = \
342         "bindir"        : "${bindir}",          \
343         "glib-version"  : "${GLIB_VERSION}"
344
345 install-exec-hook:
346         for sf in ${auto_config_binscripts} ; do \
347           mv -f "$(DESTDIR)$(bindir)/$$sf" "$(DESTDIR)$(bindir)/$$sf".tmp \
348           && sed < "$(DESTDIR)$(bindir)/$$sf".tmp > "$(DESTDIR)$(bindir)/$$sf" \
349             -e '1,24s|^ *#@PKGINSTALL_CONFIGVARS_IN24LINES@|  ${CONFIGVARS}|' \
350             -e '1,1s|#!/usr/bin/env python\([0-9]\+\(\.[0-9]\+\)\?\)\?|#!${PYTHON}|' \
351           || exit $$? ; \
352           rm -f "$(DESTDIR)$(bindir)/$$sf".tmp ; \
353         done
354
355 endif
356
357 glib-2.0.lib: libglib-2.0.la glib.def
358         lib -machine:@LIB_EXE_MACHINE_FLAG@ -name:libglib-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:glib.def -out:$@
359
360 dist-hook: $(BUILT_EXTRA_DIST)
361         files='$(BUILT_EXTRA_DIST)'; \
362         for f in $$files; do \
363           if test -f $$f; then d=.; else d=$(srcdir); fi; \
364           cp $$d/$$f $(distdir) || exit 1; done