AI 149005: Change from ndk to platform's ndk (pndk), the ability to make your own java callable libraries to c code.

BUG=1857858

Automated import of CL 149005
This commit is contained in:
Mike Ritter
2009-05-19 11:28:10 -07:00
committed by The Android Open Source Project
parent c3c7479ab6
commit 429fbd82d8
23 changed files with 530 additions and 530 deletions

View File

@@ -15,12 +15,12 @@
# #
# Assemble the Platform Development Kit (PDK) # Assemble the Platform Development Kit (PDK)
# (TODO) Figure out why $(ACP) builds with target ndk but not pdk_docs # (TODO) Figure out why $(ACP) builds with target pndk but not pdk_docs
pdk: pdk:
@echo "Package: $@ has targets ndk, pdk_docs and pdk_all" @echo "Package: $@ has targets pndk, pdk_docs and pdk_all"
pdk_all: ndk pdk_docs pdk_all: pndk pdk_docs
@echo "Package: $^" @echo "Package: $^"
LOCAL_PATH := $(call my-dir) LOCAL_PATH := $(call my-dir)
@@ -28,8 +28,8 @@ LOCAL_PATH := $(call my-dir)
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Make the Native Development Kit (Code examples) # Make the Native Development Kit (Code examples)
# Allows vendors to build shared libraries without entire source tree. # Allows vendors to build shared libraries without entire source tree.
# This include adds /ndk to LOCAL_PATH, so can't use it afterwards... # This include adds /pndk to LOCAL_PATH, so can't use it afterwards...
include $(LOCAL_PATH)/ndk/Ndk.mk include $(LOCAL_PATH)/pndk/Pndk.mk
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
@@ -180,7 +180,7 @@ $(LOCAL_PATH)/pdk-timestamp: $(pdk_docs_intermediates)/pdk-timestamp
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_SRC_FILES := pdk-timestamp samples/samplejni/src/com/example/jniexample/JNIExample.java LOCAL_SRC_FILES := pdk-timestamp samples/samplejni/src/com/example/jniexample/JNIExample.java
LOCAL_MODULE_CLASS := development/pdk/ndk/samples/samplejni/src/com/example/jniexample LOCAL_MODULE_CLASS := development/pdk/pndk/samples/samplejni/src/com/example/jniexample
LOCAL_DROIDDOC_SOURCE_PATH := $(framework_docs_LOCAL_DROIDDOC_SOURCE_PATH) LOCAL_DROIDDOC_SOURCE_PATH := $(framework_docs_LOCAL_DROIDDOC_SOURCE_PATH)
LOCAL_DROIDDOC_HTML_DIR := ../../../$(pdk_app_eng_root) LOCAL_DROIDDOC_HTML_DIR := ../../../$(pdk_app_eng_root)

View File

@@ -28,7 +28,7 @@ then build everything:
so you can have a record of the build commands in the logs directory. so you can have a record of the build commands in the logs directory.
5) the pdk and ndk tar file is put in the dist directory. 5) the pdk and pndk tar file is put in the dist directory.
6) the pdk-docs are in 6) the pdk-docs are in
@@ -38,10 +38,10 @@ so you can have a record of the build commands in the logs directory.
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
# Build Notes # Build Notes
The build target 'pdk' brings in the pdk/ndk make files into the build system. The build target 'pdk' brings in the pdk/pndk make files into the build system.
Then there are three targets: Then there are three targets:
pdk_docs - which builds just the pdk documentation pdk_docs - which builds just the pdk documentation
ndk - which builds the native development kit (native compiler, linker, etc.) pndk - which builds the platform's native development kit (native compiler, linker, etc.)
pdk_all - which builds the above two targets pdk_all - which builds the above two targets
To change which version of doxygen runs you can pass in the variable: To change which version of doxygen runs you can pass in the variable:
@@ -90,13 +90,13 @@ To add port forwarding
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
# Deployment # Deployment
To host the pdk docs on the interanl appengine run: To host the pdk docs on the internal appengine run:
/home/build/static/projects/apphosting/devtools/appcfg.py update <path_to_cupcake_src>/out/common/docs /home/build/static/projects/apphosting/devtools/appcfg.py update <path_to_cupcake_src>/out/target/common/docs
where the docs directory contains: pdk.py, app.yaml, and the online-pdk directory, where the docs directory contains: pdk.py, app.yaml, and the online-pdk directory,
all of which are tarred up by the Pdk.mk file when using the target pdk_docs. all of which are tarred up by the Pdk.mk file when using the target pdk_docs.
To host the pdk docs on the external appengine run: To host the pdk docs on the external appengine run:
/home/build/static/projects/apphosting/devtools/appcfg.py -s pdk-docs.appspot.com update <path_to_cupcake_src>/out/common/docs /home/build/static/projects/apphosting/devtools/appcfg.py -s pdk-docs.appspot.com update <path_to_cupcake_src>/out/target/common/docs
where the docs directory contains: pdk.py, app.yaml, and the online-pdk directory, where the docs directory contains: pdk.py, app.yaml, and the online-pdk directory,
all of which are tarred up by the Pdk.mk file when using the target pdk_docs. all of which are tarred up by the Pdk.mk file when using the target pdk_docs.

