Bug 548967 - 1 bit mutex lock
[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         gbitlock.c              \
113         gbookmarkfile.c         \
114         gbsearcharray.h         \
115         gcache.c                \
116         gchecksum.c             \
117         gcompletion.c           \
118         gconvert.c              \
119         gdataset.c              \
120         gdatasetprivate.h       \
121         gdate.c                 \
122         gdir.c                  \
123         gerror.c                \
124         gfileutils.c            \
125         ghash.c                 \
126         ghook.c                 \
127         ghostutils.c            \
128         giochannel.c            \
129         gkeyfile.c              \
130         glibintl.h              \
131         glist.c                 \
132         gmain.c                 \
133         gmappedfile.c           \
134         gmarkup.c               \
135         gmem.c                  \
136         gmessages.c             \
137         gmirroringtable.h       \
138         gnode.c                 \
139         goption.c               \
140         gpattern.c              \
141         gpoll.c                 \
142         gprimes.c               \
143         gqsort.c                \
144         gqueue.c                \
145         grel.c                  \
146         grand.c                 \
147         $(gregex_c)             \
148         gscanner.c              \
149         gscripttable.h          \
150         gsequence.c             \
151         gshell.c                \
152         gslice.c                \
153         gslist.c                \
154         gstdio.c                \
155         gstrfuncs.c             \
156         gstring.c               \
157         gtestutils.c            \
158         gthread.c               \
159         gthreadprivate.h        \
160         gthreadpool.c           \
161         gtimer.c                \
162         gtree.c                 \
163         guniprop.c              \
164         gutf8.c                 \
165         gunibreak.h             \
166         gunibreak.c             \
167         gunichartables.h        \
168         gunicollate.c           \
169         gunicomp.h              \
170         gunidecomp.h            \
171         gunidecomp.c            \
172         gunicodeprivate.h       \
173         gurifuncs.c             \
174         gutils.c                \
175         gvarianttype.c          \
176         gdebug.h                \
177         gprintf.c               \
178         gprintfint.h
179
180 EXTRA_libglib_2_0_la_SOURCES = \
181         giounix.c       \
182         giowin32.c      \
183         gspawn.c        \
184         gspawn-win32.c  \
185         gwin32.c
186
187 glibincludedir=$(includedir)/glib-2.0
188 glibinclude_HEADERS =   \
189         glib-object.h   \
190         glib.h
191
192 glibsubincludedir=$(includedir)/glib-2.0/glib
193 glibsubinclude_HEADERS =   \
194         galloca.h       \
195         garray.h        \
196         gasyncqueue.h   \
197         gatomic.h       \
198         gbacktrace.h    \
199         gbase64.h       \
200         gbitlock.h      \
201         gbookmarkfile.h \
202         gcache.h        \
203         gchecksum.h     \
204         gcompletion.h   \
205         gconvert.h      \
206         gdataset.h      \
207         gdate.h         \
208         gdir.h          \
209         gerror.h        \
210         gfileutils.h    \
211         ghash.h         \
212         ghook.h         \
213         ghostutils.h    \
214         gi18n.h         \
215         gi18n-lib.h     \
216         giochannel.h    \
217         gkeyfile.h      \
218         glist.h         \
219         gmacros.h       \
220         gmain.h         \
221         gmappedfile.h   \
222         gmarkup.h       \
223         gmem.h          \
224         gmessages.h     \
225         gnode.h         \
226         goption.h       \
227         gpattern.h      \
228         gpoll.h         \
229         gprimes.h       \
230         gqsort.h        \
231         gquark.h        \
232         gqueue.h        \
233         grand.h         \
234         $(gregex_h)     \
235         grel.h          \
236         gscanner.h      \
237         gsequence.h     \
238         gshell.h        \
239         gslice.h        \
240         gslist.h        \
241         gspawn.h        \
242         gstdio.h        \
243         gstrfuncs.h     \
244         gtestutils.h    \
245         gstring.h       \
246         gthread.h       \
247         gthreadpool.h   \
248         gtimer.h        \
249         gtree.h         \
250         gtypes.h        \
251         gunicode.h      \
252         gurifuncs.h             \
253         gutils.h        \
254         gvarianttype.h  \
255         gwin32.h        \
256         gprintf.h
257
258 install-data-local: install-ms-lib install-def-file
259         @if test -f $(glibincludedir)/glist.h ; then                                    \
260           echo "*** Old headers found in $(glibincludedir). You should remove the" ;    \
261           echo "*** contents of this directory and type 'make install' again." ;        \
262           false ;                                                                       \
263         fi
264
265 uninstall-local: uninstall-ms-lib uninstall-def-file
266
267 if PLATFORM_WIN32
268 no_undefined = -no-undefined
269 endif
270
271 if OS_WIN32_AND_DLL_COMPILATION
272 export_symbols = -export-symbols glib.def
273
274 glib_win32_res = glib-win32-res.o
275 glib_win32_res_ldflag = -Wl,$(glib_win32_res)
276
277 glib_def = glib.def
278
279 install-def-file:
280         $(INSTALL) glib.def $(DESTDIR)$(libdir)/glib-2.0.def
281
282 uninstall-def-file:
283         -rm $(DESTDIR)$(libdir)/glib-2.0.def
284 else
285 install-def-file:
286 uninstall-def-file:
287
288 export_symbols = $(LIBTOOL_EXPORT_OPTIONS)
289 endif
290
291 if ENABLE_REGEX
292 if USE_SYSTEM_PCRE
293 pcre_lib = $(PCRE_LIBS)
294 pcre_inc = $(PCRE_CFLAGS)
295 else
296 pcre_lib = pcre/libpcre.la
297 pcre_inc =
298 endif
299 else
300 pcre_lib =
301 pcre_inc =
302 endif
303
304 libglib_2_0_la_LIBADD = libcharset/libcharset.la $(printf_la) @GIO@ @GSPAWN@ @PLATFORMDEP@ @ICONV_LIBS@ @G_LIBS_EXTRA@ $(pcre_lib)
305 libglib_2_0_la_DEPENDENCIES = libcharset/libcharset.la $(printf_la) @GIO@ @GSPAWN@ @PLATFORMDEP@ $(glib_win32_res) $(glib_def)
306
307 libglib_2_0_la_LDFLAGS = \
308          $(glib_win32_res_ldflag) \
309         -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
310         -export-dynamic $(no_undefined) $(export_symbols)
311
312 INSTALL_PROGS=
313
314 gspawn-win32-helper-console.c:
315         echo '#define HELPER_CONSOLE' >$@
316         echo '#include "gspawn-win32-helper.c"' >>$@
317
318 gspawn-win64-helper.c:
319         echo '#include "gspawn-win32-helper.c"' >$@
320
321 gspawn-win64-helper-console.c:
322         echo '#define HELPER_CONSOLE' >$@
323         echo '#include "gspawn-win32-helper.c"' >>$@
324
325 if OS_WIN32
326 if OS_WIN32_X64
327 INSTALL_PROGS += gspawn-win64-helper gspawn-win64-helper-console
328 gspawn_win64_helper_LDADD = libglib-2.0.la
329 gspawn_win64_helper_LDFLAGS = -mwindows
330 gspawn_win64_helper_console_LDADD = libglib-2.0.la
331 else
332 INSTALL_PROGS += gspawn-win32-helper gspawn-win32-helper-console
333 gspawn_win32_helper_LDADD = libglib-2.0.la
334 gspawn_win32_helper_LDFLAGS = -mwindows
335 gspawn_win32_helper_console_LDADD = libglib-2.0.la
336 endif
337 endif
338
339 glib-win32-res.o: glib.rc
340         $(WINDRES) glib.rc $@
341
342 bin_PROGRAMS     = ${INSTALL_PROGS}
343
344 if OS_UNIX
345
346 INSTALL_PROGS   += gtester
347 gtester_SOURCES  = gtester.c
348 gtester_LDADD    = libglib-2.0.la 
349
350 auto_config_binscripts = gtester-report
351 bin_SCRIPTS = ${auto_config_binscripts}
352 EXTRA_DIST += ${auto_config_binscripts}
353
354 CONFIGVARS = \
355         "bindir"        : "${bindir}",          \
356         "glib-version"  : "${GLIB_VERSION}"
357
358 install-exec-hook:
359         for sf in ${auto_config_binscripts} ; do \
360           mv -f "$(DESTDIR)$(bindir)/$$sf" "$(DESTDIR)$(bindir)/$$sf".tmp \
361           && sed < "$(DESTDIR)$(bindir)/$$sf".tmp > "$(DESTDIR)$(bindir)/$$sf" \
362             -e '1,24s|^ *#@PKGINSTALL_CONFIGVARS_IN24LINES@|  ${CONFIGVARS}|' \
363             -e '1,1s|#! /usr/bin/env python\([0-9]\+\(\.[0-9]\+\)\?\)\?|#!${PYTHON}|' \
364           || exit $$? ; \
365           rm -f "$(DESTDIR)$(bindir)/$$sf".tmp ; \
366         done
367
368 endif
369
370 glib-2.0.lib: libglib-2.0.la glib.def
371         lib -machine:@LIB_EXE_MACHINE_FLAG@ -name:libglib-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:glib.def -out:$@
372
373 dist-hook: $(BUILT_EXTRA_DIST)
374         files='$(BUILT_EXTRA_DIST)'; \
375         for f in $$files; do \
376           if test -f $$f; then d=.; else d=$(srcdir); fi; \
377           cp $$d/$$f $(distdir) || exit 1; done
378
379 distclean-local:
380         if test $(srcdir) = .; then :; else \
381             rm -f libglib-gdb.py; \
382         fi
383
384 # install gdb scripts
385 gdbdir = $(datadir)/glib-2.0/gdb
386 dist_gdb_SCRIPTS = glib.py
387
388 libglib-gdb.py: libglib-gdb.py.in
389         sed -e "s|\@datadir\@|$(datadir)|" $(srcdir)/libglib-gdb.py.in > libglib-gdb.py
390
391
392 install-data-hook: libglib-gdb.py
393         mkdir -p $(DESTDIR)$(datadir)/gdb/auto-load$(ABS_GLIB_RUNTIME_LIBDIR)
394         $(INSTALL) libglib-gdb.py $(DESTDIR)$(datadir)/gdb/auto-load$(ABS_GLIB_RUNTIME_LIBDIR)/libglib-2.0.so.0.$(LT_CURRENT).$(LT_REVISION)-gdb.py
395 if HAVE_GLIB_RUNTIME_LIBDIR
396         mkdir -p $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
397         mv $(DESTDIR)$(libdir)/libglib-2.0.so.0 $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
398         mv $(DESTDIR)$(libdir)/libglib-2.0.so.0.$(LT_CURRENT).$(LT_REVISION) $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
399         rm -f $(DESTDIR)$(libdir)/libglib-2.0.so
400         ln -s $(GLIB_RUNTIME_LIBDIR)/libglib-2.0.so.0.$(LT_CURRENT).$(LT_REVISION) $(DESTDIR)$(libdir)/libglib-2.0.so
401 endif