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