View File

@@ -1,232 +0,0 @@
#
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Assemble the Native Development Kit
# Assembled using the generic build by default.
# (set in device/config/product_config.make)
# A macro to make rules to copy all newer files in a directory tree matching an
# optional find filter and add the files to a list variable for dependencies.
# Designed after copy_headers.make: Create a rule to copy each file;
# copy-one-file defines the actual rule.
# $(1): source directory tree root
# $(2): destination directory tree root
# $(3): list variable to append destination files to
# $(4): optional find(1) arguments
define define-tree-copy-rules
$(eval _src_files := $(shell find $(1) -type f $(4))) \
$(foreach _src, $(_src_files), \
$(eval _dest := $(patsubst $(1)%,$(2)%,$(_src))) \
$(eval $(3) := $($(3)) $(_dest)) \
$(eval $(call copy-one-file,$(_src),$(_dest))) \
)
endef
#-------------------------------------------------------------------------------
# Install all the files needed to build the ndk.
# We build three versions of the NDK
# (1) The full version, with source.
# (2) The full version, without source.
# (3) A JNI-only version, with source.
#
# We make five sets of trees:
# (A) Common files used in all versions of the NDK
# (B) Common files used in the full versions of the NDK
# (C) Files used in the standard ndk (no source files included)
# (D) Files used in both the JNI-only and full-with-source version
# (E) Files used in just the full-with-source version
#
# Each NDK version is created by combining the appropriate trees:
#
# (A) (B) (C) (D) (E)
# (1) yes yes yes yes
# (2) yes yes yes
# (3) yes yes
#
# Source is provided for partners who want to recompile our libraries for optimization.
# The JNI-only version is provided for partners that want to create shared
# libraries that can be packaged with APK files and called from Java code.
LOCAL_PATH := $(call my-dir)
# Source trees for the ndk
samples_src_dir := $(LOCAL_PATH)/samples
sample_src_dir := $(samples_src_dir)/sample
samplejni_src_dir := $(samples_src_dir)/samplejni
config_src_dir := $(LOCAL_PATH)/config
kernel_common_src_dir := $(KERNEL_HEADERS_COMMON)
kernel_arch_src_dir := $(KERNEL_HEADERS_ARCH)
bionic_src_dir := bionic
jni_src_dir := $(JNI_H_INCLUDE)
# Workspace directory
ndk_intermediates := $(call intermediates-dir-for,PACKAGING,ndk)
# Common destination trees for the ndk
ndk_common_tree := $(ndk_intermediates)/common
ndk_common_dest_dir := $(ndk_common_tree)/ndk
samplejni_dest_dir := $(ndk_common_dest_dir)/samples/samplejni
config_dest_dir := $(ndk_common_dest_dir)/config
kernel_dest_dir := $(ndk_common_dest_dir)/include/kernel/include
gcc_dest_dir := $(ndk_common_dest_dir)/toolchain
jni_dest_dir := $(ndk_common_dest_dir)/include/nativehelper
# Common-full destination trees for the ndk
ndk_common_full_tree := $(ndk_intermediates)/common_full
ndk_common_full_dest_dir := $(ndk_common_full_tree)/ndk
sample_dest_dir := $(ndk_common_full_dest_dir)/samples/sample
# Destination trees without source for the standard ndk (without source)
ndk_no_src_tree := $(ndk_intermediates)/no_src
ndk_no_src_dest_dir := $(ndk_no_src_tree)/ndk
bionic_no_src_dest_dir := $(ndk_no_src_dest_dir)/include/bionic
# Destination trees including source for the ndk with source
ndk_src_tree := $(ndk_intermediates)/with_src
ndk_src_dest_dir := $(ndk_src_tree)/ndk
bionic_src_dest_dir := $(ndk_src_dest_dir)/include/bionic
# Destinations of all common files (not picked up by tree rules below)
ndk_common_dest_files := $(ndk_common_dest_dir)/Android_NDK_README.html \
$(ndk_common_dest_dir)/config/armelf.x \
$(ndk_common_dest_dir)/config/armelflib.x \
$(ndk_common_dest_dir)/lib/crtbegin_dynamic.o \
$(ndk_common_dest_dir)/lib/crtend_android.o \
$(ndk_common_dest_dir)/lib/libc.so \
$(ndk_common_dest_dir)/lib/libm.so
# Destinations of files used by the full, non-jni-only configurations
ndk_common_full_dest_files := \
$(ndk_common_full_dest_dir)/lib/libdl.so \
$(ndk_common_full_dest_dir)/lib/libstdc++.so
# Install common files outside common trees
$(ndk_common_dest_dir)/Android_NDK_README.html: $(LOCAL_PATH)/Android_NDK_README.html | $(ACP)
@echo "NDK Android_NDK_README.html: from $? to $@"
$(copy-file-to-target)
$(ndk_common_dest_dir)/config/armelf.x: $(BUILD_SYSTEM)/armelf.x | $(ACP)
@echo "NDK config: $@"
$(copy-file-to-target)
$(ndk_common_dest_dir)/config/armelflib.x: $(BUILD_SYSTEM)/armelflib.x | $(ACP)
@echo "NDK config: $@"
$(copy-file-to-target)
$(ndk_common_dest_dir)/lib/%: $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/% | $(ACP)
@echo "NDK lib: $@"
$(copy-file-to-target)
# Install common_full files outside common trees
$(ndk_common_full_dest_dir)/lib/%: $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/% | $(ACP)
@echo "NDK lib full: $@"
$(copy-file-to-target)
# Install files in common trees
listvar := ndk_common_dest_files
$(call define-tree-copy-rules,$(samplejni_src_dir),$(samplejni_dest_dir),$(listvar))
$(call define-tree-copy-rules,$(config_src_dir),$(config_dest_dir),$(listvar))
$(call define-tree-copy-rules,$(kernel_common_src_dir),$(kernel_dest_dir),$(listvar))
$(call define-tree-copy-rules,$(kernel_arch_src_dir),$(kernel_dest_dir),$(listvar))
$(call define-tree-copy-rules,$(jni_src_dir),$(jni_dest_dir),$(listvar), -name jni.h)
# Install files common to the full builds but not the JNI build
listvar := ndk_common_full_dest_files
$(call define-tree-copy-rules,$(sample_src_dir),$(sample_dest_dir),$(listvar))
# Install files without sources
listvar := ndk_no_src_dest_files
$(call define-tree-copy-rules,$(bionic_src_dir),$(bionic_no_src_dest_dir),$(listvar),-name '*.h')
# Install files including sources
listvar := ndk_with_src_dest_files
$(call define-tree-copy-rules,$(bionic_src_dir),$(bionic_src_dest_dir),$(listvar))
#-------------------------------------------------------------------------------
# Create the multiple versions of the ndk:
# ndk_no_src all files without source
# ndk_with_source all files with source
# ndk_jni_with_source just files for building JNI shared libraries with source.
# Name the tar files
name := android_ndk-$(TARGET_PRODUCT)
ifeq ($(TARGET_BUILD_TYPE),debug)
name := $(name)_debug
endif
name := $(name)-$(BUILD_NUMBER)
ndk_tarfile := $(ndk_intermediates)/$(name).tar
ndk_tarfile_zipped := $(ndk_tarfile).gz
ndk_with_src_tarfile := $(ndk_intermediates)/$(name)-src.tar
ndk_with_src_tarfile_zipped := $(ndk_with_src_tarfile).gz
ndk_jni_with_src_tarfile := $(ndk_intermediates)/$(name)-jni-src.tar
ndk_jni_with_src_tarfile_zipped := $(ndk_jni_with_src_tarfile).gz
.PHONY: ndk ndk_with_src ndk_no_src ndk_jni_with_src ndk_debug
ndk: ndk_no_src ndk_with_src ndk_jni_with_src
ndk_no_src: $(ndk_tarfile_zipped)
ndk_with_src: $(ndk_with_src_tarfile_zipped)
ndk_jni_with_src: $(ndk_jni_with_src_tarfile_zipped)
# Put the ndk zip files in the distribution directory
$(call dist-for-goals,ndk,$(ndk_tarfile_zipped))
$(call dist-for-goals,ndk,$(ndk_with_src_tarfile_zipped))
$(call dist-for-goals,ndk,$(ndk_jni_with_src_tarfile_zipped))
# zip up tar files
%.tar.gz: %.tar
@echo "NDK: zipped $<"
$(hide) gzip -cf $< > $@
# tar up the files without our sources to make the ndk.
$(ndk_tarfile): $(ndk_common_dest_files) $(ndk_common_full_dest_files) $(ndk_no_src_dest_files)
@echo "NDK: $@"
@mkdir -p $(dir $@)
@rm -f $@
$(hide) tar rf $@ -C $(ndk_common_tree) ndk
$(hide) tar rf $@ -C $(ndk_common_full_tree) ndk
$(hide) tar rf $@ -C $(ndk_no_src_tree) ndk
# tar up the full sources to make the ndk with sources.
$(ndk_with_src_tarfile): $(ndk_common_dest_files) $(ndk_common_full_dest_files) $(ndk_with_src_dest_files) $(ndk_full_with_src_dest_files)
@echo "NDK: $@"
@mkdir -p $(dir $@)
@rm -f $@
$(hide) tar rf $@ -C $(ndk_common_tree) ndk
$(hide) tar rf $@ -C $(ndk_common_full_tree) ndk
$(hide) tar rf $@ -C $(ndk_src_tree) ndk
# tar up the sources to make the ndk with JNI support.
$(ndk_jni_with_src_tarfile): $(ndk_common_dest_files) $(ndk_with_src_dest_files)
@echo "NDK: $@"
@mkdir -p $(dir $@)
@rm -f $@
$(hide) tar rf $@ -C $(ndk_common_tree) ndk
$(hide) tar rf $@ -C $(ndk_src_tree) ndk
# Debugging reporting can go here, add it as a target to get output.
ndk_debug: ndk
@echo "You are here: $@"
@echo "ndk tar file: $(ndk_tarfile_zipped)"
@echo "ndk_with_src tar file: $(ndk_with_src_tarfile_zipped)"
@echo "ndk_jni_with_src tar file: $(ndk_jni_with_src_tarfile_zipped)"
@echo "ndk_files: $(ndk_no_src_dest_files)"
@echo "ndk_with_src files: $(ndk_with_src_dest_files)"
@echo "ndk_full_with_src files: $(ndk_full_with_src_dest_files)"
@echo "ndk_common_files: $(ndk_common_dest_files)"
@echo "ndk_common_full_dest_files: $(ndk_common_full_dest_files)"

