GETENV: check for proper UTF-8.
[gnumeric.git] / src / Makefile.am
blobe87c6ed62d10b3aec06d60f7712c7a38d4057b52
2 # Gnumeric's Makefile.am
3 # Author: Miguel de Icaza (miguel@kernel.org)
4 -include $(INTROSPECTION_MAKEFILE)
5 INTROSPECTION_GIRS =
6 INTROSPECTION_SCANNER_ARGS = \
7         --add-include-path="${INTROSPECTION_GIRDIR}" \
8         -v --warn-all --accept-unprefixed \
9         --identifier-prefix="Gnm"  --identifier-prefix="Gnumeric" \
10         -I$(top_builddir) \
11         -DGOFFICE_NAMESPACE_DISABLE
12 INTROSPECTION_COMPILER_ARGS = \
13         --includedir=$(srcdir) \
14         --includedir=. \
15         --includedir="${INTROSPECTION_GIRDIR}"
17 SUBDIRS = tools cut-n-paste-code
19 lib_LTLIBRARIES = libspreadsheet.la
21 bin_PROGRAMS =
22 check_PROGRAMS =
23 noinst_PROGRAMS = sstest
25 noinst_HEADERS = dead-kittens.h compilation.h gnm-i18n.h
27 if WITH_GTK
28   SUBDIRS += dialogs widgets
29   bin_PROGRAMS += gnumeric
30   check_PROGRAMS += test-pango
31 endif
33 bin_PROGRAMS += ssconvert ssindex ssgrep ssdiff
35 AM_CPPFLAGS =                                                           \
36         -I$(top_srcdir)                                                 \
37         -I$(srcdir)                                                     \
38         -I$(srcdir)/widgets                                             \
39         -I$(srcdir)/dialogs                                             \
40         -I$(srcdir)/tools                                               \
41         $(GNUMERIC_CFLAGS)
43 # A hint is needed to build these headers first:
44 BUILT_SOURCES =                                 \
45         gnm-marshalers.c                        \
46         gnm-marshalers.h                        \
47         gnmresources.c                          \
48         gnmresources.h                          \
49         gnumeric-paths.h
51 # Another hint, see bugs #172211 and #172212:
52 non-intermediate: gnm-marshalers.c gnmresources.c
54 resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(top_srcdir) --generate-dependencies $(srcdir)/gnm.gresource.xml)
56 gnmresources.h: gnm.gresource.xml
57         $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $< \
58                 --target=$@ --sourcedir=$(top_srcdir) --c-name _gnm --generate-header --manual-register
59 gnmresources.c: gnm.gresource.xml $(resource_files) Makefile
60         $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $< \
61                 --target=$@ --sourcedir=$(top_srcdir) --c-name _gnm --generate-source --manual-register
64 CLEANFILES = $(BUILT_SOURCES)                   \
65         gnumeric.exe.a
67 libspreadsheet_la_CPPFLAGS = $(AM_CPPFLAGS) -DGNUMERIC_INTERNAL
68 libspreadsheet_la_LDFLAGS = -release $(VERSION)
69 libspreadsheet_la_LIBADD =                      \
70         $(gnumeric_app_libs)                    \
71         $(GNUMERIC_LIBS)                        \
72         $(INTLLIBS)
74 libspreadsheet_la_SOURCES =                     \
75         go-val.h                        \
76         go-val.c                        \
77         \
78         goffice-data.h                  \
79         go-data-cache-source.c          \
80         go-data-cache-source.h          \
81         go-data-cache-impl.h            \
82         go-data-cache.h                 \
83         go-data-cache.c                 \
84         go-data-cache-field-impl.h      \
85         go-data-cache-field.h           \
86         go-data-cache-field.c           \
87         go-data-slicer-impl.h           \
88         go-data-slicer.h                \
89         go-data-slicer.c                \
90         go-data-slicer-field-impl.h     \
91         go-data-slicer-field.h          \
92         go-data-slicer-field.c          \
93         \
94         gnm-data-cache-source.h         \
95         gnm-data-cache-source.c         \
96         gnm-sheet-slicer.h              \
97         gnm-sheet-slicer.c              \
98         gnm-sheet-slicer-combo.h        \
99         gnm-sheet-slicer-combo.c        \
100         \
101         gnm-cell-combo.h                \
102         gnm-cell-combo.c                \
103         \
104         gnm-marshalers.c                        \
105         application.c                           \
106         auto-format.c                           \
107         cell.c                                  \
108         cell-draw.c                             \
109         cellspan.c                              \
110         clipboard.c                             \
111         criteria.c                              \
112         cmd-edit.c                              \
113         collect.c                               \
114         colrow.c                                \
115         command-context.c                       \
116         command-context-stderr.c                \
117         commands.c                              \
118         complete.c                              \
119         complete-sheet.c                        \
120         complex.c                               \
121         consolidate.c                           \
122         dependent.c                             \
123         expr.c                                  \
124         expr-deriv.c                            \
125         expr-name.c                             \
126         file-autoft.c                           \
127         format-template.c                       \
128         func.c                                  \
129         func-builtin.c                          \
130         gnm-commands-slicer.c                   \
131         gnm-datetime.c                          \
132         gnm-format.c                            \
133         gnm-graph-window.c                      \
134         gnm-pane.c                              \
135         gnm-pane-impl.h                         \
136         gnm-random.c                            \
137         gnumeric-simple-canvas.c                \
138         graph.c                                 \
139         gutils.c                                \
140         gui-clipboard.c                         \
141         gui-file.c                              \
142         gui-util.c                              \
143         hlink.c                                 \
144         history.c                               \
145         input-msg.c                             \
146         item-bar.c                              \
147         item-cursor.c                           \
148         item-edit.c                             \
149         item-grid.c                             \
150         libgnumeric.c                           \
151         mathfunc.c                              \
152         mstyle.c                                \
153         number-match.c                          \
154         outoflinedocs.c                         \
155         parser.y                                \
156         parse-util.c                            \
157         pattern.c                               \
158         position.c                              \
159         preview-grid.c                          \
160         preview-grid-impl.h                     \
161         print-info.c                            \
162         rangefunc.c                             \
163         rangefunc-strings.c                     \
164         ranges.c                                \
165         rendered-value.c                        \
166         search.c                                \
167         selection.c                             \
168         session.c                               \
169         sf-bessel.c                             \
170         sf-dpq.c                                \
171         sf-gamma.c                              \
172         sf-trig.c                               \
173         sheet.c                                 \
174         sheet-view.c                            \
175         sheet-control.c                         \
176         sheet-control-gui.c                     \
177         sheet-merge.c                           \
178         sheet-autofill.c                        \
179         sheet-filter.c                          \
180         sheet-utils.c                           \
181         sheet-object.c                          \
182         sheet-object-cell-comment.c             \
183         gnm-so-filled.c                         \
184         gnm-so-line.c                           \
185         gnm-so-path.c                           \
186         gnm-so-polygon.c                        \
187         sheet-object-component.c                \
188         sheet-object-graph.c                    \
189         sheet-object-image.c                    \
190         sheet-object-widget.c                   \
191         sheet-style.c                           \
192         gnm-plugin.c                            \
193         sort.c                                  \
194         stf.c                                   \
195         stf-export.c                            \
196         stf-parse.c                             \
197         style.c                                 \
198         style-border.c                          \
199         style-color.c                           \
200         style-conditions.c                      \
201         undo.c                                  \
202         validation.c                            \
203         value.c                                 \
204         value-sheet.c                           \
205         workbook.c                              \
206         workbook-cmd-format.c                   \
207         workbook-view.c                         \
208         workbook-control.c                      \
209         wbc-gtk.c                               \
210         wbc-gtk-actions.c                       \
211         wbc-gtk-edit.c                          \
212         xml-sax-read.c                          \
213         xml-sax-write.c                         \
214         gnumeric-conf.c                         \
215         print.c                                 \
216         print-cell.c
218 nodist_libspreadsheet_la_SOURCES = gnmresources.c gnmresources.h
220 # When we switch to subversion fix this to nest as
221 # libspreadsheet-ver/spreadsheet/header
222 # doing it now would require massive cvs surgery.
223 libspreadsheet_includedir = $(includedir)/libspreadsheet-@GNUMERIC_API_VER@/spreadsheet
224 libspreadsheet_include_HEADERS =        \
225         application.h                           \
226         auto-format.h                           \
227         cell.h                                  \
228         cell-draw.h                             \
229         cellspan.h                              \
230         clipboard.h                             \
231         cmd-edit.h                              \
232         collect.h                               \
233         colrow.h                                \
234         command-context.h                       \
235         command-context-stderr.h                \
236         commands.h                              \
237         complete.h                              \
238         complete-sheet.h                        \
239         complex.h                               \
240         consolidate.h                           \
241         criteria.h                              \
242         dependent.h                             \
243         expr.h                                  \
244         expr-deriv.h                            \
245         expr-impl.h                             \
246         expr-name.h                             \
247         file-autoft.h                           \
248         format-template.h                       \
249         func.h                                  \
250         func-builtin.h                          \
251         gnm-command-impl.h                      \
252         gnm-commands-slicer.h                   \
253         gnm-data-cache-source.h                 \
254         gnm-datetime.h                          \
255         gnm-format.h                            \
256         gnm-graph-window.h                      \
257         gnm-pane.h                              \
258         gnm-random.h                            \
259         gnm-sheet-slicer.h                      \
260         gnm-style-impl.h                        \
261         gnumeric.h                              \
262         gnumeric-fwd.h                          \
263         gnumeric-simple-canvas.h                \
264         go-data-cache-source.h                  \
265         go-data-cache.h                         \
266         go-data-cache-field.h                   \
267         go-data-slicer.h                        \
268         go-data-slicer-field.h                  \
269         go-val.h                                \
270         graph.h                                 \
271         gutils.h                                \
272         gui-clipboard.h                         \
273         gui-file.h                              \
274         gui-util.h                              \
275         hlink.h                                 \
276         hlink-impl.h                            \
277         history.h                               \
278         input-msg.h                             \
279         item-bar.h                              \
280         item-cursor.h                           \
281         item-edit.h                             \
282         item-grid.h                             \
283         libgnumeric.h                           \
284         mathfunc.h                              \
285         mstyle.h                                \
286         number-match.h                          \
287         numbers.h                               \
288         parse-util.h                            \
289         pattern.h                               \
290         position.h                              \
291         preview-grid.h                          \
292         print-info.h                            \
293         rangefunc.h                             \
294         rangefunc-strings.h                     \
295         ranges.h                                \
296         regression.h                            \
297         rendered-value.h                        \
298         search.h                                \
299         selection.h                             \
300         session.h                               \
301         sf-bessel.h                             \
302         sf-dpq.h                                \
303         sf-gamma.h                              \
304         sf-trig.h                               \
305         sheet.h                                 \
306         sheet-view.h                            \
307         sheet-control.h                         \
308         sheet-control-priv.h                    \
309         sheet-control-gui.h                     \
310         sheet-control-gui-priv.h                \
311         sheet-merge.h                           \
312         sheet-private.h                         \
313         sheet-autofill.h                        \
314         sheet-filter.h                          \
315         sheet-utils.h                           \
316         sheet-filter-combo.h                    \
317         sheet-object.h                          \
318         sheet-object-impl.h                     \
319         sheet-object-cell-comment.h             \
320         sheet-object-widget-impl.h              \
321         gnm-so-filled.h                         \
322         gnm-so-line.h                           \
323         gnm-so-path.h                           \
324         gnm-so-polygon.h                        \
325         sheet-object-component.h                \
326         sheet-object-graph.h                    \
327         sheet-object-image.h                    \
328         sheet-object-widget.h                   \
329         sheet-style.h                           \
330         gnm-plugin.h                            \
331         sort.h                                  \
332         stf.h                                   \
333         stf-export.h                            \
334         stf-parse.h                             \
335         style.h                                 \
336         style-border.h                          \
337         style-color.h                           \
338         style-conditions.h                      \
339         style-font.h                            \
340         undo.h                                  \
341         validation.h                            \
342         validation-combo.h                      \
343         value.h                                 \
344         workbook.h                              \
345         workbook-priv.h                         \
346         workbook-cmd-format.h                   \
347         workbook-view.h                         \
348         workbook-control.h                      \
349         workbook-control-priv.h                 \
350         wbc-gtk.h                               \
351         wbc-gtk-impl.h                          \
352         xml-io-version.h                        \
353         xml-sax.h                               \
354         gnumeric-conf.h                         \
355         print.h                                 \
356         print-cell.h
358 gnumeric_SOURCES =                              \
359         io-context-gtk.c                        \
360         io-context-gtk.h                        \
361         main-application.c
363 gnumeric_LDADD =                                \
364         libspreadsheet.la                       \
365         $(GNUMERIC_LIBS)                        \
366         $(INTLLIBS)
367 gnumeric_LDFLAGS = -export-dynamic
369 ssconvert_LDADD   = $(gnumeric_LDADD)
370 ssconvert_LDFLAGS = -export-dynamic
371 ssconvert_SOURCES =                             \
372         ssconvert.c
373 ssindex_LDADD   = $(gnumeric_LDADD)
374 ssindex_LDFLAGS = -export-dynamic
375 ssindex_SOURCES =                               \
376         ssindex.c
377 ssgrep_LDADD   = $(gnumeric_LDADD)
378 ssgrep_LDFLAGS = -export-dynamic
379 ssgrep_SOURCES =                                \
380         ssgrep.c
381 sstest_LDADD   = $(gnumeric_LDADD)
382 sstest_LDFLAGS = -export-dynamic
383 sstest_SOURCES =                                \
384         sstest.c
385 ssdiff_LDADD   = $(gnumeric_LDADD)
386 ssdiff_LDFLAGS = -export-dynamic
387 ssdiff_SOURCES =                                \
388         ssdiff.c
390 test_pango_LDADD   = $(gnumeric_LDADD)
391 test_pango_LDFLAGS = -export-dynamic
392 test_pango_SOURCES =                            \
393         test-pango.c
395 if WITH_NATIVE_WIN32
396     gnumeric_LDADD += gnumeric_rc.o
397     gnumeric_LDFLAGS    += -mwindows -Wl,--stack,0x4000000
398     ssconvert_LDFLAGS   += -mconsole -Wl,--stack,0x4000000
399     ssindex_LDFLAGS     += -mconsole
400     ssgrep_LDFLAGS      += -mconsole
402     libspreadsheet_la_DEPENDENCIES = libspreadsheet.def
403     libspreadsheet_la_LDFLAGS += -no-undefined -export-symbols libspreadsheet.def
404 endif
406 if WITH_WIN32
407 libspreadsheet.def: local.def
408         echo EXPORTS > $@ && \
409         cat $^ | sort >> $@
411 local.def: stamp-local.def
412         @true
414 stamp-local.def: $(libspreadsheet_include_HEADERS) Makefile $(top_srcdir)/tools/dumpdef.pl
415         hdrs='$(libspreadsheet_include_HEADERS) dialogs/dialogs.h dialogs/tool-dialogs.h tools/dao.h tools/goal-seek.h tools/analysis-tools.h tools/gnm-solver.h widgets/gnumeric-expr-entry.h'; \
416         hdrs_list=''; \
417         for hdr in $$hdrs; do \
418           if test -f $(srcdir)/$$hdr; then \
419             hdrs_list="$$hdrs_list $(srcdir)/$$hdr"; \
420           else \
421             hdrs_list="$$hdrs_list $$hdr"; \
422           fi; \
423         done; \
424         cat $(top_builddir)/gnumeric-config.h $$hdrs_list | \
425                 sed -e 's/^#[ \t]*include[ \t]\+.*$$//g' | \
426                 $(CPP) $(AM_CPPFLAGS) "-DGNM_VAR_DECL=__declspec(dllexport)" -P - > xgen-localdef.1 && \
427         perl $(top_srcdir)/tools/dumpdef.pl \
428                 xgen-localdef.1 > xgen-localdef.2 \
429         && (cmp -s xgen-localdef.2 local.def || \
430                 cp xgen-localdef.2 local.def) \
431         && rm -f xgen-localdef.1 xgen-localdef.2 \
432         && echo timestamp > $@
434 endif
436 gnumeric_app_libs =                             \
437         dialogs/libdialogs.la                   \
438         tools/libtools.la                       \
439         widgets/libwidgets.la
442 # Rules for the marshalers code:
443 GENMARSHAL_COMMAND = $(GLIB_GENMARSHAL) --prefix=gnm_
445 .list.h:
446         $(GENMARSHAL_COMMAND) --header $< >$@
448 .list.c:
449         (echo '/* This file has been automatically generated.  Do not edit. */' && \
450         echo '#include "$*.h"' && \
451         $(GENMARSHAL_COMMAND) --body $< ) >$@
453 # Depends on this Makefile, because it uses make variables.
454 gnumeric-paths.h: Makefile
455         @echo 'creating $@'
456         @( \
457         echo '/* This file has been automatically generated.  Do not edit. */'; \
458         echo ''; \
459         echo '#ifndef GNUMERIC_PATHS_H'; \
460         echo '#define GNUMERIC_PATHS_H'; \
461         echo ''; \
462         echo '#define GNUMERIC_PREFIX           "$(prefix)"'; \
463         echo '#define GNUMERIC_SYSCONFDIR       "$(sysconfdir)"'; \
464         echo '#define GNUMERIC_DATADIR          "$(gnumeric_datadir)"'; \
465         echo '#define GNUMERIC_LIBDIR           "$(gnumeric_libdir)"'; \
466         echo '#define GNUMERIC_ICONDIR          "$(gnumeric_icondir)"'; \
467         echo '#define GNUMERIC_LOCALEDIR        "$(gnumeric_localedir)"'; \
468         echo '#define GNUMERIC_EXTERNPLUGINDIR          "$(gnumeric_externplugindir)"'; \
469         echo ''; \
470         echo '#endif /* GNUMERIC_PATHS_H */'; \
471         ) >$@
473 update-gnumeric-conf:
474         make -C ${top_srcdir}/schemas
475         rm -f gnumeric-conf.c.tmp
476         @PERL@ -pe 'if (/AUTOMATICALLY GENERATED CODE BELOW/) { print; print "\n"; last; }' <gnumeric-conf.c >gnumeric-conf.c.tmp
477         @PERL@ ${top_srcdir}/tools/handle-conf-options --cfile ${top_srcdir}/schemas/org.gnome.gnumeric*.gschema.xml.in >>gnumeric-conf.c.tmp
478         if cmp gnumeric-conf.c gnumeric-conf.c.tmp; then \
479           rm gnumeric-conf.c.tmp; \
480         else \
481           mv gnumeric-conf.c.tmp gnumeric-conf.c; \
482         fi
483         rm -f gnumeric-conf.h.tmp
484         @PERL@ -pe 'if (/AUTOMATICALLY GENERATED CODE BELOW/) { print; print "\n"; last; }' <gnumeric-conf.h >gnumeric-conf.h.tmp
485         @PERL@ ${top_srcdir}/tools/handle-conf-options --hfile ${top_srcdir}/schemas/org.gnome.gnumeric*.gschema.xml.in >>gnumeric-conf.h.tmp
486         echo '' >>gnumeric-conf.h.tmp
487         @PERL@ -ne '$$p=1 if (/AUTOMATICALLY GENERATED CODE ABOVE/); print if $$p;' <gnumeric-conf.h >>gnumeric-conf.h.tmp
488         if cmp gnumeric-conf.h gnumeric-conf.h.tmp; then \
489           rm gnumeric-conf.h.tmp; \
490         else \
491           mv gnumeric-conf.h.tmp gnumeric-conf.h; \
492         fi
494 if WITH_NATIVE_WIN32
495 gnumeric_rc.o: gnumeric.rc ../gnumeric-config.h
496         $(WINDRES) -DVERSION=$(VERSION) -DVERSION_NUMBER=`echo $(VERSION).0.0.0 | sed 's/\([0-9]*\)[^.]*\.*\([0-9]*\)[^.]*\.*\([0-9]*\)[^.]*\.*\([0-9]*\).*/\1,\2,\3,\4/'` --include-dir $(srcdir) -i $< -o $@
497 install-exec-hook:
498 else
499 install-exec-hook:
500         cd $(DESTDIR)$(bindir) && \
501         mv -f gnumeric$(EXEEXT) gnumeric-$(VERSION)$(EXEEXT) && \
502         $(LN_S) gnumeric-$(VERSION)$(EXEEXT) gnumeric$(EXEEXT)
503 endif
505 uninstall-hook:
506         -cd $(DESTDIR)$(bindir) && \
507         rm -f gnumeric-$(VERSION)$(EXEEXT)
509 # include conditional files to ensure everything gets distributed no matter
510 # what the build
511 EXTRA_DIST =                                            \
512         gnm.gresource.xml                               \
513         pixmaps/line_pattern_dash_dot.png               \
514         pixmaps/line_pattern_dash_dot_dot.png           \
515         pixmaps/line_pattern_dashed.png                 \
516         pixmaps/line_pattern_dotted.png                 \
517         pixmaps/line_pattern_double.png                 \
518         pixmaps/line_pattern_hair.png                   \
519         pixmaps/line_pattern_medium.png                 \
520         pixmaps/line_pattern_medium_dash.png            \
521         pixmaps/line_pattern_medium_dash_dot.png        \
522         pixmaps/line_pattern_medium_dash_dot_dot.png    \
523         pixmaps/line_pattern_slant.png                  \
524         pixmaps/line_pattern_thick.png                  \
525         pixmaps/line_pattern_thin.png                   \
526         pixmaps/right-down.png                          \
527         pixmaps/down-right.png                          \
528         pixmaps/gnumeric_splash_1.4.png                 \
529         pixmaps/unknown_image.png                       \
530         pixmaps/sheet_move_marker.png                   \
531         gnumeric.css                                    \
532         gnm-marshalers.list                             \
533         README.gnm_float                                \
534         gnumeric.rc                                     \
535         GNOME_Gnumeric-gtk.xml.in
537 gtkactiondir=$(gnumeric_datadir)
539 gtkaction_DATA = GNOME_Gnumeric-gtk.xml
540 GNOME_Gnumeric-gtk.xml: GNOME_Gnumeric-gtk.xml.in
541         sed -e 's/ _name *=/ name=/' <$<  >$@
542 DISTCLEANFILES = GNOME_Gnumeric-gtk.xml
544 if HAVE_INTROSPECTION
546 INTROSPECTION_GIRS += Gnm-@GNUMERIC_API_VER@.gir
548 Gnm-@GNUMERIC_API_VER@.gir: $(INTROSPECTION_SCANNER) libspreadsheet.la Makefile
549 Gnm_@GNUMERIC_API_VER_@_gir_INCLUDES = GObject-2.0 Gio-2.0 libxml2-2.0 \
550                                                                            Gsf-1 GOffice-@GOFFICE_API_VER@
551 Gnm_@GNUMERIC_API_VER_@_gir_CFLAGS = $(AM_CPPFLAGS)
552 Gnm_@GNUMERIC_API_VER_@_gir_LIBS = libspreadsheet.la
553 Gnm_@GNUMERIC_API_VER_@_gir_FILES = \
554         $(libspreadsheet_la_SOURCES) \
555         $(libspreadsheet_include_HEADERS) \
556         tools/dao.c \
557         tools/dao.h \
558         tools/scenarios.c \
559         tools/scenarios.h \
560         tools/tools.h \
561         widgets/gnumeric-expr-entry.c \
562         widgets/gnumeric-expr-entry.h
565 girdir = $(GIRDIR)
566 gir_DATA = $(INTROSPECTION_GIRS)
568 typelibsdir = $(TYPELIBDIR)
569 typelibs_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
571 CLEANFILES += $(gir_DATA) $(typelibs_DATA)
573 endif # HAVE_INTROSPECTION