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