View File

@@ -718,14 +718,14 @@ under Windows is not yet supported.<br>
<h2> <h2>
<span style=FONT-FAMILY:Verdana>Unpacking the NDK</span> <span style=FONT-FAMILY:Verdana>Unpacking the NDK</span>
</h2> </h2>
Unpack the android_ndk.tar.gz into your working directory<br> Unpack the android_pndk.tar.gz into your working directory<br>
<br> <br>
<div style=MARGIN-LEFT:40px> <div style=MARGIN-LEFT:40px>
<span style="FONT-FAMILY:Courier New">tar -zxvf <span style="FONT-FAMILY:Courier New">tar -zxvf
android_ndk.tar.gz</span><br> android_pndk.tar.gz</span><br>
</div> </div>
<br> <br>
This will create a directory called ndk. It should contain a README.html This will create a directory called pndk. It should contain a README.html
file (this file) and the following directories: config, include, lib, and file (this file) and the following directories: config, include, lib, and
sample.<br> sample.<br>
<br> <br>

232
pdk/pndk/Pndk.mk Normal file
View File

@@ -0,0 +1,232 @@
#
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Assemble the Native Development Kit
# Assembled using the generic build by default.
# (set in device/config/product_config.make)
# A macro to make rules to copy all newer files in a directory tree matching an
# optional find filter and add the files to a list variable for dependencies.
# Designed after copy_headers.make: Create a rule to copy each file;
# copy-one-file defines the actual rule.
# $(1): source directory tree root
# $(2): destination directory tree root
# $(3): list variable to append destination files to
# $(4): optional find(1) arguments
define define-tree-copy-rules
$(eval _src_files := $(shell find $(1) -type f $(4))) \
$(foreach _src, $(_src_files), \
$(eval _dest := $(patsubst $(1)%,$(2)%,$(_src))) \
$(eval $(3) := $($(3)) $(_dest)) \
$(eval $(call copy-one-file,$(_src),$(_dest))) \
)
endef
#-------------------------------------------------------------------------------
# Install all the files needed to build the pndk.
# We build three versions of the pndk
# (1) The full version, with source.
# (2) The full version, without source.
# (3) A JNI-only version, with source.
#
# We make five sets of trees:
# (A) Common files used in all versions of the pndk
# (B) Common files used in the full versions of the pndk
# (C) Files used in the standard pndk (no source files included)
# (D) Files used in both the JNI-only and full-with-source version
# (E) Files used in just the full-with-source version
#
# Each pndk version is created by combining the appropriate trees:
#
# (A) (B) (C) (D) (E)
# (1) yes yes yes yes
# (2) yes yes yes
# (3) yes yes
#
# Source is provided for partners who want to recompile our libraries for optimization.
# The JNI-only version is provided for partners that want to create shared
# libraries that can be packaged with APK files and called from Java code.
LOCAL_PATH := $(call my-dir)
# Source trees for the pndk
samples_src_dir := $(LOCAL_PATH)/samples
sample_src_dir := $(samples_src_dir)/sample
samplejni_src_dir := $(samples_src_dir)/samplejni
config_src_dir := $(LOCAL_PATH)/config
kernel_common_src_dir := $(KERNEL_HEADERS_COMMON)
kernel_arch_src_dir := $(KERNEL_HEADERS_ARCH)
bionic_src_dir := bionic
jni_src_dir := $(JNI_H_INCLUDE)
# Workspace directory
pndk_intermediates := $(call intermediates-dir-for,PACKAGING,pndk)
# Common destination trees for the pndk
pndk_common_tree := $(pndk_intermediates)/common
pndk_common_dest_dir := $(pndk_common_tree)/pndk
samplejni_dest_dir := $(pndk_common_dest_dir)/samples/samplejni
config_dest_dir := $(pndk_common_dest_dir)/config
kernel_dest_dir := $(pndk_common_dest_dir)/include/kernel/include
gcc_dest_dir := $(pndk_common_dest_dir)/toolchain
jni_dest_dir := $(pndk_common_dest_dir)/include/nativehelper
# Common-full destination trees for the pndk
pndk_common_full_tree := $(pndk_intermediates)/common_full
pndk_common_full_dest_dir := $(pndk_common_full_tree)/pndk
sample_dest_dir := $(pndk_common_full_dest_dir)/samples/sample
# Destination trees without source for the standard pndk (without source)
pndk_no_src_tree := $(pndk_intermediates)/no_src
pndk_no_src_dest_dir := $(pndk_no_src_tree)/pndk
bionic_no_src_dest_dir := $(pndk_no_src_dest_dir)/include/bionic
# Destination trees including source for the pndk with source
pndk_src_tree := $(pndk_intermediates)/with_src
pndk_src_dest_dir := $(pndk_src_tree)/pndk
bionic_src_dest_dir := $(pndk_src_dest_dir)/include/bionic
# Destinations of all common files (not picked up by tree rules below)
pndk_common_dest_files := $(pndk_common_dest_dir)/Android_PNDK_README.html \
$(pndk_common_dest_dir)/config/armelf.x \
$(pndk_common_dest_dir)/config/armelflib.x \
$(pndk_common_dest_dir)/lib/crtbegin_dynamic.o \
$(pndk_common_dest_dir)/lib/crtend_android.o \
$(pndk_common_dest_dir)/lib/libc.so \
$(pndk_common_dest_dir)/lib/libm.so
# Destinations of files used by the full, non-jni-only configurations
pndk_common_full_dest_files := \
$(pndk_common_full_dest_dir)/lib/libdl.so \
$(pndk_common_full_dest_dir)/lib/libstdc++.so
# Install common files outside common trees
$(pndk_common_dest_dir)/Android_PNDK_README.html: $(LOCAL_PATH)/Android_PNDK_README.html | $(ACP)
@echo "pndk Android_PNDK_README.html: from $? to $@"
$(copy-file-to-target)
$(pndk_common_dest_dir)/config/armelf.x: $(BUILD_SYSTEM)/armelf.x | $(ACP)
@echo "pndk config: $@"
$(copy-file-to-target)
$(pndk_common_dest_dir)/config/armelflib.x: $(BUILD_SYSTEM)/armelflib.x | $(ACP)
@echo "pndk config: $@"
$(copy-file-to-target)
$(pndk_common_dest_dir)/lib/%: $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/% | $(ACP)
@echo "pndk lib: $@"
$(copy-file-to-target)
# Install common_full files outside common trees
$(pndk_common_full_dest_dir)/lib/%: $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/% | $(ACP)
@echo "pndk lib full: $@"
$(copy-file-to-target)
# Install files in common trees
listvar := pndk_common_dest_files
$(call define-tree-copy-rules,$(samplejni_src_dir),$(samplejni_dest_dir),$(listvar))
$(call define-tree-copy-rules,$(config_src_dir),$(config_dest_dir),$(listvar))
$(call define-tree-copy-rules,$(kernel_common_src_dir),$(kernel_dest_dir),$(listvar))
$(call define-tree-copy-rules,$(kernel_arch_src_dir),$(kernel_dest_dir),$(listvar))
$(call define-tree-copy-rules,$(jni_src_dir),$(jni_dest_dir),$(listvar), -name jni.h)
# Install files common to the full builds but not the JNI build
listvar := pndk_common_full_dest_files
$(call define-tree-copy-rules,$(sample_src_dir),$(sample_dest_dir),$(listvar))
# Install files without sources
listvar := pndk_no_src_dest_files
$(call define-tree-copy-rules,$(bionic_src_dir),$(bionic_no_src_dest_dir),$(listvar),-name '*.h')
# Install files including sources
listvar := pndk_with_src_dest_files
$(call define-tree-copy-rules,$(bionic_src_dir),$(bionic_src_dest_dir),$(listvar))
#-------------------------------------------------------------------------------
# Create the multiple versions of the pndk:
# pndk_no_src all files without source
# pndk_with_source all files with source
# pndk_jni_with_source just files for building JNI shared libraries with source.
# Name the tar files
name := android_pndk-$(TARGET_PRODUCT)
ifeq ($(TARGET_BUILD_TYPE),debug)
name := $(name)_debug
endif
name := $(name)-$(BUILD_NUMBER)
pndk_tarfile := $(pndk_intermediates)/$(name).tar
pndk_tarfile_zipped := $(pndk_tarfile).gz
pndk_with_src_tarfile := $(pndk_intermediates)/$(name)-src.tar
pndk_with_src_tarfile_zipped := $(pndk_with_src_tarfile).gz
pndk_jni_with_src_tarfile := $(pndk_intermediates)/$(name)-jni-src.tar
pndk_jni_with_src_tarfile_zipped := $(pndk_jni_with_src_tarfile).gz
.PHONY: pndk pndk_with_src pndk_no_src pndk_jni_with_src pndk_debug
pndk: pndk_no_src pndk_with_src pndk_jni_with_src
pndk_no_src: $(pndk_tarfile_zipped)
pndk_with_src: $(pndk_with_src_tarfile_zipped)
pndk_jni_with_src: $(pndk_jni_with_src_tarfile_zipped)
# Put the pndk zip files in the distribution directory
$(call dist-for-goals,pndk,$(pndk_tarfile_zipped))
$(call dist-for-goals,pndk,$(pndk_with_src_tarfile_zipped))
$(call dist-for-goals,pndk,$(pndk_jni_with_src_tarfile_zipped))
# zip up tar files
%.tar.gz: %.tar
@echo "pndk: zipped $<"
$(hide) gzip -cf $< > $@
# tar up the files without our sources to make the pndk.
$(pndk_tarfile): $(pndk_common_dest_files) $(pndk_common_full_dest_files) $(pndk_no_src_dest_files)
@echo "pndk: $@"
@mkdir -p $(dir $@)
@rm -f $@
$(hide) tar rf $@ -C $(pndk_common_tree) pndk
$(hide) tar rf $@ -C $(pndk_common_full_tree) pndk
$(hide) tar rf $@ -C $(pndk_no_src_tree) pndk
# tar up the full sources to make the pndk with sources.
$(pndk_with_src_tarfile): $(pndk_common_dest_files) $(pndk_common_full_dest_files) $(pndk_with_src_dest_files) $(pndk_full_with_src_dest_files)
@echo "pndk: $@"
@mkdir -p $(dir $@)
@rm -f $@
$(hide) tar rf $@ -C $(pndk_common_tree) pndk
$(hide) tar rf $@ -C $(pndk_common_full_tree) pndk
$(hide) tar rf $@ -C $(pndk_src_tree) pndk
# tar up the sources to make the pndk with JNI support.
$(pndk_jni_with_src_tarfile): $(pndk_common_dest_files) $(pndk_with_src_dest_files)
@echo "pndk: $@"
@mkdir -p $(dir $@)
@rm -f $@
$(hide) tar rf $@ -C $(pndk_common_tree) pndk
$(hide) tar rf $@ -C $(pndk_src_tree) pndk
# Debugging reporting can go here, add it as a target to get output.
pndk_debug: pndk
@echo "You are here: $@"
@echo "pndk tar file: $(pndk_tarfile_zipped)"
@echo "pndk_with_src tar file: $(pndk_with_src_tarfile_zipped)"
@echo "pndk_jni_with_src tar file: $(pndk_jni_with_src_tarfile_zipped)"
@echo "pndk_files: $(pndk_no_src_dest_files)"
@echo "pndk_with_src files: $(pndk_with_src_dest_files)"
@echo "pndk_full_with_src files: $(pndk_full_with_src_dest_files)"
@echo "pndk_common_files: $(pndk_common_dest_files)"
@echo "pndk_common_full_dest_files: $(pndk_common_full_dest_files)"

