Build gtestutils etc on OS_UNIX only.
[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 if HAVE_GOOD_PRINTF
5 else
6 PRINTF_SUBDIR = gnulib
7 printf_la = gnulib/libgnulib.la
8 endif 
9
10 if ENABLE_REGEX
11 if USE_SYSTEM_PCRE
12 else
13 MAYBE_PCRE = pcre 
14 endif
15 gregex_c = gregex.c
16 gregex_h = gregex.h
17 else
18 gregex_c =
19 gregex_h =
20 endif
21
22 if OS_UNIX
23 gtestutils_c = gtestutils.c
24 gtestutils_h = gtestutils.h
25 tests_subdir = tests
26 endif
27
28 SUBDIRS = libcharset $(PRINTF_SUBDIR) $(MAYBE_PCRE) update-pcre . $(tests_subdir)
29
30 DIST_SUBDIRS = libcharset gnulib pcre update-pcre
31
32 AM_CPPFLAGS =                           \
33         -I$(top_srcdir)                 \
34         $(pcre_inc)                     \
35         -DG_LOG_DOMAIN=\"GLib\"         \
36         $(GLIB_DEBUG_FLAGS)             \
37         -DG_DISABLE_DEPRECATED          \
38         -DGLIB_COMPILATION              \
39         -DPCRE_STATIC
40
41 glib.def: glib.symbols
42         (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
43
44 galias.h: glib.symbols
45           $(PERL) $(srcdir)/makegalias.pl < $(srcdir)/glib.symbols > galias.h
46
47 galiasdef.c: glib.symbols
48           $(PERL) $(srcdir)/makegalias.pl -def < $(srcdir)/glib.symbols > galiasdef.c
49
50 if OS_LINUX
51 if HAVE_GNUC_VISIBILITY
52 TESTS_ENVIRONMENT = GLIB_DEBUG_FLAGS="$(GLIB_DEBUG_FLAGS)"
53 TESTS = abicheck.sh pltcheck.sh
54 endif
55 endif
56
57 BUILT_SOURCES = galias.h galiasdef.c
58
59 MIRRORING_TAB_SOURCE =                          \
60         glib-mirroring-tab/Makefile             \
61         glib-mirroring-tab/gen-mirroring-tab.c  \
62         glib-mirroring-tab/packtab.h            \
63         glib-mirroring-tab/packtab.c
64
65 # The compilation of GRegex can be disabled, but the source files must
66 # be distributed.
67 EXTRA_DIST +=                   \
68         makefile.msc.in         \
69         glib.rc.in              \
70         gen-unicode-tables.pl   \
71         gen-script-table.pl     \
72         makegalias.pl           \
73         abicheck.sh             \
74         pltcheck.sh             \
75         glib.symbols            \
76         gregex.c                \
77         gregex.h                \
78         $(MIRRORING_TAB_SOURCE)
79
80 # These may be in the builddir too
81 BUILT_EXTRA_DIST =              \
82         makefile.msc            \
83         glib.rc                 \
84         galias.h                \
85         galiasdef.c
86
87 lib_LTLIBRARIES = libglib-2.0.la
88
89 if MS_LIB_AVAILABLE
90 noinst_DATA = glib-2.0.lib
91
92 install-ms-lib:
93         $(INSTALL) glib-2.0.lib $(DESTDIR)$(libdir)
94
95 uninstall-ms-lib:
96         -rm $(DESTDIR)$(libdir)/glib-2.0.lib
97 else
98 install-ms-lib:
99 uninstall-ms-lib:
100 endif
101
102 libglib_2_0_la_SOURCES =        \
103         garray.c                \
104         gasyncqueue.c           \
105         gatomic.c               \
106         gbacktrace.c            \
107         gbase64.c               \
108         gbookmarkfile.c         \
109         gbsearcharray.h         \
110         gcache.c                \
111         gcompletion.c           \
112         gconvert.c              \
113         gdataset.c              \
114         gdatasetprivate.h       \
115         gdate.c                 \
116         gdir.c                  \
117         gerror.c                \
118         gfileutils.c            \
119         ghash.c                 \
120         ghook.c                 \
121         giochannel.c            \
122         gkeyfile.c              \
123         glibintl.h              \
124         glist.c                 \
125         gmain.c                 \
126         gmappedfile.c           \
127         gmarkup.c               \
128         gmem.c                  \
129         gmessages.c             \
130         gmirroringtable.h       \
131         gnode.c                 \
132         goption.c               \
133         gpattern.c              \
134         gprimes.c               \
135         gqsort.c                \
136         gqueue.c                \
137         grel.c                  \
138         grand.c                 \
139         $(gregex_c)             \
140         gscanner.c              \
141         gscripttable.h          \
142         gsequence.c             \
143         gshell.c                \
144         gslice.c                \
145         gslist.c                \
146         gstdio.c                \
147         gstrfuncs.c             \
148         gstring.c               \
149         $(gtestutils_c)         \
150         gthread.c               \
151         gthreadprivate.h        \
152         gthreadpool.c           \
153         gtimer.c                \
154         gtree.c                 \
155         guniprop.c              \
156         gutf8.c                 \
157         gunibreak.h             \
158         gunibreak.c             \
159         gunichartables.h        \
160         gunicollate.c           \
161         gunicomp.h              \
162         gunidecomp.h            \
163         gunidecomp.c            \
164         gunicodeprivate.h       \
165         gutils.c                \
166         gdebug.h                \
167         gprintf.c               \
168         gprintfint.h
169
170 EXTRA_libglib_2_0_la_SOURCES = \
171         giounix.c       \
172         giowin32.c      \
173         gspawn.c        \
174         gspawn-win32.c  \
175         gwin32.c
176
177 glibincludedir=$(includedir)/glib-2.0
178 glibinclude_HEADERS =   \
179         glib-object.h   \
180         glib.h
181
182 glibsubincludedir=$(includedir)/glib-2.0/glib
183 glibsubinclude_HEADERS =   \
184         galloca.h       \
185         garray.h        \
186         gasyncqueue.h   \
187         gatomic.h       \
188         gbacktrace.h    \
189         gbase64.h       \
190         gbookmarkfile.h \
191         gcache.h        \
192         gcompletion.h   \
193         gconvert.h      \
194         gdataset.h      \
195         gdate.h         \
196         gdir.h          \
197         gerror.h        \
198         gfileutils.h    \
199         ghash.h         \
200         ghook.h         \
201         gi18n.h         \
202         gi18n-lib.h     \
203         giochannel.h    \
204         gkeyfile.h      \
205         glist.h         \
206         gmacros.h       \
207         gmain.h         \
208         gmappedfile.h   \
209         gmarkup.h       \
210         gmem.h          \
211         gmessages.h     \
212         gnode.h         \
213         goption.h       \
214         gpattern.h      \
215         gprimes.h       \
216         gqsort.h        \
217         gquark.h        \
218         gqueue.h        \
219         grand.h         \
220         $(gregex_h)     \
221         grel.h          \
222         gscanner.h      \
223         gsequence.h     \
224         gshell.h        \
225         gslice.h        \
226         gslist.h        \
227         gspawn.h        \
228         gstdio.h        \
229         gstrfuncs.h     \
230         $(gtestutils_h) \
231         gstring.h       \
232         gthread.h       \
233         gthreadpool.h   \
234         gtimer.h        \
235         gtree.h         \
236         gtypes.h        \
237         gunicode.h      \
238         gutils.h        \
239         gwin32.h        \
240         gprintf.h
241
242 install-data-local: install-ms-lib install-def-file
243         @if test -f $(glibincludedir)/glist.h ; then                                    \
244           echo "*** Old headers found in $(glibincludedir). You should remove the" ;    \
245           echo "*** contents of this directory and type 'make install' again." ;        \
246           false ;                                                                       \
247         fi
248
249 uninstall-local: uninstall-ms-lib uninstall-def-file
250
251 if PLATFORM_WIN32
252 no_undefined = -no-undefined
253 endif
254
255 if OS_WIN32
256 # This requires a very new libtool
257 export_symbols = -export-symbols glib.def
258
259 install-def-file:
260         $(INSTALL) glib.def $(DESTDIR)$(libdir)/glib-2.0.def
261
262 uninstall-def-file:
263         -rm $(DESTDIR)$(libdir)/glib-2.0.def
264 else
265 install-def-file:
266 uninstall-def-file:
267
268 export_symbols = $(LIBTOOL_EXPORT_OPTIONS)
269 endif
270
271 if OS_WIN32
272 glib_win32_res = glib-win32-res.o
273 glib_win32_res_ldflag = -Wl,$(glib_win32_res)
274 endif
275
276 if ENABLE_REGEX
277 if USE_SYSTEM_PCRE
278 pcre_lib = $(PCRE_LIBS)
279 pcre_inc = $(PCRE_CFLAGS)
280 else
281 pcre_lib = pcre/libpcre.la
282 pcre_inc =
283 endif
284 else
285 pcre_lib =
286 pcre_inc =
287 endif
288
289 libglib_2_0_la_LIBADD = libcharset/libcharset.la $(printf_la) @GIO@ @GSPAWN@ @PLATFORMDEP@ @ICONV_LIBS@ @G_LIBS_EXTRA@ $(pcre_lib)
290 libglib_2_0_la_DEPENDENCIES = libcharset/libcharset.la $(printf_la) @GIO@ @GSPAWN@ @PLATFORMDEP@ $(glib_win32_res) @GLIB_DEF@
291
292 libglib_2_0_la_LDFLAGS = \
293          $(glib_win32_res_ldflag) \
294         -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
295         -export-dynamic $(no_undefined) $(export_symbols)
296
297 INSTALL_PROGS=
298
299 if OS_WIN32
300 INSTALL_PROGS += gspawn-win32-helper gspawn-win32-helper-console
301 gspawn_win32_helper_LDADD = libglib-2.0.la
302 gspawn_win32_helper_LDFLAGS = -mwindows
303 gspawn_win32_helper_console_LDADD = libglib-2.0.la
304 gspawn-win32-helper-console.c:
305         echo '#include "gspawn-win32-helper.c"' >$@
306
307 glib-win32-res.o: glib.rc
308         $(WINDRES) glib.rc $@
309 endif
310
311 bin_PROGRAMS     = ${INSTALL_PROGS}
312
313 if OS_UNIX
314
315 INSTALL_PROGS   += gtester
316 gtester_SOURCES  = gtester.c
317 gtester_LDADD    = libglib-2.0.la
318
319 endif
320
321 glib-2.0.lib: libglib-2.0.la glib.def
322         lib -name:libglib-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:glib.def -out:$@
323
324 dist-hook: $(BUILT_EXTRA_DIST)
325         files='$(BUILT_EXTRA_DIST)'; \
326         for f in $$files; do \
327           if test -f $$f; then d=.; else d=$(srcdir); fi; \
328           cp $$d/$$f $(distdir) || exit 1; done