Define GLIB_COMPILATION when building libgthread.so
[platform/upstream/glib.git] / gthread / Makefile.am
1 ## Process this file with automake to produce Makefile.in
2 include $(top_srcdir)/Makefile.decl
3
4 SUBDIRS = . tests
5 DIST_SUBDIRS = tests
6
7 AM_CPPFLAGS =                           \
8         $(glib_INCLUDES)                \
9         -DG_LOG_DOMAIN=\"GThread\"      \
10         -DGLIB_COMPILATION              \
11         @GTHREAD_COMPILE_IMPL_DEFINES@  \
12         @GLIB_DEBUG_FLAGS@              \
13         -DG_DISABLE_DEPRECATED
14
15 EXTRA_DIST +=                           \
16                 makefile.msc.in         \
17                 gthread.def             \
18                 gthread.rc.in
19
20 BUILT_EXTRA_DIST =                      \
21                 makefile.msc            \
22                 gthread.rc
23
24 libglib = $(top_builddir)/glib/libglib-2.0.la
25
26 top_builddir_full=`cd \$(top_builddir); pwd`
27
28 lib_LTLIBRARIES = libgthread-2.0.la
29
30 if OS_WIN32_AND_DLL_COMPILATION
31 if MS_LIB_AVAILABLE
32 noinst_DATA = gthread-2.0.lib
33
34 install_ms_lib_cmd = $(INSTALL) gthread-2.0.lib $(DESTDIR)$(libdir)
35 uninstall_ms_lib_cmd = -rm $(DESTDIR)$(libdir)/gthread-2.0.lib
36 endif
37 endif
38
39 install-ms-lib:
40         $(install_ms_lib_cmd)
41
42 uninstall-ms-lib:
43         $(uninstall_ms_lib_cmd)
44
45 if PLATFORM_WIN32
46 no_undefined = -no-undefined
47 endif
48
49 if OS_WIN32_AND_DLL_COMPILATION
50 export_symbols = -export-symbols $(srcdir)/gthread.def
51 gthread_def = gthread.def
52
53 install-def-file:
54         $(INSTALL) $(srcdir)/gthread.def $(DESTDIR)$(libdir)/gthread-2.0.def
55
56 uninstall-def-file:
57         -rm $(DESTDIR)$(libdir)/gthread-2.0.def
58 else
59 install-def-file:
60 uninstall-def-file:
61 endif
62
63 if OS_WIN32_AND_DLL_COMPILATION
64 gthread_win32_res = gthread-win32-res.o
65 gthread_win32_res_ldflag = -Wl,$(gthread_win32_res)
66 endif
67
68 libgthread_2_0_la_SOURCES = gthread-impl.c
69 libgthread_2_0_la_LDFLAGS = $(GLIB_LINK_FLAGS) \
70         $(gthread_win32_res_ldflag) \
71         -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
72         -export-dynamic $(no_undefined) $(export_symbols)
73
74 libgthread_2_0_la_LIBADD = $(G_THREAD_LIBS_EXTRA) $(G_THREAD_LIBS_FOR_GTHREAD) $(libglib)
75
76 libgthread_2_0_la_DEPENDENCIES = $(gthread_win32_res) $(gthread_def)
77
78 gthread-win32-res.o: gthread.rc
79         $(AM_V_GEN) $(WINDRES) gthread.rc $@
80
81 gthread-2.0.lib: libgthread-2.0.la gthread.def
82         lib -machine:@LIB_EXE_MACHINE_FLAG@ -name:libgthread-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:$(srcdir)/gthread.def -out:$@
83
84 dist-hook: $(BUILT_EXTRA_DIST)
85         files='$(BUILT_EXTRA_DIST)'; \
86         for f in $$files; do \
87           if test -f $$f; then d=.; else d=$(srcdir); fi; \
88           cp $$d/$$f $(distdir) || exit 1; done
89
90 install-data-local: install-ms-lib install-def-file
91
92 uninstall-local: uninstall-ms-lib uninstall-def-file
93
94 if HAVE_GLIB_RUNTIME_LIBDIR
95 install-data-hook:
96         mkdir -p $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
97         mv $(DESTDIR)$(libdir)/libgthread-2.0.so.0 $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
98         mv $(DESTDIR)$(libdir)/libgthread-2.0.so.0.$(LT_CURRENT).$(LT_REVISION) $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
99         rm -f $(DESTDIR)$(libdir)/libgthread-2.0.so
100         ln -s $(GLIB_RUNTIME_LIBDIR)/libgthread-2.0.so.0.$(LT_CURRENT).$(LT_REVISION) $(DESTDIR)$(libdir)/libgthread-2.0.so
101 endif