move glibconfig.h to glib/
[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 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         -I$(top_srcdir)                 \
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-unicode-tables.pl   \
86         gen-script-table.pl     \
87         glibconfig.h.win32.in   \
88         abicheck.sh             \
89         glib.symbols            \
90         gregex.c                \
91         gregex.h                \
92         win_iconv.c             \
93         libglib-gdb.py.in       \
94         $(MIRRORING_TAB_SOURCE)
95
96 # These may be in the builddir too
97 BUILT_EXTRA_DIST =              \
98         makefile.msc            \
99         glibconfig.h.win32      \
100         glib.rc
101
102 lib_LTLIBRARIES = libglib-2.0.la
103
104 if OS_WIN32_AND_DLL_COMPILATION
105 if MS_LIB_AVAILABLE
106 noinst_DATA = glib-2.0.lib
107
108 install_ms_lib_cmd = $(INSTALL) glib-2.0.lib $(DESTDIR)$(libdir)
109 uninstall_ms_lib_cmd = -rm $(DESTDIR)$(libdir)/glib-2.0.lib
110 endif
111 endif
112
113 install-ms-lib:
114         $(install_ms_lib_cmd)
115
116 uninstall-ms-lib:
117         $(uninstall_ms_lib_cmd)
118
119 libglib_2_0_la_SOURCES =        \
120         glib_probes.d           \
121         garray.c                \
122         gasyncqueue.c           \
123         $(gatomic_c)            \
124         gbacktrace.c            \
125         gbase64.c               \
126         gbitlock.c              \
127         gbookmarkfile.c         \
128         gbsearcharray.h         \
129         gbuffer.c               \
130         gbuffer.h               \
131         gcache.c                \
132         gchecksum.c             \
133         gcompletion.c           \
134         gconvert.c              \
135         gdataset.c              \
136         gdatasetprivate.h       \
137         gdate.c                 \
138         gdir.c                  \
139         gerror.c                \
140         gfileutils.c            \
141         ghash.c                 \
142         ghook.c                 \
143         ghostutils.c            \
144         giochannel.c            \
145         gkeyfile.c              \
146         glibintl.h              \
147         glib_trace.h            \
148         glist.c                 \
149         gmain.c                 \
150         gmappedfile.c           \
151         gmarkup.c               \
152         gmem.c                  \
153         gmessages.c             \
154         gmirroringtable.h       \
155         gnode.c                 \
156         goption.c               \
157         gpattern.c              \
158         gpoll.c                 \
159         gprimes.c               \
160         gqsort.c                \
161         gqueue.c                \
162         grel.c                  \
163         grand.c                 \
164         $(gregex_c)             \
165         gscanner.c              \
166         gscripttable.h          \
167         gsequence.c             \
168         gshell.c                \
169         gslice.c                \
170         gslist.c                \
171         gstdio.c                \
172         gstrfuncs.c             \
173         gstring.c               \
174         gtestutils.c            \
175         gthread.c               \
176         gthreadprivate.h        \
177         gthreadpool.c           \
178         gtimer.c                \
179         gtree.c                 \
180         guniprop.c              \
181         gutf8.c                 \
182         gunibreak.h             \
183         gunibreak.c             \
184         gunichartables.h        \
185         gunicollate.c           \
186         gunicomp.h              \
187         gunidecomp.h            \
188         gunidecomp.c            \
189         gunicodeprivate.h       \
190         gurifuncs.c             \
191         gutils.c                \
192         gvariant.h              \
193         gvariant.c              \
194         gvariant-core.h         \
195         gvariant-core.c         \
196         gvariant-internal.h     \
197         gvariant-parser.c       \
198         gvariant-serialiser.h   \
199         gvariant-serialiser.c   \
200         gvarianttypeinfo.h      \
201         gvarianttypeinfo.c      \
202         gvarianttype.c          \
203         gdebug.h                \
204         gprintf.c               \
205         gprintfint.h
206
207
208 EXTRA_libglib_2_0_la_SOURCES = \
209         giounix.c       \
210         giowin32.c      \
211         gspawn.c        \
212         gspawn-win32.c  \
213         gwin32.c
214
215 glibincludedir=$(includedir)/glib-2.0
216 glibinclude_HEADERS =   \
217         glib-object.h   \
218         glib.h
219
220 glibsubincludedir=$(includedir)/glib-2.0/glib
221 glibsubinclude_HEADERS =   \
222         galloca.h       \
223         garray.h        \
224         gasyncqueue.h   \
225         gatomic.h       \
226         gbacktrace.h    \
227         gbase64.h       \
228         gbitlock.h      \
229         gbookmarkfile.h \
230         gcache.h        \
231         gchecksum.h     \
232         gcompletion.h   \
233         gconvert.h      \
234         gdataset.h      \
235         gdate.h         \
236         gdir.h          \
237         gerror.h        \
238         gfileutils.h    \
239         ghash.h         \
240         ghook.h         \
241         ghostutils.h    \
242         gi18n.h         \
243         gi18n-lib.h     \
244         giochannel.h    \
245         gkeyfile.h      \
246         glist.h         \
247         gmacros.h       \
248         gmain.h         \
249         gmappedfile.h   \
250         gmarkup.h       \
251         gmem.h          \
252         gmessages.h     \
253         gnode.h         \
254         goption.h       \
255         gpattern.h      \
256         gpoll.h         \
257         gprimes.h       \
258         gqsort.h        \
259         gquark.h        \
260         gqueue.h        \
261         grand.h         \
262         $(gregex_h)     \
263         grel.h          \
264         gscanner.h      \
265         gsequence.h     \
266         gshell.h        \
267         gslice.h        \
268         gslist.h        \
269         gspawn.h        \
270         gstdio.h        \
271         gstrfuncs.h     \
272         gtestutils.h    \
273         gstring.h       \
274         gthread.h       \
275         gthreadpool.h   \
276         gtimer.h        \
277         gtree.h         \
278         gtypes.h        \
279         gunicode.h      \
280         gurifuncs.h             \
281         gutils.h        \
282         gvarianttype.h  \
283         gvariant.h      \
284         gwin32.h        \
285         gprintf.h
286
287 install-data-local: install-ms-lib install-def-file
288         @if test -f $(glibincludedir)/glist.h ; then                                    \
289           echo "*** Old headers found in $(glibincludedir). You should remove the" ;    \
290           echo "*** contents of this directory and type 'make install' again." ;        \
291           false ;                                                                       \
292         fi
293
294 uninstall-local: uninstall-ms-lib uninstall-def-file
295
296 if PLATFORM_WIN32
297 no_undefined = -no-undefined
298 endif
299
300 if OS_WIN32_AND_DLL_COMPILATION
301 export_symbols = -export-symbols glib.def
302
303 glib_win32_res = glib-win32-res.o
304 glib_win32_res_ldflag = -Wl,$(glib_win32_res)
305
306 glib_def = glib.def
307
308 install-def-file:
309         $(INSTALL) glib.def $(DESTDIR)$(libdir)/glib-2.0.def
310
311 uninstall-def-file:
312         -rm $(DESTDIR)$(libdir)/glib-2.0.def
313 else
314 install-def-file:
315 uninstall-def-file:
316
317 export_symbols = $(LIBTOOL_EXPORT_OPTIONS)
318 endif
319
320 if ENABLE_REGEX
321 if USE_SYSTEM_PCRE
322 pcre_lib = $(PCRE_LIBS)
323 pcre_inc = $(PCRE_CFLAGS)
324 else
325 pcre_lib = pcre/libpcre.la
326 pcre_inc =
327 endif
328 else
329 pcre_lib =
330 pcre_inc =
331 endif
332
333 libglib_2_0_la_LIBADD = libcharset/libcharset.la $(printf_la) @GIO@ @GSPAWN@ @PLATFORMDEP@ @ICONV_LIBS@ @G_LIBS_EXTRA@ $(pcre_lib)
334 libglib_2_0_la_DEPENDENCIES = libcharset/libcharset.la $(printf_la) @GIO@ @GSPAWN@ @PLATFORMDEP@ $(glib_win32_res) $(glib_def)
335
336 libglib_2_0_la_LDFLAGS = $(GLIB_LINK_FLAGS) \
337          $(glib_win32_res_ldflag) \
338         -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
339         -export-dynamic $(no_undefined) $(export_symbols)
340
341 INSTALL_PROGS=
342
343 if ENABLE_DTRACE
344 glib_probes.h: glib_probes.d Makefile
345         $(DTRACE) -C -h -s $< -o $@.tmp
346         sed -e "s,define STAP_HAS_SEMAPHORES 1,undef STAP_HAS_SEMAPHORES," < $@.tmp > $@ && rm -f $@.tmp
347 glib_probes.o: glib_probes.d Makefile
348         $(DTRACE) -G -s $< -o $@
349 BUILT_SOURCES += glib_probes.h glib_probes.o
350 CLEANFILES += glib_probes.h glib_probes.h.tmp
351 libglib_2_0_la_LIBADD += glib_probes.o
352 endif
353
354 if ENABLE_SYSTEMTAP
355 tapset_in_files = glib.stp.in
356 tapsetdir   = $(DESTDIR)@ABS_TAPSET_DIR@
357 tapset_DATA = $(tapset_in_files:.stp.in=.stp)
358 EXTRA_DIST += $(tapset_in_files)
359 endif
360
361 gspawn-win32-helper-console.c:
362         echo '#define HELPER_CONSOLE' >$@
363         echo '#include "gspawn-win32-helper.c"' >>$@
364
365 gspawn-win64-helper.c:
366         echo '#include "gspawn-win32-helper.c"' >$@
367
368 gspawn-win64-helper-console.c:
369         echo '#define HELPER_CONSOLE' >$@
370         echo '#include "gspawn-win32-helper.c"' >>$@
371
372
373 if OS_WIN32
374 if OS_WIN32_X64
375 INSTALL_PROGS += gspawn-win64-helper gspawn-win64-helper-console
376 gspawn_win64_helper_LDADD = libglib-2.0.la
377 gspawn_win64_helper_LDFLAGS = -mwindows
378 gspawn_win64_helper_console_LDADD = libglib-2.0.la
379 else
380 INSTALL_PROGS += gspawn-win32-helper gspawn-win32-helper-console
381 gspawn_win32_helper_LDADD = libglib-2.0.la
382 gspawn_win32_helper_LDFLAGS = -mwindows
383 gspawn_win32_helper_console_LDADD = libglib-2.0.la
384 endif
385 endif
386
387 glib-win32-res.o: glib.rc
388         $(WINDRES) glib.rc $@
389
390 bin_PROGRAMS     = ${INSTALL_PROGS}
391
392 if OS_UNIX
393
394 INSTALL_PROGS   += gtester
395 gtester_SOURCES  = gtester.c
396 gtester_LDADD    = libglib-2.0.la 
397
398 auto_config_binscripts = gtester-report
399 bin_SCRIPTS = ${auto_config_binscripts}
400 EXTRA_DIST += ${auto_config_binscripts}
401
402 CONFIGVARS = \
403         "bindir"        : "${bindir}",          \
404         "glib-version"  : "${GLIB_VERSION}"
405
406 install-exec-hook:
407         for sf in ${auto_config_binscripts} ; do \
408           mv -f "$(DESTDIR)$(bindir)/$$sf" "$(DESTDIR)$(bindir)/$$sf".tmp \
409           && sed < "$(DESTDIR)$(bindir)/$$sf".tmp > "$(DESTDIR)$(bindir)/$$sf" \
410             -e '1,24s|^ *#@PKGINSTALL_CONFIGVARS_IN24LINES@|  ${CONFIGVARS}|' \
411             -e '1,1s|#! /usr/bin/env python\([0-9]\+\(\.[0-9]\+\)\?\)\?|#!${PYTHON}|' \
412           || exit $$? ; \
413           chmod a+x $(DESTDIR)$(bindir)/$$sf ; \
414           rm -f "$(DESTDIR)$(bindir)/$$sf".tmp ; \
415         done
416
417 endif
418
419 glib-2.0.lib: libglib-2.0.la glib.def
420         lib -machine:@LIB_EXE_MACHINE_FLAG@ -name:libglib-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:glib.def -out:$@
421
422 dist-hook: $(BUILT_EXTRA_DIST) ../build/win32/vs9/glib.vcproj
423         files='$(BUILT_EXTRA_DIST)'; \
424         for f in $$files; do \
425           if test -f $$f; then d=.; else d=$(srcdir); fi; \
426           cp $$d/$$f $(distdir) || exit 1; done
427
428 ../build/win32/vs9/glib.vcproj: $(top_srcdir)/build/win32/vs9/glib.vcprojin
429         for F in $(libglib_2_0_la_SOURCES); do \
430                 case $$F in \
431                 *-gcc.c) \
432                         ;; \
433                 *.c)    echo '   <File RelativePath="..\..\..\glib\'$$F'" />' \
434                         ;; \
435                 esac; \
436         done >libglib.sourcefiles
437         $(CPP) -P - <$(top_srcdir)/build/win32/vs9/glib.vcprojin >$@
438
439 distclean-local:
440         if test $(srcdir) = .; then :; else \
441             rm -f libglib-gdb.py; \
442         fi
443
444 # install gdb scripts
445 gdbdir = $(datadir)/glib-2.0/gdb
446 dist_gdb_SCRIPTS = glib.py
447
448 libglib-gdb.py: libglib-gdb.py.in
449         $(AM_V_GEN) $(SED) -e "s|\@datadir\@|$(datadir)|" $(srcdir)/libglib-gdb.py.in > libglib-gdb.py
450
451
452 install-data-hook: libglib-gdb.py
453         mkdir -p $(DESTDIR)$(datadir)/gdb/auto-load$(ABS_GLIB_RUNTIME_LIBDIR)
454         $(INSTALL) libglib-gdb.py $(DESTDIR)$(datadir)/gdb/auto-load$(ABS_GLIB_RUNTIME_LIBDIR)/libglib-2.0.so.0.$(LT_CURRENT).$(LT_REVISION)-gdb.py
455 if HAVE_GLIB_RUNTIME_LIBDIR
456         mkdir -p $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
457         mv $(DESTDIR)$(libdir)/libglib-2.0.so.0 $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
458         mv $(DESTDIR)$(libdir)/libglib-2.0.so.0.$(LT_CURRENT).$(LT_REVISION) $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
459         rm -f $(DESTDIR)$(libdir)/libglib-2.0.so
460         ln -s $(GLIB_RUNTIME_LIBDIR)/libglib-2.0.so.0.$(LT_CURRENT).$(LT_REVISION) $(DESTDIR)$(libdir)/libglib-2.0.so
461 endif