Fix:Core:Made android compileable again
[navit-package] / navit / Makefile.am
1 include $(top_srcdir)/Makefile.inc
2 comma=,
3 DIST_SUBDIRS=binding map maptool fib-1.1 font fonts gui graphics osd speech support vehicle xpm maps
4 SUBDIRS=binding map fib-1.1 font gui graphics osd speech support vehicle xpm
5
6 if FONTS
7   SUBDIRS += fonts
8 endif
9
10 SUBDIRS+=.
11 SUBDIRS+=maptool
12
13 if BUILD_SAMPLEMAP
14   SUBDIRS += maps
15 endif
16
17
18 AM_CPPFLAGS = -I$(top_srcdir)/navit/fib-1.1 @NAVIT_CFLAGS@ @ZLIB_CFLAGS@ -DPREFIX=\"@prefix@\" -DLIBDIR=\"@libdir@\" -DMODULE=navit
19 BUILT_SOURCES = version.h navit_config.h
20
21 if SUPPORT_ANDROID
22   lib_LTLIBRARIES        = libnavit.la
23   libnavit_la_LDFLAGS = -module -avoid-version @MODULE_LDFLAGS@ -Wl,--no-undefined
24   libnavit_la_LIBADD = @NAVIT_LIBS@ @WORDEXP_LIBS@ @ZLIB_LIBS@ @INTLLIBS@ -Lfib-1.1 -lfib -llog
25
26 else
27   bin_PROGRAMS = navit
28   noinst_LTLIBRARIES        = libnavit.la
29 endif
30
31 pkgdata_DATA = navit.xml
32
33 EXTRA_DIST = navit_shipped.xml navit.dtd
34
35 libnavit_la_SOURCES = announcement.c atom.c attr.c cache.c callback.c command.c compass.c config_.c coord.c country.c data_window.c debug.c \
36         event.c event_glib.h file.c graphics.c gui.c item.c layout.c log.c main.c map.c \
37         linguistics.c mapset.c maptype.c menu.c messages.c navit.c navigation.c osd.c param.c phrase.c plugin.c popup.c \
38         profile.c projection.c roadprofile.c route.c routech.c search.c speech.c start_real.c transform.c track.c \
39         util.c vehicle.c vehicleprofile.c xmlconfig.c announcement.h atom.h attr.h attr_def.h cache.h callback.h color.h command.h compass.h config_.h coord.h country.h \
40         data.h data_window.h data_window_int.h debug.h destination.h draw_info.h endianess.h event.h \
41         file.h graphics.h gtkext.h gui.h item.h item_def.h keys.h log.h layer.h layout.h linguistics.h main.h map-share.h map.h\
42         map_data.h mapset.h maptype.h menu.h messages.h navigation.h navit.h osd.h \
43         param.h phrase.h plugin.h point.h plugin_def.h projection.h popup.h route.h profile.h roadprofile.h search.h speech.h start_real.h \
44         transform.h track.h util.h vehicle.h vehicleprofile.h window.h xmlconfig.h zipfile.h \
45         navit_nls.h sunriset.c sunriset.h
46
47 comma=,
48 XSLTS=@XSLTS@
49 navit.xml: navit_shipped.xml  $(foreach xslt, $(subst $(comma), ,$(XSLTS)), $(addsuffix .xslt,$(addprefix xslt/,$(xslt))))
50         cp $< navit.xml.new
51         if [ ! -f "$(builddir)/navit.dtd" ]; then cp -f $(srcdir)/navit.dtd $(builddir)/navit.dtd; fi
52         for i in $^; do if [ "$${i%.xslt}" != "$$i" ]; then echo "Applying $$i" ; @SAXON@ -snone navit.xml.new $$i >navit.xml.tmp || exit ; mv navit.xml.tmp navit.xml.new || exit ; fi ; done
53         mv navit.xml.new navit.xml
54         rm -f navit.xml.tmp
55         
56
57 if SUPPORT_ANDROID
58   libnavit_la_SOURCES += android.c
59   navit_SOURCES =
60   navit_LDADD =
61
62 android/AndroidManifest.xml: android/AndroidManifest.xml.in
63         mkdir -p $(builddir)/android
64         sed '0,/<uses-sdk/!d' <$< >$@
65         for i in $(subst $(comma), ,@ANDROID_PERMISSIONS@); do echo "    <uses-permission android:name="android.permission.$$i" />" >>$@; done
66         sed '0,/<uses-sdk/d' <$< >>$@
67         
68
69 android/build.xml: android/AndroidManifest.xml
70         if [ "$(builddir)" != "$(srcdir)" ]; then cp -rp $(srcdir)/android $(builddir)/android; fi
71         android update project -t 3 -p android
72
73 apk: all android/build.xml navit.xml
74         mkdir -p android/libs/armeabi
75         cp .libs/*.so */*/.libs/*.so android/libs/armeabi
76         for i in $(shell cd $(srcdir)/xpm && echo *.xpm); do convert $(srcdir)/xpm/$$i android/res/drawable/$${i%.xpm}.png; done 
77         for i in $(shell cd $(srcdir)/xpm && echo *.png); do cp $(srcdir)/xpm/$$i android/res/drawable/$$( echo $$i | tr "[A-Z]" "[a-z]") ; done
78         if [ "$(builddir)" != "$(srcdir)" ]; then for i in $(shell cd $(builddir)/xpm && echo *.png); do cp $(builddir)/xpm/$$i android/res/drawable/$$( echo $$i | tr "[A-Z]" "[a-z]") ; done ; fi
79         mkdir -p android/res/raw
80         for i in $(shell cd ../po && echo *.mo); do cp ../po/$$i android/res/raw/$$( echo $$i | tr "[A-Z]" "[a-z]") ; done
81         cp navit.xml android/res/raw
82         cd android && ant debug
83
84 else
85 navit_SOURCES = start.c
86 navit_LDADD = libnavit.la @NAVIT_LIBS@ @WORDEXP_LIBS@ @ZLIB_LIBS@ @INTLLIBS@ -Lfib-1.1 -lfib
87
88 endif
89
90 if EVENT_GLIB
91   libnavit_la_SOURCES += event_glib.c
92 endif
93
94 if !PLUGINS
95   navit_SOURCES += builtin.c
96   navit_LDADD += $(wildcard $(top_builddir)/navit/*/*/*.la)
97 endif
98
99 if SUPPORT_WIN32
100   navit_LDADD += resource.rsc
101 if SUPPORT_WIN32CE
102   navit_LDADD += -lcommctrl
103 else
104   navit_LDADD += -lgdi32 -lcomctl32
105 endif
106
107 resource.rsc: $(top_srcdir)/navit/gui/win32/resources/resource.rc
108         $(WINDRES) -I $(top_srcdir)/navit/gui/win32/resources $(top_srcdir)/navit/gui/win32/resources/resource.rc resource.rsc
109 endif
110
111 .PHONY: version.h.tmp
112
113 version.h.tmp:
114         echo "#include \"config.h\"" >version.h.tmp
115 if SOURCE_MODE_SVN
116         echo "#define SVN_VERSION \"$$(LANG=C svnversion 2>/dev/null)\"" >>version.h.tmp
117 else
118         echo "#define SVN_VERSION \"@SOURCE_MODE@\"" >>version.h.tmp
119 endif
120         echo "#define NAVIT_VARIANT \"@NAVIT_VARIANT@\"" >>version.h.tmp
121         if ! diff version.h.tmp version.h >/dev/null 2>/dev/null; \
122         then \
123                 mv version.h.tmp version.h; \
124         fi
125
126 version.h: version.h.tmp
127
128 navit_config.h: ../config.h
129         cp ../config.h navit_config.h.tmp
130         if ! diff navit_config.h.tmp navit_config.h >/dev/null 2>/dev/null; \
131         then \
132                 mv navit_config.h.tmp navit_config.h; \
133         fi
134
135
136 distclean-local:
137         rm -f version.h version.h.tmp navit_config.h navit_config.h.tmp builtin.c support-builtin.c navit.xml
138         if [ "$(builddir)" != "$(srcdir)" ]; then rm -f navit.dtd; fi
139
140 builtin.c: $(top_builddir)/config.h
141         ls $(top_builddir)/navit/*/*/*.la | sed -e "s/.la/_init(void);/" -e "s/.*lib/extern void module_/" >builtin.c
142         echo "extern void builtin_init(void);" >>builtin.c
143         echo "void builtin_init(void) {" >>builtin.c
144         ls $(top_builddir)/navit/*/*/*.la | sed -e "s/.la/_init();/" -e "s/.*\\/lib/    module_/" >>builtin.c
145         echo "}" >>builtin.c
146 support-builtin.c: $(top_builddir)/config.h
147         ls $(top_builddir)/navit/support/*/*.la | sed -e "s/.la/_init(void);/" -e "s/.*lib/extern void module_/" >support-builtin.c
148         echo "extern void builtin_init(void);" >>support-builtin.c
149         echo "void builtin_init(void) {" >>support-builtin.c
150         ls $(top_builddir)/navit/support/*/*.la | sed -e "s/.la/_init();/" -e "s/.*\\/lib/      module_/" >>support-builtin.c
151         echo "}" >>support-builtin.c