Fix out of tree build for MinGW/MSYS
[platform/upstream/glib.git] / gmodule / Makefile.am
1 ## Process this file with automake to produce Makefile.in
2 include $(top_srcdir)/Makefile.decl
3
4 AM_CPPFLAGS =                           \
5         $(glib_INCLUDES)                \
6         -DG_LOG_DOMAIN=\"GModule\"      \
7         @GLIB_DEBUG_FLAGS@              \
8         -DG_DISABLE_DEPRECATED
9
10 gmodule.def: gmodule.symbols
11         $(AM_V_GEN) (echo EXPORTS; $(CPP) -P - <$(srcdir)/gmodule.symbols | sed -e '/^$$/d' -e 's/^/    /') > $(builddir)/gmodule.def
12
13 EXTRA_DIST +=                           \
14                 makefile.msc.in         \
15                 gmoduleconf.h.in        \
16                 gmodule.symbols         \
17                 gmodule-dl.c            \
18                 gmodule-dld.c           \
19                 gmodule-dyld.c          \
20                 gmodule-os2.c           \
21                 gmodule-win32.c         \
22                 gmodule-beos.c          \
23                 gmodule-ar.c            \
24                 gmoduleconf.h.win32     \
25                 gmodule.rc.in
26
27 BUILT_EXTRA_DIST = \
28                 makefile.msc    \
29                 gmodule.rc
30
31 BUILT_SOURCES = gmoduleconf.h
32 gmoduleconf.h:  gmoduleconf.h.in
33
34 glibincludedir=$(includedir)/glib-2.0
35 glibinclude_HEADERS = \
36                 gmodule.h
37
38 libglib = $(top_builddir)/glib/libglib-2.0.la
39
40 top_builddir_full=`cd \$(top_builddir); pwd`
41
42 lib_LTLIBRARIES = libgmodule-2.0.la
43
44 if OS_WIN32_AND_DLL_COMPILATION
45 if MS_LIB_AVAILABLE
46 noinst_DATA = gmodule-2.0.lib
47
48 install_ms_lib_cmd = $(INSTALL) gmodule-2.0.lib $(DESTDIR)$(libdir)
49 uninstall_ms_lib_cmd = -rm $(DESTDIR)$(libdir)/gmodule-2.0.lib
50 endif
51 endif
52
53 install-ms-lib:
54         $(install_ms_lib_cmd)
55
56 uninstall-ms-lib:
57         $(uninstall_ms_lib_cmd)
58
59 if PLATFORM_WIN32
60 no_undefined = -no-undefined
61 endif
62
63 if OS_WIN32_AND_DLL_COMPILATION
64 export_symbols = -export-symbols $(builddir)/gmodule.def
65 gmodule_def = gmodule.def
66
67 gmodule_win32_res = gmodule-win32-res.o
68 gmodule_win32_res_ldflag = -Wl,$(gmodule_win32_res)
69
70 install-def-file:
71         $(INSTALL) $(builddir)/gmodule.def $(DESTDIR)$(libdir)/gmodule-2.0.def
72
73 uninstall-def-file:
74         -rm $(DESTDIR)$(libdir)/gmodule-2.0.def
75 else
76 install-def-file:
77 uninstall-def-file:
78 endif
79
80 libgmodule_2_0_la_SOURCES = gmodule.c
81 libgmodule_2_0_la_LDFLAGS = $(GLIB_LINK_FLAGS) \
82         $(gmodule_win32_res_ldflag) \
83         $(G_MODULE_LDFLAGS) \
84         -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
85         -export-dynamic $(no_undefined) $(export_symbols)
86
87 libgmodule_2_0_la_LIBADD = $(G_MODULE_LIBS_EXTRA) $(G_MODULE_LIBS) $(libglib)
88
89 libgmodule_2_0_la_DEPENDENCIES = $(gmodule_win32_res) $(gmodule_def)
90
91 gmodule-win32-res.o: gmodule.rc
92         $(AM_V_GEN) $(WINDRES) gmodule.rc $@
93
94 gmodule-2.0.lib: libgmodule-2.0.la gmodule.def
95         lib -machine:@LIB_EXE_MACHINE_FLAG@ -name:libgmodule-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:$(builddir)/gmodule.def -out:$@
96
97 .PHONY: files release
98
99 files:
100         @files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
101           echo $$p; \
102         done
103
104 release:
105         $(MAKE) dist distdir=$(PACKAGE)`date +"%y%m%d"`
106
107 dist-hook: $(BUILT_EXTRA_DIST)
108         @files='$(BUILT_EXTRA_DIST)'; \
109         for f in $$files; do \
110           if test -f $$f; then d=.; else d=$(srcdir); fi; \
111           cp $$d/$$f $(distdir) || exit 1; done
112
113
114 install-data-local: install-ms-lib install-def-file
115
116 uninstall-local: uninstall-ms-lib uninstall-def-file
117
118 if HAVE_GLIB_RUNTIME_LIBDIR
119 install-data-hook:
120         mkdir -p $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
121         mv $(DESTDIR)$(libdir)/libgmodule-2.0.so.0 $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
122         mv $(DESTDIR)$(libdir)/libgmodule-2.0.so.0.$(LT_CURRENT).$(LT_REVISION) $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
123         rm -f $(DESTDIR)$(libdir)/libgmodule-2.0.so
124         ln -s $(GLIB_RUNTIME_LIBDIR)/libgmodule-2.0.so.0.$(LT_CURRENT).$(LT_REVISION) $(DESTDIR)$(libdir)/libgmodule-2.0.so
125 endif