Merge mozilla-central and tracemonkey. (a=blockers)
[mozilla-central.git] / embedding / android / Makefile.in
blobafc5c361d317ae0c5d4638011d20127469f0428b
1 # ***** BEGIN LICENSE BLOCK *****
2 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 # The contents of this file are subject to the Mozilla Public License Version
5 # 1.1 (the "License"); you may not use this file except in compliance with
6 # the License. You may obtain a copy of the License at
7 # http://www.mozilla.org/MPL/
9 # Software distributed under the License is distributed on an "AS IS" basis,
10 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 # for the specific language governing rights and limitations under the
12 # License.
14 # The Original Code is the Mozilla browser.
16 # The Initial Developer of the Original Code is
17 # Mozilla Foundation
18 # Portions created by the Initial Developer are Copyright (C) 2009-2010
19 # the Initial Developer. All Rights Reserved.
21 # Contributor(s):
22 # Vladimir Vukicevic <vladimir@pobox.com>
24 # Alternatively, the contents of this file may be used under the terms of
25 # either the GNU General Public License Version 2 or later (the "GPL"), or
26 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 # in which case the provisions of the GPL or the LGPL are applicable instead
28 # of those above. If you wish to allow use of your version of this file only
29 # under the terms of either the GPL or the LGPL, and not to allow others to
30 # use your version of this file under the terms of the MPL, indicate your
31 # decision by deleting the provisions above and replace them with the notice
32 # and other provisions required by the GPL or the LGPL. If you do not delete
33 # the provisions above, a recipient may use your version of this file under
34 # the terms of any one of the MPL, the GPL or the LGPL.
36 # ***** END LICENSE BLOCK *****
38 DEPTH = ../..
39 topsrcdir = @top_srcdir@
40 srcdir = @srcdir@
41 VPATH = @srcdir@
43 include $(DEPTH)/config/autoconf.mk
44 include $(topsrcdir)/ipc/app/defs.mk
46 DIRS = locales
48 JAVAFILES = \
49 GeckoApp.java \
50 GeckoAppShell.java \
51 GeckoConnectivityReceiver.java \
52 GeckoEvent.java \
53 GeckoSurfaceView.java \
54 GeckoInputConnection.java \
55 AlertNotification.java \
56 MemoryWatcher.java \
57 $(NULL)
59 PROCESSEDJAVAFILES = \
60 App.java \
61 Restarter.java \
62 NotificationHandler.java \
63 $(NULL)
66 ifneq (,$(findstring -march=armv7,$(OS_CFLAGS)))
67 MIN_CPU_VERSION=7
68 else
69 MIN_CPU_VERSION=5
70 endif
72 ifeq (,$(ANDROID_VERSION_CODE))
73 ANDROID_VERSION_CODE=$(shell $(PYTHON) $(topsrcdir)/toolkit/xre/make-platformini.py --print-buildid | cut -c1-10)
74 endif
76 DEFINES += \
77 -DANDROID_PACKAGE_NAME=$(ANDROID_PACKAGE_NAME) \
78 -DMOZ_APP_DISPLAYNAME=$(MOZ_APP_DISPLAYNAME) \
79 -DMOZ_APP_NAME=$(MOZ_APP_NAME) \
80 -DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \
81 -DMOZ_CHILD_PROCESS_NAME=$(MOZ_CHILD_PROCESS_NAME) \
82 -DMOZ_MIN_CPU_VERSION=$(MIN_CPU_VERSION) \
83 -DMOZ_CRASHREPORTER=$(MOZ_CRASHREPORTER) \
84 -DANDROID_VERSION_CODE=$(ANDROID_VERSION_CODE) \
85 $(NULL)
87 GARBAGE += \
88 AndroidManifest.xml \
89 classes.dex \
90 $(PROCESSEDJAVAFILES) \
91 gecko.ap_ \
92 res/values/strings.xml \
93 R.java \
94 $(NULL)
96 GARBAGE_DIRS += classes res
98 # Bug 567884 - Need a way to find appropriate icons during packaging
99 ifeq ($(MOZ_APP_NAME),fennec)
100 ICON_PATH = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/fennec_48x48.png
101 ICON_PATH_HDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/fennec_72x72.png
102 else
103 ICON_PATH = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/icon48.png
104 ICON_PATH_HDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/icon64.png
105 endif
107 RES_LAYOUT = \
108 res/layout/notification_progress.xml \
109 res/layout/notification_progress_text.xml \
110 $(NULL)
112 RES_VALUES = res/values/colors.xml res/values/themes.xml
114 AB_rCD = $(shell echo $(AB_CD) | sed -e s/-/-r/)
116 JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar
118 DEFAULT_BRANDPATH = $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales/en-US/brand.dtd
119 DEFAULT_STRINGSPATH = locales/en-US/android_strings.dtd
120 LOCALIZED_BRANDPATH = $(DEPTH)/dist/bin/chrome/$(AB_CD)/locale/branding/brand.dtd
121 LOCALIZED_STRINGSPATH = $(DEPTH)/dist/bin/chrome/android-res/res/values-$(AB_CD)/android_strings.dtd
123 ifdef MOZ_CRASHREPORTER
124 PROCESSEDJAVAFILES += CrashReporter.java
125 MOZ_ANDROID_DRAWABLES += embedding/android/resources/drawable/crash_reporter.png
126 RES_LAYOUT += res/layout/crash_reporter.xml
127 endif
129 MOZ_ANDROID_DRAWABLES += embedding/android/resources/drawable/desktop_notification.png
131 MOZ_ANDROID_DRAWABLES += $(shell if test -e $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/android-resources.mn; then cat $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/android-resources.mn | tr '\n' ' '; fi)
133 include $(topsrcdir)/config/rules.mk
135 ifneq ($(AB_CD),en-US)
136 LOCALIZED_STRINGS_XML = res/values-$(AB_rCD)/strings.xml
137 endif
139 # Override the Java settings with some specific android settings
140 include $(topsrcdir)/config/android-common.mk
142 # Note that we're going to set up a dependency directly between embed_android.dex and the java files
143 # Instead of on the .class files, since more than one .class file might be produced per .java file
144 classes.dex: $(JAVAFILES) $(PROCESSEDJAVAFILES) R.java
145 $(NSINSTALL) -D classes
146 $(JAVAC) $(JAVAC_FLAGS) -d classes $(addprefix $(srcdir)/,$(JAVAFILES)) $(PROCESSEDJAVAFILES) R.java
147 $(DX) --dex --output=$@ classes
149 AndroidManifest.xml $(PROCESSEDJAVAFILES): % : %.in
150 $(PYTHON) $(topsrcdir)/config/Preprocessor.py \
151 $(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $< > $@
153 res/drawable/icon.png: $(MOZ_APP_ICON)
154 $(NSINSTALL) -D res/drawable
155 cp $(ICON_PATH) $@
157 res/drawable-hdpi/icon.png: $(MOZ_APP_ICON)
158 $(NSINSTALL) -D res/drawable-hdpi
159 cp $(ICON_PATH_HDPI) $@
161 RES_DRAWABLE = $(addprefix res/drawable/,$(notdir $(MOZ_ANDROID_DRAWABLES)))
163 $(RES_DRAWABLE): $(addprefix $(topsrcdir)/,$(MOZ_ANDROID_DRAWABLES))
164 $(NSINSTALL) -D res/drawable
165 $(NSINSTALL) $^ res/drawable/
167 $(RES_LAYOUT): $(subst res/,$(srcdir)/resources/,$(RES_LAYOUT))
168 $(NSINSTALL) -D res/layout
169 $(NSINSTALL) $(srcdir)/resources/layout/* res/layout/
171 $(RES_VALUES): $(subst res/,$(srcdir)/resources/,$(RES_VALUES))
172 $(NSINSTALL) -D res/values
173 $(NSINSTALL) $(srcdir)/resources/values/* res/values/
175 R.java: $(MOZ_APP_ICON) $(RES_LAYOUT) $(RES_DRAWABLE) $(RES_VALUES) res/drawable/icon.png res/drawable-hdpi/icon.png res/values/strings.xml AndroidManifest.xml
176 $(AAPT) package -f -M AndroidManifest.xml -I $(ANDROID_SDK)/android.jar -S res -J . --custom-package org.mozilla.gecko
178 gecko.ap_: AndroidManifest.xml res/drawable/icon.png res/drawable-hdpi/icon.png $(RES_LAYOUT) $(RES_DRAWABLE) $(RES_VALUES) res/values/strings.xml FORCE
179 $(AAPT) package -f -M AndroidManifest.xml -I $(ANDROID_SDK)/android.jar -S res -F $@
181 res/values/strings.xml: $(DEFAULT_BRANDPATH) $(DEFAULT_STRINGSPATH)
182 mkdir -p res/values
183 $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) \
184 -DBRANDPATH="$(DEFAULT_BRANDPATH)" \
185 -DSTRINGSPATH="$(DEFAULT_STRINGSPATH)" \
186 $(srcdir)/strings.xml.in \
187 > $@
189 res/values-$(AB_rCD)/strings.xml: $(LOCALIZED_BRANDPATH) $(LOCALIZED_STRINGSPATH)
190 mkdir -p res/values-$(AB_rCD)
191 $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) \
192 -DBRANDPATH="$(call core_abspath,$(LOCALIZED_BRANDPATH))" \
193 -DSTRINGSPATH="$(call core_abspath,$(LOCALIZED_STRINGSPATH))" \
194 $(srcdir)/strings.xml.in \
195 > $@
197 chrome:: $(LOCALIZED_STRINGS_XML)
199 libs:: classes.dex
200 $(INSTALL) classes.dex $(FINAL_TARGET)