Fix build with the Microsoft compiler
[platform/upstream/glib.git] / gio / Makefile.am
1 include $(top_srcdir)/Makefile.decl
2
3 NULL =
4
5 SUBDIRS=
6
7 if OS_UNIX
8 SUBDIRS += libasyncns xdgmime
9 endif
10
11 if OS_WIN32_AND_DLL_COMPILATION
12 if MS_LIB_AVAILABLE
13 noinst_DATA = gio-2.0.lib
14
15 install_ms_lib_cmd = $(INSTALL) gio-2.0.lib $(DESTDIR)$(libdir)
16 uninstall_ms_lib_cmd = -rm $(DESTDIR)$(libdir)/gio-2.0.lib
17 endif
18 endif
19
20 install-ms-lib:
21         $(install_ms_lib_cmd)
22
23 uninstall-ms-lib:
24         $(uninstall_ms_lib_cmd)
25
26 gio.def: gio.symbols
27         $(AM_V_GEN) (echo -e EXPORTS; $(CPP) -P -DINCLUDE_VARIABLES -DINCLUDE_INTERNAL_SYMBOLS -DG_OS_WIN32 -DALL_FILES - <$(srcdir)/gio.symbols | sed -e '/^$$/d' -e 's/^/     /' -e 's/G_GNUC_[^ ]*//g' | sort) > gio.def.tmp && \
28           mv gio.def.tmp gio.def
29
30 gioalias.h: gio.symbols makegioalias.pl
31         $(AM_V_GEN) $(PERL) $(srcdir)/makegioalias.pl < $(srcdir)/gio.symbols > gioalias.h.tmp && \
32           mv gioalias.h.tmp gioalias.h
33
34 gioaliasdef.c: gio.symbols makegioalias.pl
35         $(AM_V_GEN) $(PERL) $(srcdir)/makegioalias.pl -def < $(srcdir)/gio.symbols > gioaliasdef.c.tmp && \
36           mv gioaliasdef.c.tmp gioaliasdef.c
37
38 if OS_LINUX
39 if HAVE_GNUC_VISIBILITY
40 TESTS = abicheck.sh pltcheck.sh
41 endif
42 endif
43
44 if HAVE_THREADS
45 THREAD_FLAGS=-DG_THREADS_MANDATORY
46 endif
47
48 AM_CPPFLAGS = \
49         -DG_LOG_DOMAIN=\"GLib-GIO\"                     \
50         -I$(top_builddir)                               \
51         -I$(top_srcdir)                                 \
52         -I$(top_srcdir)/glib                            \
53         -I$(top_srcdir)/gmodule                         \
54         $(GLIB_DEBUG_FLAGS)                             \
55         $(THREAD_FLAGS)                                 \
56         -DG_DISABLE_DEPRECATED                          \
57         -DGIO_COMPILATION                               \
58         -DGIO_MODULE_DIR=\"$(GIO_MODULE_DIR)\"  
59
60 lib_LTLIBRARIES = libgio-2.0.la
61
62 marshal_sources = \
63         gio-marshal.h   \
64         gio-marshal.c   \
65         $(NULL)
66
67 if CROSS_COMPILING
68   glib_genmarshal=$(GLIB_GENMARSHAL)
69 else
70   glib_genmarshal=../gobject/glib-genmarshal
71 endif
72
73 gio-marshal.h: gio-marshal.list
74         $(AM_V_GEN) $(glib_genmarshal) --prefix=_gio_marshal $(srcdir)/gio-marshal.list --header --internal > $@.tmp && \
75           mv $@.tmp $@
76
77 gio-marshal.c: gio-marshal.h gio-marshal.list
78         $(AM_V_GEN) (echo "#include \"gio-marshal.h\""; \
79         $(glib_genmarshal) --prefix=_gio_marshal $(srcdir)/gio-marshal.list --body --internal) > $@.tmp && \
80           mv $@.tmp $@
81
82 gdbus_headers =                         \
83         gdbusauthobserver.h             \
84         gcredentials.h                  \
85         gdbusutils.h                    \
86         gdbuserror.h                    \
87         gdbusaddress.h                  \
88         gdbusconnection.h               \
89         gdbusmessage.h                  \
90         gdbusnameowning.h               \
91         gdbusnamewatching.h             \
92         gdbusproxy.h                    \
93         gdbusintrospection.h            \
94         gdbusmethodinvocation.h         \
95         gdbusserver.h                   \
96         $(NULL)
97
98 gdbus_sources =                                                         \
99         gdbusutils.h                    gdbusutils.c                    \
100         gdbusaddress.h                  gdbusaddress.c                  \
101         gdbusauthobserver.h             gdbusauthobserver.c             \
102         gdbusauth.h                     gdbusauth.c                     \
103         gdbusauthmechanism.h            gdbusauthmechanism.c            \
104         gdbusauthmechanismanon.h        gdbusauthmechanismanon.c        \
105         gdbusauthmechanismexternal.h    gdbusauthmechanismexternal.c    \
106         gdbusauthmechanismsha1.h        gdbusauthmechanismsha1.c        \
107         gdbuserror.h                    gdbuserror.c                    \
108         gdbusconnection.h               gdbusconnection.c               \
109         gdbusmessage.h                  gdbusmessage.c                  \
110         gdbusnameowning.h               gdbusnameowning.c               \
111         gdbusnamewatching.h             gdbusnamewatching.c             \
112         gdbusproxy.h                    gdbusproxy.c                    \
113         gdbusprivate.h                  gdbusprivate.c                  \
114         gdbusintrospection.h            gdbusintrospection.c            \
115         gdbusmethodinvocation.h         gdbusmethodinvocation.c         \
116         gdbusserver.h                   gdbusserver.c                   \
117         $(NULL)
118
119 settings_headers = \
120         gsettingsbackend.h              \
121         gsettings.h
122
123 settings_sources = \
124         gvdb/gvdb-format.h              \
125         gvdb/gvdb-reader.h              \
126         gvdb/gvdb-reader.c              \
127         gdelayedsettingsbackend.h       \
128         gdelayedsettingsbackend.c       \
129         gkeyfilesettingsbackend.h       \
130         gkeyfilesettingsbackend.c       \
131         gmemorysettingsbackend.h        \
132         gmemorysettingsbackend.c        \
133         gnullsettingsbackend.h          \
134         gnullsettingsbackend.c          \
135         gsettingsbackendinternal.h      \
136         gsettingsbackend.c              \
137         gsettingsschema.h               \
138         gsettingsschema.c               \
139         gsettings-mapping.h             \
140         gsettings-mapping.c             \
141         gsettings.c
142
143 local_sources = \
144         glocaldirectorymonitor.c        \
145         glocaldirectorymonitor.h        \
146         glocalfile.c                    \
147         glocalfile.h                    \
148         glocalfileenumerator.c          \
149         glocalfileenumerator.h          \
150         glocalfileinfo.c                \
151         glocalfileinfo.h                \
152         glocalfileinputstream.c         \
153         glocalfileinputstream.h         \
154         glocalfilemonitor.c             \
155         glocalfilemonitor.h             \
156         glocalfileoutputstream.c        \
157         glocalfileoutputstream.h        \
158         glocalfileiostream.c            \
159         glocalfileiostream.h            \
160         glocalvfs.c                     \
161         glocalvfs.h                     \
162         $(NULL)
163
164 platform_libadd =
165 platform_deps =
166 appinfo_sources =
167
168 if HAVE_INOTIFY
169 SUBDIRS += inotify
170 platform_libadd += inotify/libinotify.la
171 platform_deps += inotify/libinotify.la
172 endif
173
174 if HAVE_FEN
175 AM_CPPFLAGS += -DHAVE_FEN
176 SUBDIRS += fen
177 platform_libadd += fen/libfen.la
178 platform_deps += fen/libfen.la
179 endif
180
181 if OS_WIN32
182 SUBDIRS += win32
183 platform_libadd += win32/libgiowin32.la
184 platform_deps += win32/libgiowin32.la
185 endif
186
187
188 SUBDIRS += .
189
190 if HAVE_FAM
191 SUBDIRS += fam
192 endif
193
194 if OS_UNIX
195 appinfo_sources += gdesktopappinfo.c
196 platform_libadd += libasyncns/libasyncns.la xdgmime/libxdgmime.la
197 platform_deps += libasyncns/libasyncns.la xdgmime/libxdgmime.la
198 unix_sources = \
199         gfiledescriptorbased.c  \
200         gunixconnection.c       \
201         gunixcredentialsmessage.c       \
202         gunixfdlist.c           \
203         gunixfdmessage.c        \
204         gunixmount.c            \
205         gunixmount.h            \
206         gunixmounts.c           \
207         gunixresolver.c         \
208         gunixresolver.h         \
209         gunixsocketaddress.c    \
210         gunixvolume.c           \
211         gunixvolume.h           \
212         gunixvolumemonitor.c    \
213         gunixvolumemonitor.h    \
214         gunixinputstream.c      \
215         gunixoutputstream.c     \
216         $(NULL)
217
218
219 giounixincludedir=$(includedir)/gio-unix-2.0/gio
220 giounixinclude_HEADERS = \
221         gdesktopappinfo.h       \
222         gfiledescriptorbased.h  \
223         gunixconnection.h       \
224         gunixcredentialsmessage.h       \
225         gunixmounts.h           \
226         gunixfdlist.h           \
227         gunixfdmessage.h        \
228         gunixinputstream.h      \
229         gunixoutputstream.h     \
230         gunixsocketaddress.h    \
231         $(NULL)
232 endif
233
234 win32_actual_sources = \
235         gwin32mount.c \
236         gwin32mount.h \
237         gwin32resolver.c \
238         gwin32resolver.h \
239         gwin32volumemonitor.c \
240         gwin32volumemonitor.h \
241         gwin32inputstream.c \
242         gwin32outputstream.c \
243         gwin32outputstream.h \
244         $(NULL)
245
246 win32_more_sources_for_vcproj = \
247         gwin32appinfo.c \
248         win32/gwin32directorymonitor.c \
249         win32/gwinhttpfile.c \
250         win32/gwinhttpfileinputstream.c \
251         win32/gwinhttpfileoutputstream.c \
252         win32/gwinhttpvfs.c
253
254 if OS_WIN32
255 appinfo_sources += gwin32appinfo.c gwin32appinfo.h
256 platform_libadd += -lshlwapi -lws2_32 -ldnsapi
257 win32_sources = $(win32_actual_sources)
258
259 giowin32includedir=$(includedir)/gio-win32-2.0/gio
260 giowin32include_HEADERS = \
261         gwin32inputstream.h \
262         gwin32outputstream.h \
263         $(NULL)
264
265 endif
266
267 SUBDIRS += tests
268
269 libgio_2_0_la_SOURCES =         \
270         gappinfo.c              \
271         gapplication.c          \
272         gapplication.h          \
273         gasynchelper.c          \
274         gasynchelper.h          \
275         gasyncinitable.c        \
276         gasyncresult.c          \
277         gbufferedinputstream.c  \
278         gbufferedoutputstream.c \
279         gcancellable.c          \
280         gcontenttype.c          \
281         gcontenttypeprivate.h   \
282         gcharsetconverter.c     \
283         gconverter.c            \
284         gconverterinputstream.c \
285         gconverteroutputstream.c        \
286         gcredentials.c          \
287         gdatainputstream.c      \
288         gdataoutputstream.c     \
289         gdrive.c                \
290         gdummyfile.h            \
291         gdummyfile.c            \
292         gemblem.h               \
293         gemblem.c               \
294         gemblemedicon.h         \
295         gemblemedicon.c         \
296         gfile.c                 \
297         gfileattribute.c        \
298         gfileattribute-priv.h   \
299         gfileenumerator.c       \
300         gfileicon.c             \
301         gfileinfo.c             \
302         gfileinfo-priv.h        \
303         gfileinputstream.c      \
304         gfilemonitor.c          \
305         gfilenamecompleter.c    \
306         gfileoutputstream.c     \
307         gfileiostream.c         \
308         gfilterinputstream.c    \
309         gfilteroutputstream.c   \
310         gicon.c                 \
311         ginetaddress.c          \
312         ginetsocketaddress.c    \
313         ginitable.c             \
314         ginputstream.c          \
315         gioenums.h              \
316         gioerror.c              \
317         giomodule.c             \
318         giomodule-priv.h        \
319         gioscheduler.c          \
320         giostream.c             \
321         gloadableicon.c         \
322         gmount.c                \
323         gmemoryinputstream.c    \
324         gmemoryoutputstream.c   \
325         gmountoperation.c       \
326         gnativevolumemonitor.c  \
327         gnativevolumemonitor.h  \
328         gnetworkaddress.c       \
329         gnetworkingprivate.h    \
330         gnetworkservice.c       \
331         goutputstream.c         \
332         gpermission.c           \
333         gpollfilemonitor.c      \
334         gpollfilemonitor.h      \
335         gresolver.c             \
336         gseekable.c             \
337         gsimpleasyncresult.c    \
338         gsimplepermission.c     \
339         gsocket.c               \
340         gsocketaddress.c        \
341         gsocketaddressenumerator.c \
342         gsocketclient.c         \
343         gsocketconnectable.c    \
344         gsocketconnection.c     \
345         gsocketcontrolmessage.c \
346         gsocketinputstream.c    \
347         gsocketinputstream.h    \
348         gsocketlistener.c       \
349         gsocketoutputstream.c   \
350         gsocketoutputstream.h   \
351         gsocketservice.c        \
352         gsrvtarget.c            \
353         gtcpconnection.c        \
354         gthreadedsocketservice.c\
355         gthemedicon.c           \
356         gthreadedresolver.c     \
357         gthreadedresolver.h     \
358         gunionvolumemonitor.c   \
359         gunionvolumemonitor.h   \
360         gvfs.c                  \
361         gvolume.c               \
362         gvolumemonitor.c        \
363         gzlibcompressor.c       \
364         gzlibdecompressor.c     \
365         gmountprivate.h         \
366         gioenumtypes.h          \
367         gioenumtypes.c          \
368         gioalias.h              \
369         gioaliasdef.c           \
370         $(appinfo_sources)      \
371         $(unix_sources)         \
372         $(win32_sources)        \
373         $(settings_sources)     \
374         $(gdbus_sources)        \
375         $(local_sources)        \
376         $(marshal_sources)      \
377         $(NULL)
378
379 EXTRA_DIST += gnullapplication.c gdbusapplication.c strinfo.c
380
381 $(libgio_2_0_la_OBJECTS): $(marshal_sources)
382
383 libgio_2_0_la_LIBADD = \
384         $(top_builddir)/glib/libglib-2.0.la             \
385         $(top_builddir)/gobject/libgobject-2.0.la       \
386         $(top_builddir)/gmodule/libgmodule-2.0.la       \
387         $(platform_libadd)                              \
388         $(ZLIB_LIBS)                                    \
389         $(SELINUX_LIBS)                                 \
390         $(GLIB_LIBS)                                    \
391         $(XATTR_LIBS)                                   \
392         $(NULL)
393
394 if PLATFORM_WIN32
395 no_undefined = -no-undefined
396 endif
397
398 if OS_WIN32_AND_DLL_COMPILATION
399 export_symbols = -export-symbols gio.def
400 gio_def = gio.def
401
402 gio_win32_res = gio-win32-res.o
403 gio_win32_res_ldflag = -Wl,$(gio_win32_res)
404
405 install-def-file:
406         $(INSTALL) gio.def $(DESTDIR)$(libdir)/gio-2.0.def
407
408 uninstall-def-file:
409         -rm $(DESTDIR)$(libdir)/gio-2.0.def
410 else
411 install-def-file:
412 uninstall-def-file:
413
414 export_symbols = -export-symbols-regex '^g_.*'
415 endif
416
417 install-data-local: install-ms-lib install-def-file
418         $(mkinstalldirs) $(DESTDIR)$(GIO_MODULE_DIR)
419
420 uninstall-local: uninstall-ms-lib uninstall-def-file
421
422 libgio_2_0_la_LDFLAGS = $(GLIB_LINK_FLAGS) \
423         $(gio_win32_res_ldflag) \
424         -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
425         -export-dynamic $(no_undefined) $(export_symbols)
426
427 libgio_2_0_la_DEPENDENCIES = $(gio_win32_res) $(gio_def) $(platform_deps)
428
429 gio-win32-res.o: gio.rc
430         $(WINDRES) gio.rc $@
431
432 gio_headers =                   \
433         gappinfo.h              \
434         gapplication.h          \
435         gasyncinitable.h        \
436         gasyncresult.h          \
437         gbufferedinputstream.h  \
438         gbufferedoutputstream.h \
439         gcancellable.h          \
440         gcontenttype.h          \
441         gcharsetconverter.h     \
442         gconverter.h            \
443         gconverterinputstream.h \
444         gconverteroutputstream.h        \
445         gdatainputstream.h      \
446         gdataoutputstream.h     \
447         gdrive.h                \
448         gemblem.h               \
449         gemblemedicon.h         \
450         gfile.h                 \
451         gfileattribute.h        \
452         gfileenumerator.h       \
453         gfileicon.h             \
454         gfileinfo.h             \
455         gfileinputstream.h      \
456         gfilemonitor.h          \
457         gfilenamecompleter.h    \
458         gfileoutputstream.h     \
459         gfileiostream.h         \
460         gfilterinputstream.h    \
461         gfilteroutputstream.h   \
462         gicon.h                 \
463         ginetaddress.h          \
464         ginetsocketaddress.h    \
465         ginputstream.h          \
466         ginitable.h             \
467         gio.h                   \
468         giotypes.h              \
469         gioenums.h              \
470         gioerror.h              \
471         giomodule.h             \
472         gioscheduler.h          \
473         giostream.h             \
474         gloadableicon.h         \
475         gmount.h                \
476         gmemoryinputstream.h    \
477         gmemoryoutputstream.h   \
478         gmountoperation.h       \
479         gnativevolumemonitor.h  \
480         gnetworkaddress.h       \
481         gnetworkservice.h       \
482         goutputstream.h         \
483         gpermission.h           \
484         gresolver.h             \
485         gseekable.h             \
486         gsimpleasyncresult.h    \
487         gsimplepermission.h     \
488         gsocket.h               \
489         gsocketaddress.h        \
490         gsocketaddressenumerator.h \
491         gsocketclient.h         \
492         gsocketconnectable.h    \
493         gsocketconnection.h     \
494         gsocketcontrolmessage.h \
495         gsocketlistener.h       \
496         gsocketservice.h        \
497         gsrvtarget.h            \
498         gtcpconnection.h        \
499         gthreadedsocketservice.h\
500         gthemedicon.h           \
501         gvfs.h                  \
502         gvolume.h               \
503         gvolumemonitor.h        \
504         gzlibcompressor.h       \
505         gzlibdecompressor.h     \
506         $(settings_headers)     \
507         $(gdbus_headers)        \
508         $(NULL)
509
510 gioincludedir=$(includedir)/glib-2.0/gio/
511 gioinclude_HEADERS =            \
512         $(gio_headers)          \
513         gioenumtypes.h
514
515 # these sources (also mentioned above) are generated.
516 BUILT_SOURCES =                 \
517         gio-marshal.h           \
518         gio-marshal.c           \
519         gioalias.h              \
520         gioaliasdef.c           \
521         gioenumtypes.h          \
522         gioenumtypes.c          \
523         $(NULL)
524
525 EXTRA_DIST +=                   \
526         gio-marshal.list        \
527         gio.symbols             \
528         gioenumtypes.h.template \
529         gioenumtypes.c.template \
530         makefile.msc            \
531         makegioalias.pl         \
532         abicheck.sh             \
533         pltcheck.sh             \
534         gio.rc.in               \
535         gschema.dtd             \
536         $(NULL)
537
538 BUILT_EXTRA_DIST =              \
539         gio.rc
540
541 CLEANFILES =                    \
542         $(marshal_sources)      \
543         $(NULL)
544
545 gioenumtypes.h: $(gio_headers) gioenumtypes.h.template
546         $(AM_V_GEN) ( top_builddir=`cd $(top_builddir) && pwd`; \
547           cd $(srcdir) && $$top_builddir/gobject/glib-mkenums --template gioenumtypes.h.template $(gio_headers) ) > \
548             gioenumtypes.h.tmp && mv gioenumtypes.h.tmp gioenumtypes.h
549
550 gioenumtypes.c: $(gio_headers) gioenumtypes.c.template
551         $(AM_V_GEN) ( top_builddir=`cd $(top_builddir) && pwd`; \
552           cd $(srcdir) && $$top_builddir/gobject/glib-mkenums --template gioenumtypes.c.template $(gio_headers) ) > \
553             gioenumtypes.c.tmp && mv gioenumtypes.c.tmp gioenumtypes.c
554
555 gio-2.0.lib: libgio-2.0.la gio.def
556         lib -machine:@LIB_EXE_MACHINE_FLAG@ -name:libgio-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:gio.def -out:$@
557
558 bin_PROGRAMS = gio-querymodules glib-compile-schemas gsettings
559
560 gio_querymodules_SOURCES = gio-querymodules.c
561 gio_querymodules_LDADD   = \
562         $(top_builddir)/glib/libglib-2.0.la             \
563         $(top_builddir)/gobject/libgobject-2.0.la       \
564         $(top_builddir)/gmodule/libgmodule-2.0.la       \
565         libgio-2.0.la                                   \
566         $(NULL)
567
568 glib_compile_schemas_LDADD = $(top_builddir)/glib/libglib-2.0.la
569 glib_compile_schemas_SOURCES = \
570         gvdb/gvdb-format.h              \
571         gvdb/gvdb-builder.h             \
572         gvdb/gvdb-builder.c             \
573         gschema-compile.c
574
575 gsettings_LDADD = \
576         $(top_builddir)/glib/libglib-2.0.la             \
577         $(top_builddir)/gobject/libgobject-2.0.la       \
578         libgio-2.0.la
579 gsettings_SOURCES = gsettings-tool.c
580
581 schemadir = $(datadir)/glib-2.0/schemas
582 dist_schema_DATA = gschema.dtd
583
584 # ------------------------------------------------------------------------
585 # gdbus(1) tool
586
587 bin_PROGRAMS += gdbus
588 gdbus_SOURCES = gdbus-tool.c
589 gdbus_LDADD = libgio-2.0.la \
590         $(top_builddir)/glib/libglib-2.0.la             \
591         $(top_builddir)/gobject/libgobject-2.0.la
592
593 completiondir = $(sysconfdir)/bash_completion.d
594 completion_SCRIPTS = gdbus-bash-completion.sh
595 EXTRA_DIST += $(completion_SCRIPTS)
596
597 # ------------------------------------------------------------------------
598
599 dist-hook: $(BUILT_EXTRA_DIST) ../build/win32/vs9/gio.vcproj
600         files='$(BUILT_EXTRA_DIST)'; \
601         for f in $$files; do \
602           if test -f $$f; then d=.; else d=$(srcdir); fi; \
603           cp $$d/$$f $(distdir) || exit 1; done
604
605 ../build/win32/vs9/gio.vcproj: $(top_srcdir)/build/win32/vs9/gio.vcprojin
606         for F in `echo $(libgio_2_0_la_SOURCES) $(win32_actual_sources) $(win32_actual_more_sources_for_vcproj) | tr '/' '\\'`; do \
607                 case $$F in \
608                 gunix*.c|gdesktopappinfo.c) ;; \
609                 *.c) echo '   <File RelativePath="..\..\..\gio\'$$F'" />' \
610                      ;; \
611                 esac; \
612         done | sort -u >libgio.sourcefiles
613         $(CPP) -P - <$(top_srcdir)/build/win32/vs9/gio.vcprojin >$@
614         rm libgio.sourcefiles
615
616 if HAVE_GLIB_RUNTIME_LIBDIR
617 install-data-hook:
618         mkdir -p $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
619         mv $(DESTDIR)$(libdir)/libgio-2.0.so.0 $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
620         mv $(DESTDIR)$(libdir)/libgio-2.0.so.0.$(LT_CURRENT).$(LT_REVISION) $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
621         rm -f $(DESTDIR)$(libdir)/libgio-2.0.so
622         ln -s $(GLIB_RUNTIME_LIBDIR)/libgio-2.0.so.0.$(LT_CURRENT).$(LT_REVISION) $(DESTDIR)$(libdir)/libgio-2.0.so
623 endif