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