View File

@@ -10,9 +10,9 @@ Building an application.
where you type in the actual path to the android source in place of <path_to_android_src> where you type in the actual path to the android source in place of <path_to_android_src>
and the platform you are using instead of <platform>: either linux-x86 or darwin-x86 and the platform you are using instead of <platform>: either linux-x86 or darwin-x86
1) Test the ndk install by building the hello world sample application: 1) Test the pndk install by building the hello world sample application:
cd <your_ndk_base>/samples/sample cd <your_pndk_base>/samples/sample
make clean make clean
make make
@@ -21,7 +21,7 @@ can load and run on the ARM device. To achieve proper runtime behavior, verify
that: that:
* crtbegin_dynamic.o is the first linked object file * crtbegin_dynamic.o is the first linked object file
* crtend_android.o is last linked object. * crtend_android.o is last linked object.
Both are set by the config.mk file in ndk/config. Both are set by the config.mk file in pndk/config.
2) Test that this works correctly by attaching your ARM-based device to the USB 2) Test that this works correctly by attaching your ARM-based device to the USB
port and installing the application (hello) you just made by (in the commands port and installing the application (hello) you just made by (in the commands
@@ -59,7 +59,7 @@ STEP 2
Building and using a library Building and using a library
------- -------
Makefile.lib in ndk/sample shows how to make either a shared library or a Makefile.lib in pndk/sample shows how to make either a shared library or a
static library from the hellolibrary.c source. The example makes the libraries static library from the hellolibrary.c source. The example makes the libraries
libhello-shared.so and libhello-static.a . libhello-shared.so and libhello-static.a .

View File

@@ -19,7 +19,7 @@ Build Steps:
Choose Next Choose Next
Enter "JNIExample" into the Project name: field. Enter "JNIExample" into the Project name: field.
Choose "Create project from existing source" Choose "Create project from existing source"
Click the Browse button and browse to the ndk/samplejni directory Click the Browse button and browse to the pndk/samplejni directory
Click Finish Click Finish

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB