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