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