embedding/android/Makefile.in
author Michael Wu <mwu@mozilla.com>
Fri, 15 Oct 2010 11:28:03 -0700
changeset 55917 a6b6ebdd29a281841b5540ebc6802e3a641c6bf5
parent 55376 354b5ce1181d03bbf88a31441ccb750964a66feb
child 56280 13dc6bfc5e7a578984cdbecdbe2e8253326a3525
permissions -rw-r--r--
Bug 588607 - 2. Make the Java wrapper use the new library loader, r=blassey a=blocking-fennec

# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is the Mozilla browser.
#
# The Initial Developer of the Original Code is
#   Mozilla Foundation
# Portions created by the Initial Developer are Copyright (C) 2009-2010
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#   Vladimir Vukicevic <vladimir@pobox.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****

DEPTH		= ../..
topsrcdir	= @top_srcdir@
srcdir		= @srcdir@
VPATH		= @srcdir@

include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/ipc/app/defs.mk

JAVAFILES = \
  GeckoApp.java \
  GeckoAppShell.java \
  GeckoEvent.java \
  GeckoSurfaceView.java \
  GeckoInputConnection.java \
  AlertNotification.java \
  $(NULL)

PROCESSEDJAVAFILES = \
  App.java \
  Restarter.java \
  NotificationHandler.java \
  $(NULL)


ifneq (,$(findstring -march=armv7,$(OS_CFLAGS)))
MIN_CPU_VERSION=7
else
MIN_CPU_VERSION=5
endif

DEFINES += \
  -DMOZ_APP_DISPLAYNAME=$(MOZ_APP_DISPLAYNAME) \
  -DMOZ_APP_NAME=$(MOZ_APP_NAME) \
  -DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \
  -DMOZ_CHILD_PROCESS_NAME=$(MOZ_CHILD_PROCESS_NAME) \
  -DMOZ_MIN_CPU_VERSION=$(MIN_CPU_VERSION) \
  $(NULL)

GARBAGE += \
  AndroidManifest.xml  \
  classes.dex  \
  $(PROCESSEDJAVAFILES) \
  gecko.ap_  \
  res/values/strings.xml \
  R.java \
  $(NULL)

GARBAGE_DIRS += classes

# Bug 567884 - Need a way to find appropriate icons during packaging
ifeq ($(MOZ_APP_NAME),fennec)
ICON_PATH = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/fennec_48x48.png
ICON_PATH_HDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/fennec_72x72.png
else
ICON_PATH = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/icon48.png
ICON_PATH_HDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/icon64.png
endif

RES_LAYOUT = \
  res/layout/notification_progress.xml \
  res/layout/notification_progress_text.xml
  $(NULL)

JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar

DEFAULT_BRANDPATH = $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales/en-US/brand.dtd
DEFAULT_STRINGSPATH = android_strings.dtd

include $(topsrcdir)/config/rules.mk

# Override the Java settings with some specific android settings
include $(topsrcdir)/config/android-common.mk

# Note that we're going to set up a dependency directly between embed_android.dex and the java files
# Instead of on the .class files, since more than one .class file might be produced per .java file
classes.dex: $(JAVAFILES) $(PROCESSEDJAVAFILES) R.java
	$(NSINSTALL) -D classes
	$(JAVAC) $(JAVAC_FLAGS) -d classes  $(addprefix $(srcdir)/,$(JAVAFILES)) $(PROCESSEDJAVAFILES) R.java
	$(DX) --dex --output=$@ classes

AndroidManifest.xml $(PROCESSEDJAVAFILES): % : %.in
	$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
             $(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $< > $@

res/drawable/icon.png: $(MOZ_APP_ICON)
	$(NSINSTALL) -D res/drawable
	cp $(ICON_PATH) $@

res/drawable-hdpi/icon.png: $(MOZ_APP_ICON)
	$(NSINSTALL) -D res/drawable-hdpi
	cp $(ICON_PATH_HDPI) $@

ifdef MOZ_ANDROID_DRAWABLES
RES_DRAWABLE = $(addprefix res/drawable/,$(notdir $(MOZ_ANDROID_DRAWABLES)))

$(RES_DRAWABLE): $(addprefix $(topsrcdir)/,$(MOZ_ANDROID_DRAWABLES))
	$(NSINSTALL) -D res/drawable
	$(NSINSTALL) $^ res/drawable/
endif

$(RES_LAYOUT): $(subst res/,$(srcdir)/resources/,$(RES_LAYOUT))
	$(NSINSTALL) -D res/layout
	$(NSINSTALL) $(srcdir)/resources/layout/* res/layout/

R.java: $(MOZ_APP_ICON) $(RES_LAYOUT) $(RES_DRAWABLE) res/values/strings.xml $(LOCALIZED_STRINGS_XML) AndroidManifest.xml
	$(AAPT) package -f -M AndroidManifest.xml -I $(ANDROID_SDK)/android.jar -S res -J . --custom-package org.mozilla.gecko

gecko.ap_: AndroidManifest.xml res/drawable/icon.png res/drawable-hdpi/icon.png $(RES_LAYOUT) $(RES_DRAWABLE) res/values/strings.xml $(LOCALIZED_STRINGS_XML)
	$(AAPT) package -f -M AndroidManifest.xml -I $(ANDROID_SDK)/android.jar  -S res -F $@

res/values/strings.xml: FORCE
	mkdir -p res/values
	$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) \
	  -DBRANDPATH="$(DEFAULT_BRANDPATH)" \
	  -DSTRINGSPATH="$(DEFAULT_STRINGSPATH)" \
	  $(srcdir)/strings.xml.in \
	  > $@

libs:: gecko.ap_ classes.dex
	$(INSTALL) classes.dex $(FINAL_TARGET)
	$(UNZIP) -o gecko.ap_ -d $(FINAL_TARGET)