plop
This commit is contained in:
parent
ff5c5a2bc5
commit
8d2df70cfe
@ -1,194 +1,33 @@
|
||||
|
||||
|
||||
|
||||
|
||||
include $(EWOL_FOLDER)/Build/Makefile.common.mk
|
||||
|
||||
#include $(EWOL_FOLDER)/Build/ewol.mk
|
||||
|
||||
###############################################################################
|
||||
### Compilateur base system ###
|
||||
###############################################################################
|
||||
CXX=g++
|
||||
CC=gcc
|
||||
AR=ar
|
||||
|
||||
|
||||
|
||||
X11FLAGS= -lGL -lGLU
|
||||
# some X11 mode availlable :
|
||||
# install package : libxxf86vm-dev
|
||||
X11FLAGS+= -lX11 -DEWOL_X11_MODE__XF86V -lXxf86vm
|
||||
# install package : libxrender-dev
|
||||
#X11FLAGS+= -lX11 -DEWOL_X11_MODE__XRENDER -lXrandr
|
||||
|
||||
|
||||
ifeq ($(shell if `pkg-config --exists freetype2` ; then echo "yes"; else echo "no"; fi), yes)
|
||||
FREETYPE_CFLAGS= `pkg-config --cflags freetype2` -DEWOL_USE_FREE_TYPE
|
||||
FREETYPE_LDFLAGS= `pkg-config --libs freetype2` -DEWOL_USE_FREE_TYPE
|
||||
else
|
||||
FREETYPE_CFLAGS=
|
||||
FREETYPE_LDFLAGS=
|
||||
$(Info libFreeType-dev is not installed)
|
||||
endif
|
||||
|
||||
|
||||
|
||||
OBJECT_DIR=Object_$(PLATFORM)
|
||||
|
||||
ifeq ("$(DEBUG)", "0")
|
||||
OBJECT_DIRECTORY=$(OBJECT_DIR)/release
|
||||
OUTPUT_NAME = $(OUTPUT_NAME_RELEASE)
|
||||
else
|
||||
OBJECT_DIRECTORY=$(OBJECT_DIR)/debug
|
||||
OUTPUT_NAME = $(OUTPUT_NAME_DEBUG)
|
||||
endif
|
||||
|
||||
|
||||
|
||||
###############################################################################
|
||||
### Basic C flags ###
|
||||
###############################################################################
|
||||
|
||||
# basic X11 librairy ==> show if we can une under lib ...
|
||||
CXXFLAGS= $(X11FLAGS) $(FREETYPE_CFLAGS) -D__PLATFORM__$(PLATFORM) $(PROJECT_CXXFLAGS)
|
||||
|
||||
ifeq ("$(DEBUG)", "0")
|
||||
CXXFLAGS+= -O2
|
||||
else
|
||||
# Enable debug (cgdb ***)
|
||||
CXXFLAGS+= -g -O0
|
||||
endif
|
||||
# display all flags
|
||||
CXXFLAGS+= -Wall
|
||||
# ...
|
||||
CXXFLAGS+= -D_REENTRANT
|
||||
# internal defines
|
||||
CXXFLAGS+= $(DEFINE)
|
||||
# remove warning from the convertion char*
|
||||
CXXFLAGS+= -Wno-write-strings
|
||||
|
||||
CXXFLAGS+= -DPROJECT_NAME="$(PROJECT_NAME)"
|
||||
|
||||
CFLAGS= $(CXXFLAGS) -std=c99
|
||||
|
||||
# basic extern librairy
|
||||
LDFLAGS= $(X11FLAGS) $(FREETYPE_LDFLAGS) $(PROJECT_LDFLAGS)
|
||||
|
||||
# Dynamic connection of the CALLBACK of the GUI
|
||||
LDFLAGS+= -Wl,--export-dynamic
|
||||
|
||||
# TODO : add the prefix ...
|
||||
CXXFILES = $(PROJECT_SOURCES)
|
||||
# create the list of module :
|
||||
LISTE_MODULES = $(sort $(dir $(CXXFILES)))
|
||||
|
||||
###############################################################################
|
||||
### Build Object Files List ###
|
||||
###############################################################################
|
||||
OBJ = $(addprefix $(OBJECT_DIRECTORY)/, $(CXXFILES:.cpp=.o))
|
||||
|
||||
|
||||
###############################################################################
|
||||
### Main Part of Makefile ###
|
||||
###############################################################################
|
||||
all: $(PROJECT_NAME)
|
||||
|
||||
-include $(OBJ:.o=.d)
|
||||
|
||||
.ewol:
|
||||
@cd $(EWOL_FOLDER) ; make -s PLATFORM=$(PLATFORM) DEBUG=$(DEBUG)
|
||||
|
||||
.ewol-clean:
|
||||
@cd $(EWOL_FOLDER) ; make -s PLATFORM=$(PLATFORM) clean
|
||||
|
||||
.encadrer:
|
||||
all:
|
||||
@echo $(CADRE_HAUT_BAS)
|
||||
@echo $(CADRE_COTERS)
|
||||
@echo '
DEBUT DE COMPILATION DU PROGRAMME :'$(CADRE_COTERS)
|
||||
@echo '
Repertoire Sources : $(PROJECT_FILE_DIRECTORY)/'$(CADRE_COTERS)
|
||||
@echo '
Repertoire object : $(OBJECT_DIRECTORY)/'$(CADRE_COTERS)
|
||||
@echo '
Binaire de sortie : $(F_VIOLET)$(PROJECT_NAME) $(F_NORMALE)'$(CADRE_COTERS)
|
||||
@echo '
Project name : $(F_BLUE)$(PROJECT_NAME)$(F_NORMALE)'$(CADRE_COTERS)
|
||||
@echo '
Project Vendor : $(F_CYAN)$(PROJECT_VENDOR)$(F_NORMALE)'$(CADRE_COTERS)
|
||||
@echo '
Build date : $(F_ROUGE)$(BUILD_TIME) $(F_NORMALE)'$(CADRE_COTERS)
|
||||
@echo '
Tag : $(F_VIOLET)$(PROJECT_VERSION_TAG) $(F_NORMALE)'$(CADRE_COTERS)
|
||||
@echo $(CADRE_COTERS)
|
||||
@echo $(CADRE_HAUT_BAS)
|
||||
@mkdir -p $(addprefix $(OBJECT_DIRECTORY)/, $(LISTE_MODULES))
|
||||
|
||||
@echo $(F_ROUGE)"
(ndk-build) build native code"$(F_NORMALE)
|
||||
cd $(PROJECT_NDK) ; NDK_PROJECT_PATH=$(PROJECT_PATH) NDK_MODULE_PATH=$(PROJECT_MODULE) ./ndk-build
|
||||
#cd $(PROJECT_NDK) ; NDK_PROJECT_PATH=$(PROJECT_PATH) NDK_MODULE_PATH=$(PROJECT_MODULE) NDK_LOG=~/.ndklog.txt make -f $(EWOL_FOLDER)/Build/coreLinux/build-local.mk
|
||||
|
||||
$(info PROJECT_FILE_DIRECTORY=$(PROJECT_FILE_DIRECTORY) ; OBJECT_DIRECTORY=$(OBJECT_DIRECTORY))
|
||||
|
||||
# build C++
|
||||
$(OBJECT_DIRECTORY)/%.o: $(PROJECT_FILE_DIRECTORY)/%.cpp $(MAKE_DEPENDENCE)
|
||||
@echo $(F_VERT)"
(.o) $<"$(F_NORMALE)
|
||||
@$(CXX) $< -c -o $@ $(INCLUDE_DIRECTORY) $(CXXFLAGS) -MMD
|
||||
|
||||
# build binary Release Mode
|
||||
$(PROJECT_NAME): .ewol .encadrer $(PROJECT_LIB_DEPENDENCY) $(OBJ) $(MAKE_DEPENDENCE)
|
||||
@echo $(F_ROUGE)"
(bin) $(PROJECT_NAME) "$(F_NORMALE)
|
||||
@$(CXX) $(OBJ) $(EWOL_FOLDER)/libewol.a $(LDFLAGS) -o $@
|
||||
|
||||
|
||||
|
||||
clean: .ewol-clean
|
||||
install: all
|
||||
@echo $(CADRE_HAUT_BAS)
|
||||
@echo ' CLEANING : $(F_VIOLET)$(OUTPUT_NAME)$(F_NORMALE)'$(CADRE_COTERS)
|
||||
@echo ' INSTALL : $(F_VIOLET)./bin/$(PROJECT_NAME)-debug.apk$(F_NORMALE)'$(CADRE_COTERS)
|
||||
@echo $(CADRE_HAUT_BAS)
|
||||
@echo $(F_VERT)"
(rm) $(OBJECT_DIR)"$(F_NORMALE)
|
||||
@rm -rf $(OBJECT_DIR)
|
||||
@echo $(F_VERT)"
(rm) $(PROJECT_NAME) $(OUTPUT_NAME_DEBUG) $(OUTPUT_NAME_RELEASE)"$(F_NORMALE)
|
||||
@rm -f $(PROJECT_NAME) $(OUTPUT_NAME_DEBUG) $(OUTPUT_NAME_RELEASE)
|
||||
@echo $(F_VERT)"
(rm) doxygen/*"$(F_NORMALE)
|
||||
@rm -rf doxygen
|
||||
@rm -f doxygen.log
|
||||
@echo $(F_VERT)"
(rm) *.bck"$(F_NORMALE)
|
||||
@rm -f `find . -name "*.bck"`
|
||||
|
||||
|
||||
count:
|
||||
wc -l Makefile `find $(FILE_DIRECTORY)/ -name "*.cpp"` `find $(PROJECT_FILE_DIRECTORY)/ -name "*.h"`
|
||||
|
||||
|
||||
install: .encadrer .versionFile $(PROJECT_NAME)
|
||||
@echo ' INSTALL : $(OUTPUT_NAME_RELEASE)=>$(PROJECT_NAME)'
|
||||
@echo " (stripped) $(OUTPUT_NAME_RELEASE) => $(PROJECT_NAME) "
|
||||
@cp $(OUTPUT_NAME_RELEASE) $(PROJECT_NAME)
|
||||
@strip -s $(PROJECT_NAME)
|
||||
@echo " (copy) $(PROJECT_NAME) /usr/bin/ "
|
||||
@cp -vf $(PROJECT_NAME) /usr/bin/
|
||||
@echo " (data) data/* ==> /usr/share/$(PROJECT_NAME)/ "
|
||||
@mkdir -p /usr/share/$(PROJECT_NAME)/
|
||||
@rm -rf /usr/share/$(PROJECT_NAME)/*
|
||||
@cp -vf assets/* /usr/share/$(PROJECT_NAME)/
|
||||
|
||||
|
||||
# http://alp.developpez.com/tutoriels/debian/creer-paquet/
|
||||
package: .encadrer
|
||||
@echo 'Create Folders ...'
|
||||
@mkdir -p package/$(PROJECT_NAME)/DEBIAN/
|
||||
@mkdir -p package/$(PROJECT_NAME)/usr/bin/
|
||||
@mkdir -p package/$(PROJECT_NAME)/usr/share/doc/
|
||||
@mkdir -p package/$(PROJECT_NAME)/usr/share/edn/
|
||||
# Create the control file
|
||||
@echo "Package: "$(PROJECT_NAME) > package/$(PROJECT_NAME)/DEBIAN/control
|
||||
@echo "Version: "$(VERSION_TAG_SHORT) >> package/$(PROJECT_NAME)/DEBIAN/control
|
||||
@echo "Section: Development,Editors" >> package/$(PROJECT_NAME)/DEBIAN/control
|
||||
@echo "Priority: optional" >>package/$(PROJECT_NAME)/DEBIAN/control
|
||||
@echo "Architecture: all" >> package/$(PROJECT_NAME)/DEBIAN/control
|
||||
@echo "Depends: bash" >> package/$(PROJECT_NAME)/DEBIAN/control
|
||||
@echo "Maintainer: Mr DUPIN Edouard <yui.heero@gmail.com>" >> package/$(PROJECT_NAME)/DEBIAN/control
|
||||
@echo "Description: Text editor for sources code with ctags management" >> package/$(PROJECT_NAME)/DEBIAN/control
|
||||
@echo "" >> package/$(PROJECT_NAME)/DEBIAN/control
|
||||
# Create the PostRm
|
||||
@echo "#!/bin/bash" > package/$(PROJECT_NAME)/DEBIAN/postrm
|
||||
@echo "rm ~/."$(PROJECT_NAME) >> package/$(PROJECT_NAME)/DEBIAN/postrm
|
||||
@echo "" >> package/$(PROJECT_NAME)/DEBIAN/postrm
|
||||
# Enable Execution in script
|
||||
@chmod 755 package/$(PROJECT_NAME)/DEBIAN/post*
|
||||
@#chmod 755 package/$(PROJECT_NAME)/DEBIAN/pre*
|
||||
# copy licence and information :
|
||||
@cp README package/$(PROJECT_NAME)/usr/share/doc/README
|
||||
@cp licence.txt package/$(PROJECT_NAME)/usr/share/doc/copyright
|
||||
@echo "First generation in progress" >> package/$(PROJECT_NAME)/usr/share/doc/changelog
|
||||
@cp -vf $(PROJECT_NAME) package/$(PROJECT_NAME)/usr/bin/
|
||||
@cp -vf data/*.xml package/$(PROJECT_NAME)/usr/share/edn/
|
||||
@cd package; dpkg-deb --build $(PROJECT_NAME)
|
||||
|
||||
# TODO : Later ....
|
||||
|
||||
clean:
|
||||
@echo $(CADRE_HAUT_BAS)
|
||||
@echo ' CLEANING : bin libs gen obj'$(CADRE_COTERS)
|
||||
@echo $(CADRE_HAUT_BAS)
|
||||
# TODO : Later ....
|
||||
|
194
Build/Makefile.Linux_old.mk
Normal file
194
Build/Makefile.Linux_old.mk
Normal file
@ -0,0 +1,194 @@
|
||||
|
||||
|
||||
|
||||
|
||||
include $(EWOL_FOLDER)/Build/Makefile.common.mk
|
||||
|
||||
#include $(EWOL_FOLDER)/Build/ewol.mk
|
||||
|
||||
###############################################################################
|
||||
### Compilateur base system ###
|
||||
###############################################################################
|
||||
CXX=g++
|
||||
CC=gcc
|
||||
AR=ar
|
||||
|
||||
|
||||
|
||||
X11FLAGS= -lGL -lGLU
|
||||
# some X11 mode availlable :
|
||||
# install package : libxxf86vm-dev
|
||||
X11FLAGS+= -lX11 -DEWOL_X11_MODE__XF86V -lXxf86vm
|
||||
# install package : libxrender-dev
|
||||
#X11FLAGS+= -lX11 -DEWOL_X11_MODE__XRENDER -lXrandr
|
||||
|
||||
|
||||
ifeq ($(shell if `pkg-config --exists freetype2` ; then echo "yes"; else echo "no"; fi), yes)
|
||||
FREETYPE_CFLAGS= `pkg-config --cflags freetype2` -DEWOL_USE_FREE_TYPE
|
||||
FREETYPE_LDFLAGS= `pkg-config --libs freetype2` -DEWOL_USE_FREE_TYPE
|
||||
else
|
||||
FREETYPE_CFLAGS=
|
||||
FREETYPE_LDFLAGS=
|
||||
$(Info libFreeType-dev is not installed)
|
||||
endif
|
||||
|
||||
|
||||
|
||||
OBJECT_DIR=Object_$(PLATFORM)
|
||||
|
||||
ifeq ("$(DEBUG)", "0")
|
||||
OBJECT_DIRECTORY=$(OBJECT_DIR)/release
|
||||
OUTPUT_NAME = $(OUTPUT_NAME_RELEASE)
|
||||
else
|
||||
OBJECT_DIRECTORY=$(OBJECT_DIR)/debug
|
||||
OUTPUT_NAME = $(OUTPUT_NAME_DEBUG)
|
||||
endif
|
||||
|
||||
|
||||
|
||||
###############################################################################
|
||||
### Basic C flags ###
|
||||
###############################################################################
|
||||
|
||||
# basic X11 librairy ==> show if we can une under lib ...
|
||||
CXXFLAGS= $(X11FLAGS) $(FREETYPE_CFLAGS) -D__PLATFORM__$(PLATFORM) $(PROJECT_CXXFLAGS)
|
||||
|
||||
ifeq ("$(DEBUG)", "0")
|
||||
CXXFLAGS+= -O2
|
||||
else
|
||||
# Enable debug (cgdb ***)
|
||||
CXXFLAGS+= -g -O0
|
||||
endif
|
||||
# display all flags
|
||||
CXXFLAGS+= -Wall
|
||||
# ...
|
||||
CXXFLAGS+= -D_REENTRANT
|
||||
# internal defines
|
||||
CXXFLAGS+= $(DEFINE)
|
||||
# remove warning from the convertion char*
|
||||
CXXFLAGS+= -Wno-write-strings
|
||||
|
||||
CXXFLAGS+= -DPROJECT_NAME="$(PROJECT_NAME)"
|
||||
|
||||
CFLAGS= $(CXXFLAGS) -std=c99
|
||||
|
||||
# basic extern librairy
|
||||
LDFLAGS= $(X11FLAGS) $(FREETYPE_LDFLAGS) $(PROJECT_LDFLAGS)
|
||||
|
||||
# Dynamic connection of the CALLBACK of the GUI
|
||||
LDFLAGS+= -Wl,--export-dynamic
|
||||
|
||||
# TODO : add the prefix ...
|
||||
CXXFILES = $(PROJECT_SOURCES)
|
||||
# create the list of module :
|
||||
LISTE_MODULES = $(sort $(dir $(CXXFILES)))
|
||||
|
||||
###############################################################################
|
||||
### Build Object Files List ###
|
||||
###############################################################################
|
||||
OBJ = $(addprefix $(OBJECT_DIRECTORY)/, $(CXXFILES:.cpp=.o))
|
||||
|
||||
|
||||
###############################################################################
|
||||
### Main Part of Makefile ###
|
||||
###############################################################################
|
||||
all: $(PROJECT_NAME)
|
||||
|
||||
-include $(OBJ:.o=.d)
|
||||
|
||||
.ewol:
|
||||
@cd $(EWOL_FOLDER) ; make -s PLATFORM=$(PLATFORM) DEBUG=$(DEBUG)
|
||||
|
||||
.ewol-clean:
|
||||
@cd $(EWOL_FOLDER) ; make -s PLATFORM=$(PLATFORM) clean
|
||||
|
||||
.encadrer:
|
||||
@echo $(CADRE_HAUT_BAS)
|
||||
@echo $(CADRE_COTERS)
|
||||
@echo '
DEBUT DE COMPILATION DU PROGRAMME :'$(CADRE_COTERS)
|
||||
@echo '
Repertoire Sources : $(PROJECT_FILE_DIRECTORY)/'$(CADRE_COTERS)
|
||||
@echo '
Repertoire object : $(OBJECT_DIRECTORY)/'$(CADRE_COTERS)
|
||||
@echo '
Binaire de sortie : $(F_VIOLET)$(PROJECT_NAME) $(F_NORMALE)'$(CADRE_COTERS)
|
||||
@echo $(CADRE_COTERS)
|
||||
@echo $(CADRE_HAUT_BAS)
|
||||
@mkdir -p $(addprefix $(OBJECT_DIRECTORY)/, $(LISTE_MODULES))
|
||||
|
||||
$(info PROJECT_FILE_DIRECTORY=$(PROJECT_FILE_DIRECTORY) ; OBJECT_DIRECTORY=$(OBJECT_DIRECTORY))
|
||||
|
||||
# build C++
|
||||
$(OBJECT_DIRECTORY)/%.o: $(PROJECT_FILE_DIRECTORY)/%.cpp $(MAKE_DEPENDENCE)
|
||||
@echo $(F_VERT)"
(.o) $<"$(F_NORMALE)
|
||||
@$(CXX) $< -c -o $@ $(INCLUDE_DIRECTORY) $(CXXFLAGS) -MMD
|
||||
|
||||
# build binary Release Mode
|
||||
$(PROJECT_NAME): .ewol .encadrer $(PROJECT_LIB_DEPENDENCY) $(OBJ) $(MAKE_DEPENDENCE)
|
||||
@echo $(F_ROUGE)"
(bin) $(PROJECT_NAME) "$(F_NORMALE)
|
||||
@$(CXX) $(OBJ) $(EWOL_FOLDER)/libewol.a $(LDFLAGS) -o $@
|
||||
|
||||
|
||||
|
||||
clean: .ewol-clean
|
||||
@echo $(CADRE_HAUT_BAS)
|
||||
@echo ' CLEANING : $(F_VIOLET)$(OUTPUT_NAME)$(F_NORMALE)'$(CADRE_COTERS)
|
||||
@echo $(CADRE_HAUT_BAS)
|
||||
@echo $(F_VERT)"
(rm) $(OBJECT_DIR)"$(F_NORMALE)
|
||||
@rm -rf $(OBJECT_DIR)
|
||||
@echo $(F_VERT)"
(rm) $(PROJECT_NAME) $(OUTPUT_NAME_DEBUG) $(OUTPUT_NAME_RELEASE)"$(F_NORMALE)
|
||||
@rm -f $(PROJECT_NAME) $(OUTPUT_NAME_DEBUG) $(OUTPUT_NAME_RELEASE)
|
||||
@echo $(F_VERT)"
(rm) doxygen/*"$(F_NORMALE)
|
||||
@rm -rf doxygen
|
||||
@rm -f doxygen.log
|
||||
@echo $(F_VERT)"
(rm) *.bck"$(F_NORMALE)
|
||||
@rm -f `find . -name "*.bck"`
|
||||
|
||||
|
||||
count:
|
||||
wc -l Makefile `find $(FILE_DIRECTORY)/ -name "*.cpp"` `find $(PROJECT_FILE_DIRECTORY)/ -name "*.h"`
|
||||
|
||||
|
||||
install: .encadrer .versionFile $(PROJECT_NAME)
|
||||
@echo ' INSTALL : $(OUTPUT_NAME_RELEASE)=>$(PROJECT_NAME)'
|
||||
@echo " (stripped) $(OUTPUT_NAME_RELEASE) => $(PROJECT_NAME) "
|
||||
@cp $(OUTPUT_NAME_RELEASE) $(PROJECT_NAME)
|
||||
@strip -s $(PROJECT_NAME)
|
||||
@echo " (copy) $(PROJECT_NAME) /usr/bin/ "
|
||||
@cp -vf $(PROJECT_NAME) /usr/bin/
|
||||
@echo " (data) data/* ==> /usr/share/$(PROJECT_NAME)/ "
|
||||
@mkdir -p /usr/share/$(PROJECT_NAME)/
|
||||
@rm -rf /usr/share/$(PROJECT_NAME)/*
|
||||
@cp -vf assets/* /usr/share/$(PROJECT_NAME)/
|
||||
|
||||
|
||||
# http://alp.developpez.com/tutoriels/debian/creer-paquet/
|
||||
package: .encadrer
|
||||
@echo 'Create Folders ...'
|
||||
@mkdir -p package/$(PROJECT_NAME)/DEBIAN/
|
||||
@mkdir -p package/$(PROJECT_NAME)/usr/bin/
|
||||
@mkdir -p package/$(PROJECT_NAME)/usr/share/doc/
|
||||
@mkdir -p package/$(PROJECT_NAME)/usr/share/edn/
|
||||
# Create the control file
|
||||
@echo "Package: "$(PROJECT_NAME) > package/$(PROJECT_NAME)/DEBIAN/control
|
||||
@echo "Version: "$(VERSION_TAG_SHORT) >> package/$(PROJECT_NAME)/DEBIAN/control
|
||||
@echo "Section: Development,Editors" >> package/$(PROJECT_NAME)/DEBIAN/control
|
||||
@echo "Priority: optional" >>package/$(PROJECT_NAME)/DEBIAN/control
|
||||
@echo "Architecture: all" >> package/$(PROJECT_NAME)/DEBIAN/control
|
||||
@echo "Depends: bash" >> package/$(PROJECT_NAME)/DEBIAN/control
|
||||
@echo "Maintainer: Mr DUPIN Edouard <yui.heero@gmail.com>" >> package/$(PROJECT_NAME)/DEBIAN/control
|
||||
@echo "Description: Text editor for sources code with ctags management" >> package/$(PROJECT_NAME)/DEBIAN/control
|
||||
@echo "" >> package/$(PROJECT_NAME)/DEBIAN/control
|
||||
# Create the PostRm
|
||||
@echo "#!/bin/bash" > package/$(PROJECT_NAME)/DEBIAN/postrm
|
||||
@echo "rm ~/."$(PROJECT_NAME) >> package/$(PROJECT_NAME)/DEBIAN/postrm
|
||||
@echo "" >> package/$(PROJECT_NAME)/DEBIAN/postrm
|
||||
# Enable Execution in script
|
||||
@chmod 755 package/$(PROJECT_NAME)/DEBIAN/post*
|
||||
@#chmod 755 package/$(PROJECT_NAME)/DEBIAN/pre*
|
||||
# copy licence and information :
|
||||
@cp README package/$(PROJECT_NAME)/usr/share/doc/README
|
||||
@cp licence.txt package/$(PROJECT_NAME)/usr/share/doc/copyright
|
||||
@echo "First generation in progress" >> package/$(PROJECT_NAME)/usr/share/doc/changelog
|
||||
@cp -vf $(PROJECT_NAME) package/$(PROJECT_NAME)/usr/bin/
|
||||
@cp -vf data/*.xml package/$(PROJECT_NAME)/usr/share/edn/
|
||||
@cd package; dpkg-deb --build $(PROJECT_NAME)
|
||||
|
||||
|
239
Build/coreLinux/add-application.mk
Normal file
239
Build/coreLinux/add-application.mk
Normal file
@ -0,0 +1,239 @@
|
||||
# Copyright (C) 2009 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.
|
||||
#
|
||||
|
||||
# this script is used to record an application definition in the
|
||||
# NDK build system, before performing any build whatsoever.
|
||||
#
|
||||
# It is included repeatedly from build/core/main.mk and expects a
|
||||
# variable named '_application_mk' which points to a given Application.mk
|
||||
# file that will be included here. The latter must define a few variables
|
||||
# to describe the application to the build system, and the rest of the
|
||||
# code here will perform book-keeping and basic checks
|
||||
#
|
||||
|
||||
$(call assert-defined, _application_mk _app)
|
||||
$(call ndk_log,Parsing $(_application_mk))
|
||||
|
||||
$(call clear-vars, $(NDK_APP_VARS))
|
||||
|
||||
# Check that NDK_DEBUG is properly defined. If it is
|
||||
# the only valid states are: undefined, 0, 1, false and true
|
||||
#
|
||||
# We set APP_DEBUG to <undefined>, 'true' or 'false'.
|
||||
#
|
||||
APP_DEBUG := $(strip $(NDK_DEBUG))
|
||||
ifeq ($(APP_DEBUG),0)
|
||||
APP_DEBUG:= false
|
||||
endif
|
||||
ifeq ($(APP_DEBUG),1)
|
||||
APP_DEBUG := true
|
||||
endif
|
||||
ifdef APP_DEBUG
|
||||
ifneq (,$(filter-out true false,$(APP_DEBUG)))
|
||||
$(call __ndk_warning,NDK_DEBUG is defined to the unsupported value '$(NDK_DEBUG)', will be ignored!)
|
||||
endif
|
||||
endif
|
||||
|
||||
include $(_application_mk)
|
||||
|
||||
$(call check-required-vars,$(NDK_APP_VARS_REQUIRED),$(_application_mk))
|
||||
|
||||
_map := NDK_APP.$(_app)
|
||||
|
||||
# strip the 'lib' prefix in front of APP_MODULES modules
|
||||
APP_MODULES := $(call strip-lib-prefix,$(APP_MODULES))
|
||||
|
||||
APP_PROJECT_PATH := $(strip $(APP_PROJECT_PATH))
|
||||
ifndef APP_PROJECT_PATH
|
||||
APP_PROJECT_PATH := $(NDK_PROJECT_PATH)
|
||||
endif
|
||||
|
||||
# check whether APP_PLATFORM is defined. If not, look for project.properties in
|
||||
# the $(APP_PROJECT_PATH) and extract the value with awk's help. If nothing is here,
|
||||
# revert to the default value (i.e. "android-3").
|
||||
#
|
||||
APP_PLATFORM := $(strip $(APP_PLATFORM))
|
||||
ifndef APP_PLATFORM
|
||||
_local_props := $(strip $(wildcard $(APP_PROJECT_PATH)/project.properties))
|
||||
ifndef _local_props
|
||||
# NOTE: project.properties was called default.properties before
|
||||
_local_props := $(strip $(wildcard $(APP_PROJECT_PATH)/default.properties))
|
||||
endif
|
||||
ifdef _local_props
|
||||
APP_PLATFORM := $(strip $(shell $(HOST_AWK) -f $(BUILD_AWK)/extract-platform.awk $(_local_props)))
|
||||
$(call ndk_log, Found APP_PLATFORM=$(APP_PLATFORM) in $(_local_props))
|
||||
else
|
||||
APP_PLATFORM := android-3
|
||||
$(call ndk_log, Defaulted to APP_PLATFORM=$(APP_PLATFORM))
|
||||
endif
|
||||
endif
|
||||
|
||||
# SPECIAL CASE: android-6 and android-7 are the same thing than android-5
|
||||
# with regards to the NDK. Adjust accordingly!
|
||||
ifneq (,$(filter android-6 android-7,$(APP_PLATFORM)))
|
||||
APP_PLATFORM := android-5
|
||||
$(call ndk_log, Adjusting APP_PLATFORM to $(APP_PLATFORM))
|
||||
endif
|
||||
|
||||
# Check that the value of APP_PLATFORM corresponds to a known platform
|
||||
# If not, we're going to use the max supported platform value.
|
||||
#
|
||||
_bad_platform := $(strip $(filter-out $(NDK_ALL_PLATFORMS),$(APP_PLATFORM)))
|
||||
ifdef _bad_platform
|
||||
$(call ndk_log,Application $(_app) targets unknown platform '$(_bad_platform)')
|
||||
APP_PLATFORM := android-$(NDK_MAX_PLATFORM_LEVEL)
|
||||
$(call ndk_log,Switching to $(APP_PLATFORM))
|
||||
endif
|
||||
|
||||
# Check that the value of APP_ABI corresponds to known ABIs
|
||||
# 'all' is a special case that means 'all supported ABIs'
|
||||
#
|
||||
# It will be handled in setup-app.mk. We can't hope to change
|
||||
# the value of APP_ABI is the user enforces it on the command-line
|
||||
# with a call like: ndk-build APP_ABI=all
|
||||
#
|
||||
# Because GNU Make makes the APP_ABI variable read-only (any assignments
|
||||
# to it will be ignored)
|
||||
#
|
||||
APP_ABI := $(strip $(APP_ABI))
|
||||
ifndef APP_ABI
|
||||
# Default ABI is 'armeabi'
|
||||
APP_ABI := armeabi
|
||||
endif
|
||||
ifneq ($(APP_ABI),all)
|
||||
_bad_abis := $(strip $(filter-out $(NDK_ALL_ABIS),$(APP_ABIS)))
|
||||
ifdef _bad_abis
|
||||
$(call __ndk_info,Application $(_app) targets unknown ABI '$(_bad_abis)')
|
||||
$(call __ndk_info,Please fix the APP_ABI definition in $(_application_mk))
|
||||
$(call __ndk_info,to use a set of the following values: $(NDK_ALL_ABIS))
|
||||
$(call __ndk_error,Aborting)
|
||||
endif
|
||||
endif
|
||||
|
||||
# If APP_BUILD_SCRIPT is defined, check that the file exists.
|
||||
# If undefined, look in $(APP_PROJECT_PATH)/jni/Android.mk
|
||||
#
|
||||
APP_BUILD_SCRIPT := $(strip $(APP_BUILD_SCRIPT))
|
||||
ifdef APP_BUILD_SCRIPT
|
||||
_build_script := $(strip $(wildcard $(APP_BUILD_SCRIPT)))
|
||||
ifndef _build_script
|
||||
$(call __ndk_info,Your APP_BUILD_SCRIPT points to an unknown file: $(APP_BUILD_SCRIPT))
|
||||
$(call __ndk_error,Aborting...)
|
||||
endif
|
||||
APP_BUILD_SCRIPT := $(_build_script)
|
||||
$(call ndk_log, Using build script $(APP_BUILD_SCRIPT))
|
||||
else
|
||||
_build_script := $(strip $(wildcard $(APP_PROJECT_PATH)/jni/Android.mk))
|
||||
ifndef _build_script
|
||||
$(call __ndk_info,There is no Android.mk under $(APP_PROJECT_PATH)/jni)
|
||||
$(call __ndk_info,If this is intentional, please define APP_BUILD_SCRIPT to point)
|
||||
$(call __ndk_info,to a valid NDK build script.)
|
||||
$(call __ndk_error,Aborting...)
|
||||
endif
|
||||
APP_BUILD_SCRIPT := $(_build_script)
|
||||
$(call ndk_log, Defaulted to APP_BUILD_SCRIPT=$(APP_BUILD_SCRIPT))
|
||||
endif
|
||||
|
||||
# Determine whether the application should be debuggable.
|
||||
# - If APP_DEBUG is set to 'true', then it always should.
|
||||
# - If APP_DEBUG is set to 'false', then it never should
|
||||
# - Otherwise, extract the android:debuggable attribute from the manifest.
|
||||
#
|
||||
ifdef APP_DEBUG
|
||||
APP_DEBUGGABLE := $(APP_DEBUG)
|
||||
ifdef NDK_LOG
|
||||
ifeq ($(APP_DEBUG),true)
|
||||
$(call ndk_log,Application '$(_app)' forced debuggable through NDK_DEBUG)
|
||||
else
|
||||
$(call ndk_log,Application '$(_app)' forced *not* debuggable through NDK_DEBUG)
|
||||
endif
|
||||
endif
|
||||
else
|
||||
# NOTE: To make unit-testing simpler, handle the case where there is no manifest.
|
||||
APP_DEBUGGABLE := false
|
||||
APP_MANIFEST := $(strip $(wildcard $(APP_PROJECT_PATH)/AndroidManifest.xml))
|
||||
ifdef APP_MANIFEST
|
||||
APP_DEBUGGABLE := $(shell $(HOST_AWK) -f $(BUILD_AWK)/extract-debuggable.awk $(APP_MANIFEST))
|
||||
endif
|
||||
ifdef NDK_LOG
|
||||
ifeq ($(APP_DEBUGGABLE),true)
|
||||
$(call ndk_log,Application '$(_app)' *is* debuggable)
|
||||
else
|
||||
$(call ndk_log,Application '$(_app)' is not debuggable)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# LOCAL_BUILD_MODE will be either release or debug
|
||||
#
|
||||
# If APP_OPTIM is defined in the Application.mk, just use this.
|
||||
#
|
||||
# Otherwise, set to 'debug' if android:debuggable is set to TRUE,
|
||||
# and to 'release' if not.
|
||||
#
|
||||
ifneq ($(APP_OPTIM),)
|
||||
# check that APP_OPTIM, if defined, is either 'release' or 'debug'
|
||||
$(if $(filter-out release debug,$(APP_OPTIM)),\
|
||||
$(call __ndk_info, The APP_OPTIM defined in $(_application_mk) must only be 'release' or 'debug')\
|
||||
$(call __ndk_error,Aborting)\
|
||||
)
|
||||
$(call ndk_log,Selecting optimization mode through Application.mk: $(APP_OPTIM))
|
||||
else
|
||||
ifeq ($(APP_DEBUGGABLE),true)
|
||||
$(call ndk_log,Selecting debug optimization mode (app is debuggable))
|
||||
APP_OPTIM := debug
|
||||
else
|
||||
$(call ndk_log,Selecting release optimization mode (app is not debuggable))
|
||||
APP_OPTIM := release
|
||||
endif
|
||||
endif
|
||||
|
||||
# set release/debug build flags. We always use the -g flag because
|
||||
# we generate symbol versions of the binaries that are later stripped
|
||||
# when they are copied to the final project's libs/<abi> directory.
|
||||
#
|
||||
ifeq ($(APP_OPTIM),debug)
|
||||
APP_CFLAGS := -O0 -g $(APP_CFLAGS)
|
||||
else
|
||||
APP_CFLAGS := -O2 -DNDEBUG -g $(APP_CFLAGS)
|
||||
endif
|
||||
|
||||
# Check that APP_STL is defined. If not, use the default value (system)
|
||||
# otherwise, check that the name is correct.
|
||||
APP_STL := $(strip $(APP_STL))
|
||||
ifndef APP_STL
|
||||
APP_STL := system
|
||||
else
|
||||
$(call ndk-stl-check,$(APP_STL))
|
||||
endif
|
||||
|
||||
|
||||
|
||||
$(if $(call get,$(_map),defined),\
|
||||
$(call __ndk_info,Weird, the application $(_app) is already defined by $(call get,$(_map),defined))\
|
||||
$(call __ndk_error,Aborting)\
|
||||
)
|
||||
|
||||
$(call set,$(_map),defined,$(_application_mk))
|
||||
|
||||
# Record all app-specific variable definitions
|
||||
$(foreach __name,$(NDK_APP_VARS),\
|
||||
$(call set,$(_map),$(__name),$($(__name)))\
|
||||
)
|
||||
|
||||
# Record the Application.mk for debugging
|
||||
$(call set,$(_map),Application.mk,$(_application_mk))
|
||||
|
||||
NDK_ALL_APPS += $(_app)
|
33
Build/coreLinux/add-platform.mk
Normal file
33
Build/coreLinux/add-platform.mk
Normal file
@ -0,0 +1,33 @@
|
||||
# Copyright (C) 2009 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.
|
||||
#
|
||||
|
||||
$(call assert-defined,_platform NDK_PLATFORMS_ROOT)
|
||||
|
||||
# For each platform, determine the corresponding supported ABIs
|
||||
# And record them in NDK_PLATFORM_$(platform)_ABIS
|
||||
#
|
||||
_abis := $(strip $(notdir $(wildcard $(NDK_PLATFORMS_ROOT)/$(_platform)/arch-*)))
|
||||
_abis := $(_abis:arch-%=%)
|
||||
|
||||
$(call ndk_log,PLATFORM $(_platform) supports: $(_abis))
|
||||
|
||||
NDK_PLATFORM_$(_platform)_ABIS := $(_abis)
|
||||
|
||||
# Record the sysroots for each supported ABI
|
||||
#
|
||||
$(foreach _abi,$(_abis),\
|
||||
$(eval NDK_PLATFORM_$(_platform)_$(_abi)_SYSROOT := $(NDK_PLATFORMS_ROOT)/$(_platform)/arch-$(_abi))\
|
||||
$(call ndk_log, ABI $(_abi) sysroot is: $(NDK_PLATFORM_$(_platform)_$(_abi)_SYSROOT))\
|
||||
)
|
72
Build/coreLinux/add-toolchain.mk
Normal file
72
Build/coreLinux/add-toolchain.mk
Normal file
@ -0,0 +1,72 @@
|
||||
# Copyright (C) 2009 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.
|
||||
#
|
||||
|
||||
# this script is included repeatedly by main.mk to add a new toolchain
|
||||
# definition to the NDK build system.
|
||||
#
|
||||
# '_config_mk' must be defined as the path of a toolchain
|
||||
# configuration file (config.mk) that will be included here.
|
||||
#
|
||||
$(call assert-defined, _config_mk)
|
||||
|
||||
# The list of variables that must or may be defined
|
||||
# by the toolchain configuration file
|
||||
#
|
||||
NDK_TOOLCHAIN_VARS_REQUIRED := TOOLCHAIN_ABIS
|
||||
NDK_TOOLCHAIN_VARS_OPTIONAL :=
|
||||
|
||||
# Clear variables that are supposed to be defined by the config file
|
||||
$(call clear-vars,$(NDK_TOOLCHAIN_VARS_REQUIRED))
|
||||
$(call clear-vars,$(NDK_TOOLCHAIN_VARS_OPTIONAL))
|
||||
|
||||
# Include the config file
|
||||
include $(_config_mk)
|
||||
|
||||
# Check that the proper variables were defined
|
||||
$(call check-required-vars,$(NDK_TOOLCHAIN_VARS_REQUIRED),$(_config_mk))
|
||||
|
||||
# Check that the file didn't do something stupid
|
||||
$(call assert-defined, _config_mk)
|
||||
|
||||
# Now record the toolchain-specific information
|
||||
_dir := $(patsubst %/,%,$(dir $(_config_mk)))
|
||||
_name := $(notdir $(_dir))
|
||||
_abis := $(TOOLCHAIN_ABIS)
|
||||
|
||||
_toolchain := NDK_TOOLCHAIN.$(_name)
|
||||
|
||||
# check that the toolchain name is unique
|
||||
$(if $(strip $($(_toolchain).defined)),\
|
||||
$(call __ndk_error,Toolchain $(_name) defined in $(_parent) is\
|
||||
already defined in $(NDK_TOOLCHAIN.$(_name).defined)))
|
||||
|
||||
$(_toolchain).defined := $(_toolchain_config)
|
||||
$(_toolchain).abis := $(_abis)
|
||||
$(_toolchain).setup := $(wildcard $(_dir)/setup.mk)
|
||||
|
||||
$(if $(strip $($(_toolchain).setup)),,\
|
||||
$(call __ndk_error, Toolchain $(_name) lacks a setup.mk in $(_dir)))
|
||||
|
||||
NDK_ALL_TOOLCHAINS += $(_name)
|
||||
NDK_ALL_ABIS += $(_abis)
|
||||
|
||||
# NKD_ABI.<abi>.toolchains records the list of toolchains that support
|
||||
# a given ABI
|
||||
#
|
||||
$(foreach _abi,$(_abis),\
|
||||
$(eval NDK_ABI.$(_abi).toolchains += $(_name)) \
|
||||
)
|
||||
|
||||
# done
|
114
Build/coreLinux/build-all.mk
Normal file
114
Build/coreLinux/build-all.mk
Normal file
@ -0,0 +1,114 @@
|
||||
# Copyright (C) 2009-2010 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.
|
||||
#
|
||||
|
||||
#
|
||||
# This script is used to build all wanted NDK binaries. It is included
|
||||
# by several scripts.
|
||||
#
|
||||
|
||||
# ensure that the following variables are properly defined
|
||||
$(call assert-defined,NDK_APPS NDK_APP_OUT)
|
||||
|
||||
# ====================================================================
|
||||
#
|
||||
# Prepare the build for parsing Android.mk files
|
||||
#
|
||||
# ====================================================================
|
||||
|
||||
# These phony targets are used to control various stages of the build
|
||||
.PHONY: all \
|
||||
host_libraries host_executables \
|
||||
installed_modules \
|
||||
executables libraries static_libraries shared_libraries \
|
||||
clean clean-objs-dir \
|
||||
clean-executables clean-libraries \
|
||||
clean-installed-modules \
|
||||
clean-installed-binaries
|
||||
|
||||
# These macros are used in Android.mk to include the corresponding
|
||||
# build script that will parse the LOCAL_XXX variable definitions.
|
||||
#
|
||||
CLEAR_VARS := $(BUILD_SYSTEM)/clear-vars.mk
|
||||
BUILD_HOST_EXECUTABLE := $(BUILD_SYSTEM)/build-host-executable.mk
|
||||
BUILD_HOST_STATIC_LIBRARY := $(BUILD_SYSTEM)/build-host-static-library.mk
|
||||
BUILD_STATIC_LIBRARY := $(BUILD_SYSTEM)/build-static-library.mk
|
||||
BUILD_SHARED_LIBRARY := $(BUILD_SYSTEM)/build-shared-library.mk
|
||||
BUILD_EXECUTABLE := $(BUILD_SYSTEM)/build-executable.mk
|
||||
PREBUILT_SHARED_LIBRARY := $(BUILD_SYSTEM)/prebuilt-shared-library.mk
|
||||
PREBUILT_STATIC_LIBRARY := $(BUILD_SYSTEM)/prebuilt-static-library.mk
|
||||
|
||||
ANDROID_MK_INCLUDED := \
|
||||
$(CLEAR_VARS) \
|
||||
$(BUILD_HOST_EXECUTABLE) \
|
||||
$(BUILD_HOST_STATIC_LIBRARY) \
|
||||
$(BUILD_STATIC_LIBRARY) \
|
||||
$(BUILD_SHARED_LIBRARY) \
|
||||
$(BUILD_EXECUTABLE) \
|
||||
$(PREBUILT_SHARED_LIBRARY) \
|
||||
|
||||
|
||||
# this is the list of directories containing dependency information
|
||||
# generated during the build. It will be updated by build scripts
|
||||
# when module definitions are parsed.
|
||||
#
|
||||
ALL_DEPENDENCY_DIRS :=
|
||||
|
||||
# this is the list of all generated files that we would need to clean
|
||||
ALL_HOST_EXECUTABLES :=
|
||||
ALL_HOST_STATIC_LIBRARIES :=
|
||||
ALL_STATIC_LIBRARIES :=
|
||||
ALL_SHARED_LIBRARIES :=
|
||||
ALL_EXECUTABLES :=
|
||||
|
||||
WANTED_INSTALLED_MODULES :=
|
||||
|
||||
# the first rule
|
||||
all: installed_modules host_libraries host_executables
|
||||
|
||||
|
||||
$(foreach _app,$(NDK_APPS),\
|
||||
$(eval include $(BUILD_SYSTEM)/setup-app.mk)\
|
||||
)
|
||||
|
||||
# ====================================================================
|
||||
#
|
||||
# Now finish the build preparation with a few rules that depend on
|
||||
# what has been effectively parsed and recorded previously
|
||||
#
|
||||
# ====================================================================
|
||||
|
||||
clean: clean-intermediates clean-installed-binaries
|
||||
|
||||
distclean: clean
|
||||
|
||||
installed_modules: clean-installed-binaries libraries $(WANTED_INSTALLED_MODULES)
|
||||
host_libraries: $(HOST_STATIC_LIBRARIES)
|
||||
host_executables: $(HOST_EXECUTABLES)
|
||||
|
||||
static_libraries: $(STATIC_LIBRARIES)
|
||||
shared_libraries: $(SHARED_LIBRARIES)
|
||||
executables: $(EXECUTABLES)
|
||||
|
||||
libraries: static_libraries shared_libraries
|
||||
|
||||
clean-host-intermediates:
|
||||
$(hide) $(call host-rm,$(HOST_EXECUTABLES) $(HOST_STATIC_LIBRARIES))
|
||||
|
||||
clean-intermediates: clean-host-intermediates
|
||||
$(hide) $(call host-rm,$(EXECUTABLES) $(STATIC_LIBRARIES) $(SHARED_LIBRARIES))
|
||||
|
||||
# include dependency information
|
||||
ALL_DEPENDENCY_DIRS := $(sort $(ALL_DEPENDENCY_DIRS))
|
||||
-include $(wildcard $(ALL_DEPENDENCY_DIRS:%=%/*.d))
|
356
Build/coreLinux/build-binary.mk
Normal file
356
Build/coreLinux/build-binary.mk
Normal file
@ -0,0 +1,356 @@
|
||||
# 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.
|
||||
#
|
||||
|
||||
# Check that LOCAL_MODULE is defined, then restore its LOCAL_XXXX values
|
||||
$(call assert-defined,LOCAL_MODULE)
|
||||
$(call module-restore-locals,$(LOCAL_MODULE))
|
||||
|
||||
# For now, only support target (device-specific modules).
|
||||
# We may want to introduce support for host modules in the future
|
||||
# but that is too experimental for now.
|
||||
#
|
||||
my := TARGET_
|
||||
|
||||
# LOCAL_MAKEFILE must also exist and name the Android.mk that
|
||||
# included the module build script.
|
||||
#
|
||||
$(call assert-defined,LOCAL_MAKEFILE LOCAL_BUILD_SCRIPT LOCAL_BUILT_MODULE)
|
||||
|
||||
include $(BUILD_SYSTEM)/import-locals.mk
|
||||
|
||||
#
|
||||
# Ensure that 'make <module>' and 'make clean-<module>' work
|
||||
#
|
||||
.PHONY: $(LOCAL_MODULE)
|
||||
$(LOCAL_MODULE): $(LOCAL_BUILT_MODULE)
|
||||
|
||||
cleantarget := clean-$(LOCAL_MODULE)-$(TARGET_ARCH_ABI)
|
||||
.PHONY: $(cleantarget)
|
||||
clean: $(cleantarget)
|
||||
|
||||
$(cleantarget): PRIVATE_MODULE := $(LOCAL_MODULE)
|
||||
$(cleantarget): PRIVATE_TEXT := [$(TARGET_ARCH_ABI)]
|
||||
$(cleantarget): PRIVATE_CLEAN_FILES := $(LOCAL_BUILT_MODULE) \
|
||||
$($(my)OBJS)
|
||||
|
||||
$(cleantarget)::
|
||||
@$(HOST_ECHO) "Clean: $(PRIVATE_MODULE) $(PRIVATE_TEXT)"
|
||||
$(hide) $(call host-rmdir,$(PRIVATE_CLEAN_FILES))
|
||||
|
||||
ifeq ($(NDK_APP_DEBUGGABLE),true)
|
||||
$(NDK_APP_GDBSETUP): PRIVATE_SRC_DIRS += $(LOCAL_C_INCLUDES) $(LOCAL_PATH)
|
||||
endif
|
||||
|
||||
# list of generated object files
|
||||
LOCAL_OBJECTS :=
|
||||
|
||||
# always define ANDROID when building binaries
|
||||
#
|
||||
LOCAL_CFLAGS := -DANDROID $(LOCAL_CFLAGS)
|
||||
|
||||
#
|
||||
# Add the default system shared libraries to the build
|
||||
#
|
||||
ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none)
|
||||
LOCAL_SHARED_LIBRARIES += $(TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES)
|
||||
else
|
||||
LOCAL_SHARED_LIBRARIES += $(LOCAL_SYSTEM_SHARED_LIBRARIES)
|
||||
endif
|
||||
|
||||
|
||||
#
|
||||
# Check LOCAL_CPP_EXTENSION, use '.cpp' by default
|
||||
#
|
||||
bad_cpp_extensions := $(strip $(filter-out .%,$(LOCAL_CPP_EXTENSION)))
|
||||
ifdef bad_cpp_extensions
|
||||
$(call __ndk_info,WARNING: Invalid LOCAL_CPP_EXTENSION values: $(bad_cpp_extensions))
|
||||
LOCAL_CPP_EXTENSION := $(filter $(bad_cpp_extensions),$(LOCAL_CPP_EXTENSIONS))
|
||||
endif
|
||||
LOCAL_CPP_EXTENSION := $(strip $(LOCAL_CPP_EXTENSION))
|
||||
ifeq ($(LOCAL_CPP_EXTENSION),)
|
||||
LOCAL_CPP_EXTENSION := .cpp
|
||||
else
|
||||
endif
|
||||
|
||||
#
|
||||
# If LOCAL_ALLOW_UNDEFINED_SYMBOLS is not true, the linker will allow the generation
|
||||
# of a binary that uses undefined symbols.
|
||||
#
|
||||
ifneq ($(LOCAL_ALLOW_UNDEFINED_SYMBOLS),true)
|
||||
LOCAL_LDFLAGS += $($(my)NO_UNDEFINED_LDFLAGS)
|
||||
endif
|
||||
|
||||
# If LOCAL_DISABLE_NO_EXECUTE is not true, we disable generated code from running from
|
||||
# the heap and stack by default.
|
||||
#
|
||||
ifndef ($(LOCAL_DISABLE_NO_EXECUTE),true)
|
||||
LOCAL_CFLAGS += $($(my)NO_EXECUTE_CFLAGS)
|
||||
LOCAL_LDFLAGS += $($(my)NO_EXECUTE_LDFLAGS)
|
||||
endif
|
||||
|
||||
#
|
||||
# The original Android build system allows you to use the .arm prefix
|
||||
# to a source file name to indicate that it should be defined in either
|
||||
# 'thumb' or 'arm' mode, depending on the value of LOCAL_ARM_MODE
|
||||
#
|
||||
# First, check LOCAL_ARM_MODE, it should be empty, 'thumb' or 'arm'
|
||||
# We make the default 'thumb'
|
||||
#
|
||||
LOCAL_ARM_MODE := $(strip $(LOCAL_ARM_MODE))
|
||||
ifdef LOCAL_ARM_MODE
|
||||
ifneq ($(words $(LOCAL_ARM_MODE)),1)
|
||||
$(call __ndk_info, LOCAL_ARM_MODE in $(LOCAL_MAKEFILE) must be one word, not '$(LOCAL_ARM_MODE)')
|
||||
$(call __ndk_error, Aborting)
|
||||
endif
|
||||
# check that LOCAL_ARM_MODE is defined to either 'arm' or 'thumb'
|
||||
$(if $(filter-out thumb arm, $(LOCAL_ARM_MODE)),\
|
||||
$(call __ndk_info, LOCAL_ARM_MODE must be defined to either 'arm' or 'thumb' in $(LOCAL_MAKEFILE) not '$(LOCAL_ARM_MODE)')\
|
||||
$(call __ndk_error, Aborting)\
|
||||
)
|
||||
endif
|
||||
|
||||
# As a special case, the original Android build system
|
||||
# allows one to specify that certain source files can be
|
||||
# forced to build in ARM mode by using a '.arm' suffix
|
||||
# after the extension, e.g.
|
||||
#
|
||||
# LOCAL_SRC_FILES := foo.c.arm
|
||||
#
|
||||
# to build source file $(LOCAL_PATH)/foo.c as ARM
|
||||
#
|
||||
|
||||
# As a special extension, the NDK also supports the .neon extension suffix
|
||||
# to indicate that a single file can be compiled with ARM NEON support
|
||||
# We must support both foo.c.neon and foo.c.arm.neon here
|
||||
#
|
||||
# Also, if LOCAL_ARM_NEON is set to 'true', force Neon mode for all source
|
||||
# files
|
||||
#
|
||||
|
||||
neon_sources := $(filter %.neon,$(LOCAL_SRC_FILES))
|
||||
neon_sources := $(neon_sources:%.neon=%)
|
||||
|
||||
LOCAL_ARM_NEON := $(strip $(LOCAL_ARM_NEON))
|
||||
ifdef LOCAL_ARM_NEON
|
||||
$(if $(filter-out true false,$(LOCAL_ARM_NEON)),\
|
||||
$(call __ndk_info,LOCAL_ARM_NEON must be defined either to 'true' or 'false' in $(LOCAL_MAKEFILE), not '$(LOCAL_ARM_NEON)')\
|
||||
$(call __ndk_error,Aborting) \
|
||||
)
|
||||
endif
|
||||
ifeq ($(LOCAL_ARM_NEON),true)
|
||||
neon_sources += $(LOCAL_SRC_FILES:%.neon=%)
|
||||
endif
|
||||
|
||||
neon_sources := $(strip $(neon_sources))
|
||||
ifdef neon_sources
|
||||
ifneq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
||||
$(call __ndk_info,NEON support is only possible for armeabi-v7a ABI)
|
||||
$(call __ndk_info,Please add checks against TARGET_ARCH_ABI in $(LOCAL_MAKEFILE))
|
||||
$(call __ndk_error,Aborting)
|
||||
endif
|
||||
$(call tag-src-files,$(neon_sources:%.arm=%),neon)
|
||||
endif
|
||||
|
||||
LOCAL_SRC_FILES := $(LOCAL_SRC_FILES:%.neon=%)
|
||||
|
||||
# strip the .arm suffix from LOCAL_SRC_FILES
|
||||
# and tag the relevant sources with the 'arm' tag
|
||||
#
|
||||
arm_sources := $(filter %.arm,$(LOCAL_SRC_FILES))
|
||||
arm_sources := $(arm_sources:%.arm=%)
|
||||
thumb_sources := $(filter-out %.arm,$(LOCAL_SRC_FILES))
|
||||
LOCAL_SRC_FILES := $(LOCAL_SRC_FILES:%.arm=%)
|
||||
|
||||
ifeq ($(LOCAL_ARM_MODE),arm)
|
||||
arm_sources := $(LOCAL_SRC_FILES)
|
||||
endif
|
||||
ifeq ($(LOCAL_ARM_MODE),thumb)
|
||||
arm_sources := $(empty)
|
||||
endif
|
||||
$(call tag-src-files,$(arm_sources),arm)
|
||||
|
||||
# Process all source file tags to determine toolchain-specific
|
||||
# target compiler flags, and text.
|
||||
#
|
||||
$(call TARGET-process-src-files-tags)
|
||||
|
||||
# only call dump-src-file-tags during debugging
|
||||
#$(dump-src-file-tags)
|
||||
|
||||
LOCAL_DEPENDENCY_DIRS :=
|
||||
|
||||
# all_source_patterns contains the list of filename patterns that correspond
|
||||
# to source files recognized by our build system
|
||||
all_source_extensions := .c .s .S $(LOCAL_CPP_EXTENSION)
|
||||
all_source_patterns := $(foreach _ext,$(all_source_extensions),%$(_ext))
|
||||
all_cpp_patterns := $(foreach _ext,$(LOCAL_CPP_EXTENSION),%$(_ext))
|
||||
|
||||
unknown_sources := $(strip $(filter-out $(all_source_patterns),$(LOCAL_SRC_FILES)))
|
||||
ifdef unknown_sources
|
||||
$(call __ndk_info,WARNING: Unsupported source file extensions in $(LOCAL_MAKEFILE) for module $(LOCAL_MODULE))
|
||||
$(call __ndk_info, $(unknown_sources))
|
||||
endif
|
||||
|
||||
# LOCAL_OBJECTS will list all object files corresponding to the sources
|
||||
# listed in LOCAL_SRC_FILES, in the *same* order.
|
||||
#
|
||||
LOCAL_OBJECTS := $(LOCAL_SRC_FILES)
|
||||
$(foreach _ext,$(all_source_extensions),\
|
||||
$(eval LOCAL_OBJECTS := $$(LOCAL_OBJECTS:%$(_ext)=%.o))\
|
||||
)
|
||||
LOCAL_OBJECTS := $(filter %.o,$(LOCAL_OBJECTS))
|
||||
LOCAL_OBJECTS := $(subst ../,__/,$(LOCAL_OBJECTS))
|
||||
LOCAL_OBJECTS := $(foreach _obj,$(LOCAL_OBJECTS),$(LOCAL_OBJS_DIR)/$(_obj))
|
||||
|
||||
# If the module has any kind of C++ features, enable them in LOCAL_CPPFLAGS
|
||||
#
|
||||
ifneq (,$(call module-has-c++-features,$(LOCAL_MODULE),rtti))
|
||||
LOCAL_CPPFLAGS += -frtti
|
||||
endif
|
||||
ifneq (,$(call module-has-c++-features,$(LOCAL_MODULE),exceptions))
|
||||
LOCAL_CPPFLAGS += -fexceptions
|
||||
endif
|
||||
|
||||
# If we're using the 'system' STL and use rtti or exceptions, then
|
||||
# automatically link against the GNU libsupc++ for now.
|
||||
#
|
||||
ifneq (,$(call module-has-c++-features,$(LOCAL_MODULE),rtti exceptions))
|
||||
ifeq (system,$(NDK_APP_STL))
|
||||
LOCAL_LDLIBS := $(LOCAL_LDLIBS) $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/libs/$(TARGET_ARCH_ABI)/libsupc++.a
|
||||
endif
|
||||
endif
|
||||
|
||||
# Build the sources to object files
|
||||
#
|
||||
|
||||
$(foreach src,$(filter %.c,$(LOCAL_SRC_FILES)), $(call compile-c-source,$(src),$(call get-object-name,$(src))))
|
||||
$(foreach src,$(filter %.S %.s,$(LOCAL_SRC_FILES)), $(call compile-s-source,$(src),$(call get-object-name,$(src))))
|
||||
|
||||
$(foreach src,$(filter $(all_cpp_patterns),$(LOCAL_SRC_FILES)),\
|
||||
$(call compile-cpp-source,$(src),$(call get-object-name,$(src)))\
|
||||
)
|
||||
|
||||
#
|
||||
# The compile-xxx-source calls updated LOCAL_OBJECTS and LOCAL_DEPENDENCY_DIRS
|
||||
#
|
||||
ALL_DEPENDENCY_DIRS += $(sort $(LOCAL_DEPENDENCY_DIRS))
|
||||
CLEAN_OBJS_DIRS += $(LOCAL_OBJS_DIR)
|
||||
|
||||
#
|
||||
# Handle the static and shared libraries this module depends on
|
||||
#
|
||||
LOCAL_STATIC_LIBRARIES := $(call strip-lib-prefix,$(LOCAL_STATIC_LIBRARIES))
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := $(call strip-lib-prefix,$(LOCAL_WHOLE_STATIC_LIBRARIES))
|
||||
LOCAL_SHARED_LIBRARIES := $(call strip-lib-prefix,$(LOCAL_SHARED_LIBRARIES))
|
||||
|
||||
# Transitive closure of static libraries
|
||||
LOCAL_STATIC_LIBRARIES := $(call module-get-depends,$(LOCAL_STATIC_LIBRARIES),STATIC_LIBRARIES)
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := $(call module-get-depends,$(LOCAL_WHOLE_STATIC_LIBRARIES),WHOLE_STATIC_LIBRARIES)
|
||||
|
||||
static_libraries := $(call map,module-get-built,$(LOCAL_STATIC_LIBRARIES))
|
||||
whole_static_libraries := $(call map,module-get-built,$(LOCAL_WHOLE_STATIC_LIBRARIES))
|
||||
|
||||
shared_libraries := $(call map,module-get-built,$(LOCAL_SHARED_LIBRARIES))\
|
||||
$(TARGET_PREBUILT_SHARED_LIBRARIES)
|
||||
|
||||
$(LOCAL_BUILT_MODULE): $(static_libraries) $(whole_static_libraries) $(shared_libraries)
|
||||
|
||||
# If LOCAL_LDLIBS contains anything like -l<library> then
|
||||
# prepend a -L$(SYSROOT)/usr/lib to it to ensure that the linker
|
||||
# looks in the right location
|
||||
#
|
||||
ifneq ($(filter -l%,$(LOCAL_LDLIBS)),)
|
||||
LOCAL_LDLIBS := -L$(call host-path,$(SYSROOT)/usr/lib) $(LOCAL_LDLIBS)
|
||||
endif
|
||||
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_STATIC_LIBRARIES := $(static_libraries)
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_WHOLE_STATIC_LIBRARIES := $(whole_static_libraries)
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_SHARED_LIBRARIES := $(shared_libraries)
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_OBJECTS := $(LOCAL_OBJECTS)
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_LIBGCC := $(TARGET_LIBGCC)
|
||||
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_LD := $(TARGET_LD)
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_LDFLAGS := $(TARGET_LDFLAGS) $(LOCAL_LDFLAGS)
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_LDLIBS := $(LOCAL_LDLIBS) $(TARGET_LDLIBS)
|
||||
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_NAME := $(notdir $(LOCAL_BUILT_MODULE))
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_CXX := $(TARGET_CXX)
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_CC := $(TARGET_CC)
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_AR := $(TARGET_AR) $(TARGET_ARFLAGS)
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_SYSROOT := $(SYSROOT)
|
||||
|
||||
#
|
||||
# If this is a static library module
|
||||
#
|
||||
ifeq ($(call module-get-class,$(LOCAL_MODULE)),STATIC_LIBRARY)
|
||||
$(LOCAL_BUILT_MODULE): $(LOCAL_OBJECTS)
|
||||
@ $(call host-mkdir,$(dir $@))
|
||||
@ $(HOST_ECHO) "StaticLibrary : $(PRIVATE_NAME)"
|
||||
$(hide) $(call host-rm,$@)
|
||||
$(hide) $(cmd-build-static-library)
|
||||
|
||||
ALL_STATIC_LIBRARIES += $(LOCAL_BUILT_MODULE)
|
||||
endif
|
||||
|
||||
#
|
||||
# If this is a shared library module
|
||||
#
|
||||
ifeq ($(call module-get-class,$(LOCAL_MODULE)),SHARED_LIBRARY)
|
||||
$(LOCAL_BUILT_MODULE): $(LOCAL_OBJECTS)
|
||||
@ $(call host-mkdir,$(dir $@))
|
||||
@ $(HOST_ECHO) "SharedLibrary : $(PRIVATE_NAME)"
|
||||
$(hide) $(cmd-build-shared-library)
|
||||
|
||||
ALL_SHARED_LIBRARIES += $(LOCAL_BUILT_MODULE)
|
||||
endif
|
||||
|
||||
#
|
||||
# If this is an executable module
|
||||
#
|
||||
ifeq ($(call module-get-class,$(LOCAL_MODULE)),EXECUTABLE)
|
||||
$(LOCAL_BUILT_MODULE): $(LOCAL_OBJECTS)
|
||||
@ $(call host-mkdir,$(dir $@))
|
||||
@ $(HOST_ECHO) "Executable : $(PRIVATE_NAME)"
|
||||
$(hide) $(cmd-build-executable)
|
||||
|
||||
ALL_EXECUTABLES += $(LOCAL_BUILT_MODULE)
|
||||
endif
|
||||
|
||||
#
|
||||
# If this is a prebuilt module
|
||||
#
|
||||
ifeq ($(call module-is-prebuilt,$(LOCAL_MODULE)),$(true))
|
||||
$(LOCAL_BUILT_MODULE): $(LOCAL_OBJECTS)
|
||||
@ $(call host-mkdir,$(dir $@))
|
||||
@ $(HOST_ECHO) "Prebuilt : $(PRIVATE_NAME) <= $(call pretty-dir,$(dir $<))"
|
||||
$(hide) $(call host-cp,$<,$@)
|
||||
endif
|
||||
|
||||
#
|
||||
# If this is an installable module
|
||||
#
|
||||
ifeq ($(call module-is-installable,$(LOCAL_MODULE)),$(true))
|
||||
$(LOCAL_INSTALLED): PRIVATE_NAME := $(notdir $(LOCAL_BUILT_MODULE))
|
||||
$(LOCAL_INSTALLED): PRIVATE_SRC := $(LOCAL_BUILT_MODULE)
|
||||
$(LOCAL_INSTALLED): PRIVATE_DST_DIR := $(NDK_APP_DST_DIR)
|
||||
$(LOCAL_INSTALLED): PRIVATE_DST := $(LOCAL_INSTALLED)
|
||||
$(LOCAL_INSTALLED): PRIVATE_STRIP := $(TARGET_STRIP)
|
||||
|
||||
$(LOCAL_INSTALLED): $(LOCAL_BUILT_MODULE) clean-installed-binaries
|
||||
@$(HOST_ECHO) "Install : $(PRIVATE_NAME) => $(call pretty-dir,$(PRIVATE_DST))"
|
||||
$(hide) $(call host-mkdir,$(PRIVATE_DST_DIR))
|
||||
$(hide) $(call host-install,$(PRIVATE_SRC),$(PRIVATE_DST))
|
||||
$(hide) $(call cmd-strip, $(PRIVATE_DST))
|
||||
endif
|
34
Build/coreLinux/build-executable.mk
Normal file
34
Build/coreLinux/build-executable.mk
Normal file
@ -0,0 +1,34 @@
|
||||
# Copyright (C) 2009 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.
|
||||
#
|
||||
|
||||
# this file is included from Android.mk files to build a target-specific
|
||||
# executable program
|
||||
#
|
||||
|
||||
LOCAL_BUILD_SCRIPT := BUILD_EXECUTABLE
|
||||
LOCAL_MAKEFILE := $(local-makefile)
|
||||
|
||||
$(call check-defined-LOCAL_MODULE,$(LOCAL_BUILD_SCRIPT))
|
||||
$(call check-LOCAL_MODULE,$(LOCAL_MAKEFILE))
|
||||
$(call check-LOCAL_MODULE_FILENAME)
|
||||
|
||||
# we are building target objects
|
||||
my := TARGET_
|
||||
|
||||
$(call handle-module-filename,,)
|
||||
$(call handle-module-built)
|
||||
|
||||
LOCAL_MODULE_CLASS := EXECUTABLE
|
||||
include $(BUILD_SYSTEM)/build-module.mk
|
154
Build/coreLinux/build-local.mk
Normal file
154
Build/coreLinux/build-local.mk
Normal file
@ -0,0 +1,154 @@
|
||||
# Copyright (C) 2010 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.
|
||||
#
|
||||
|
||||
# This file is designed to be called from the 'ndk-build' script
|
||||
# or similar wrapper tool.
|
||||
#
|
||||
|
||||
# Detect the NDK installation path by processing this Makefile's location.
|
||||
# This assumes we are located under $NDK_ROOT/main.mk
|
||||
#
|
||||
NDK_ROOT := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
#NDK_ROOT := $(strip $(NDK_ROOT:%build/core/=%))
|
||||
NDK_ROOT := $(subst \,/,$(NDK_ROOT))
|
||||
NDK_ROOT := $(NDK_ROOT:%/=%)
|
||||
ifeq ($(NDK_ROOT),)
|
||||
# for the case when we're invoked from the NDK install path
|
||||
NDK_ROOT := .
|
||||
endif
|
||||
ifdef NDK_LOG
|
||||
$(info Android NDK: NDK installation path auto-detected: '$(NDK_ROOT)')
|
||||
endif
|
||||
ifneq ($(words $(NDK_ROOT)),1)
|
||||
$(info Android NDK: You NDK installation path contains spaces.)
|
||||
$(info Android NDK: Please re-install to a different location to fix the issue !)
|
||||
$(error Aborting.)
|
||||
endif
|
||||
|
||||
$(info NDK ROOT : $(NDK_ROOT))
|
||||
include $(NDK_ROOT)/init.mk
|
||||
|
||||
# ====================================================================
|
||||
#
|
||||
# If NDK_PROJECT_PATH is not defined, find the application's project
|
||||
# path by looking at the manifest file in the current directory or
|
||||
# any of its parents. If none is found, try again with 'jni/Android.mk'
|
||||
#
|
||||
# Note that we first look at the current directory to avoid using
|
||||
# absolute NDK_PROJECT_PATH values. This reduces the length of all
|
||||
# source, object and binary paths that are passed to build commands.
|
||||
#
|
||||
# It turns out that some people use ndk-build to generate static
|
||||
# libraries without a full Android project tree.
|
||||
#
|
||||
# ====================================================================
|
||||
|
||||
find-project-dir = $(strip $(call find-project-dir-inner,$(abspath $1),$2))
|
||||
|
||||
find-project-dir-inner = \
|
||||
$(eval __found_project_path := )\
|
||||
$(eval __find_project_path := $1)\
|
||||
$(eval __find_project_file := $2)\
|
||||
$(call find-project-dir-inner-2)\
|
||||
$(__found_project_path)
|
||||
|
||||
find-project-dir-inner-2 = \
|
||||
$(call ndk_log,Looking for $(__find_project_file) in $(__find_project_path))\
|
||||
$(eval __find_project_manifest := $(strip $(wildcard $(__find_project_path)/$(__find_project_file))))\
|
||||
$(if $(__find_project_manifest),\
|
||||
$(call ndk_log, Found it !)\
|
||||
$(eval __found_project_path := $(__find_project_path))\
|
||||
,\
|
||||
$(eval __find_project_parent := $(patsubst %/,%,$(dir $(__find_project_path))))\
|
||||
$(if $(__find_project_parent),\
|
||||
$(eval __find_project_path := $(__find_project_parent))\
|
||||
$(call find-project-dir-inner-2)\
|
||||
)\
|
||||
)
|
||||
|
||||
NDK_PROJECT_PATH := $(strip $(NDK_PROJECT_PATH))
|
||||
ifndef NDK_PROJECT_PATH
|
||||
ifneq (,$(strip $(wildcard AndroidManifest.xml)))
|
||||
NDK_PROJECT_PATH := .
|
||||
else
|
||||
ifneq (,$(strip $(wildcard jni/Android.mk)))
|
||||
NDK_PROJECT_PATH := .
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
ifndef NDK_PROJECT_PATH
|
||||
NDK_PROJECT_PATH := $(call find-project-dir,.,jni/Android.mk)
|
||||
endif
|
||||
ifndef NDK_PROJECT_PATH
|
||||
NDK_PROJECT_PATH := $(call find-project-dir,$(strip $(shell pwd)),AndroidManifest.xml)
|
||||
endif
|
||||
ifndef NDK_PROJECT_PATH
|
||||
NDK_PROJECT_PATH := $(call find-project-dir,$(strip $(shell pwd)),jni/Android.mk)
|
||||
endif
|
||||
ifndef NDK_PROJECT_PATH
|
||||
$(call __ndk_info,Could not find application project directory !)
|
||||
$(call __ndk_info,Please define the NDK_PROJECT_PATH variable to point to it.)
|
||||
$(call __ndk_error,Aborting)
|
||||
endif
|
||||
|
||||
# Check that there are no spaces in the project path, or bad things will happen
|
||||
ifneq ($(words $(NDK_PROJECT_PATH)),1)
|
||||
$(call __ndk_info,Your Android application project path contains spaces: '$(NDK_PROJECT_PATH)')
|
||||
$(call __ndk_info,The Android NDK build cannot work here. Please move your project to a different location.)
|
||||
$(call __ndk_error,Aborting.)
|
||||
endif
|
||||
|
||||
NDK_APPLICATION_MK := $(strip $(wildcard $(NDK_PROJECT_PATH)/jni/Application.mk))
|
||||
ifndef NDK_APPLICATION_MK
|
||||
NDK_APPLICATION_MK := $(NDK_ROOT)/default-application.mk
|
||||
endif
|
||||
|
||||
$(call ndk_log,Found project path: $(NDK_PROJECT_PATH))
|
||||
|
||||
# Place all generated files here
|
||||
NDK_APP_OUT := $(NDK_PROJECT_PATH)/obj
|
||||
|
||||
# Fake an application named 'local'
|
||||
_app := local
|
||||
_application_mk := $(NDK_APPLICATION_MK)
|
||||
NDK_APPS := $(_app)
|
||||
|
||||
include $(BUILD_SYSTEM)/add-application.mk
|
||||
|
||||
# If a goal is DUMP_xxx then we dump a variable xxx instead
|
||||
# of building anything
|
||||
#
|
||||
DUMP_VAR := $(patsubst DUMP_%,%,$(filter DUMP_%,$(MAKECMDGOALS)))
|
||||
MAKECMDGOALS := $(filter-out DUMP_$(DUMP_VAR),$(MAKECMDGOALS))
|
||||
|
||||
include $(BUILD_SYSTEM)/setup-imports.mk
|
||||
|
||||
ifneq (,$(DUMP_VAR))
|
||||
|
||||
# We only support a single DUMP_XXX goal at a time for now.
|
||||
ifneq ($(words $(DUMP_VAR)),1)
|
||||
$(call __ndk_error,!!TOO-MANY-DUMP-VARIABLES!!)
|
||||
endif
|
||||
|
||||
$(foreach _app,$(NDK_APPS),\
|
||||
$(eval include $(BUILD_SYSTEM)/setup-app.mk)\
|
||||
)
|
||||
|
||||
DUMP_$(DUMP_VAR):
|
||||
@echo $($(DUMP_VAR))
|
||||
else
|
||||
# Build it
|
||||
include $(BUILD_SYSTEM)/build-all.mk
|
||||
endif
|
34
Build/coreLinux/build-module.mk
Normal file
34
Build/coreLinux/build-module.mk
Normal file
@ -0,0 +1,34 @@
|
||||
# Copyright (C) 2010 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.
|
||||
#
|
||||
|
||||
$(call check-defined-LOCAL_MODULE,$(LOCAL_BUILD_SCRIPT))
|
||||
$(call check-LOCAL_MODULE,$(LOCAL_MAKEFILE))
|
||||
|
||||
# This file is used to record the LOCAL_XXX definitions of a given
|
||||
# module. It is included by BUILD_STATIC_LIBRARY, BUILD_SHARED_LIBRARY
|
||||
# and others.
|
||||
#
|
||||
LOCAL_MODULE_CLASS := $(strip $(LOCAL_MODULE_CLASS))
|
||||
ifndef LOCAL_MODULE_CLASS
|
||||
$(call __ndk_info,$(LOCAL_MAKEFILE):$(LOCAL_MODULE): LOCAL_MODULE_CLASS definition is missing !)
|
||||
$(call __ndk_error,Aborting)
|
||||
endif
|
||||
|
||||
$(if $(call module-class-check,$(LOCAL_MODULE_CLASS)),,\
|
||||
$(call __ndk_info,$(LOCAL_MAKEFILE):$(LOCAL_MODULE): Unknown LOCAL_MODULE_CLASS value: $(LOCAL_MODULE_CLASS))\
|
||||
$(call __ndk_error,Aborting)\
|
||||
)
|
||||
|
||||
$(call module-add,$(LOCAL_MODULE))
|
34
Build/coreLinux/build-shared-library.mk
Normal file
34
Build/coreLinux/build-shared-library.mk
Normal file
@ -0,0 +1,34 @@
|
||||
# Copyright (C) 2009 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.
|
||||
#
|
||||
|
||||
# this file is included from Android.mk files to build a target-specific
|
||||
# shared library
|
||||
#
|
||||
|
||||
LOCAL_BUILD_SCRIPT := BUILD_SHARED_LIBRARY
|
||||
LOCAL_MAKEFILE := $(local-makefile)
|
||||
|
||||
$(call check-defined-LOCAL_MODULE,$(LOCAL_BUILD_SCRIPT))
|
||||
$(call check-LOCAL_MODULE,$(LOCAL_MAKEFILE))
|
||||
$(call check-LOCAL_MODULE_FILENAME)
|
||||
|
||||
# we are building target objects
|
||||
my := TARGET_
|
||||
|
||||
$(call handle-module-filename,lib,.so)
|
||||
$(call handle-module-built)
|
||||
|
||||
LOCAL_MODULE_CLASS := SHARED_LIBRARY
|
||||
include $(BUILD_SYSTEM)/build-module.mk
|
34
Build/coreLinux/build-static-library.mk
Normal file
34
Build/coreLinux/build-static-library.mk
Normal file
@ -0,0 +1,34 @@
|
||||
# Copyright (C) 2009 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.
|
||||
#
|
||||
|
||||
# this file is included from Android.mk files to build a target-specific
|
||||
# static library
|
||||
#
|
||||
|
||||
LOCAL_BUILD_SCRIPT := BUILD_STATIC_LIBRARY
|
||||
LOCAL_MAKEFILE := $(local-makefile)
|
||||
|
||||
$(call check-defined-LOCAL_MODULE,$(LOCAL_BUILD_SCRIPT))
|
||||
$(call check-LOCAL_MODULE,$(LOCAL_MAKEFILE))
|
||||
|
||||
# we are building target objects
|
||||
my := TARGET_
|
||||
|
||||
$(call handle-module-filename,lib,.a)
|
||||
$(call handle-module-built)
|
||||
|
||||
LOCAL_MODULE_CLASS := STATIC_LIBRARY
|
||||
include $(BUILD_SYSTEM)/build-module.mk
|
||||
|
43
Build/coreLinux/check-cygwin-make.mk
Normal file
43
Build/coreLinux/check-cygwin-make.mk
Normal file
@ -0,0 +1,43 @@
|
||||
# Copyright (C) 2010 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.
|
||||
#
|
||||
|
||||
# Check that we have a Cygwin-compatible make.
|
||||
#
|
||||
# For some reason, a lot of application developers on Windows
|
||||
# have another GNU Make installed in their path, that fails
|
||||
# miserably with our build scripts. If we can detect this use
|
||||
# case, early, we will be able to dump a human-readable error
|
||||
# message with some help to fix the issue.
|
||||
#
|
||||
|
||||
.PHONY: all
|
||||
all:
|
||||
|
||||
# Get the cygwin-specific path to the make executable
|
||||
# (e.g. /cygdrive/c/cygwin/usr/bin/make), then strip the
|
||||
# .exe suffix, if any.
|
||||
#
|
||||
CYGWIN_MAKE := $(shell cygpath --unix --absolute $(firstword $(MAKE)))
|
||||
CYGWIN_MAKE := $(CYGWIN_MAKE:%.exe=%)
|
||||
|
||||
# Now try to find it on the file system, a non-cygwin compatible
|
||||
# GNU Make, even if launched from a Cygwin shell, will not
|
||||
#
|
||||
SELF_MAKE := $(strip $(wildcard $(CYGWIN_MAKE).exe))
|
||||
ifeq ($(SELF_MAKE),)
|
||||
$(error Android NDK: $(firstword $(MAKE)) is not cygwin-compatible)
|
||||
endif
|
||||
|
||||
# that's all
|
22
Build/coreLinux/clear-vars.mk
Normal file
22
Build/coreLinux/clear-vars.mk
Normal file
@ -0,0 +1,22 @@
|
||||
# Copyright (C) 2009 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.
|
||||
#
|
||||
|
||||
# this file is included repeatedly from Android.mk files in order to clean
|
||||
# the module-specific variables from the environment,
|
||||
|
||||
$(call clear-src-tags)
|
||||
|
||||
# Note: As a special exception, we don't want to clear LOCAL_PATH
|
||||
$(call clear-vars, $(filter-out LOCAL_PATH,$(modules-LOCALS:%=LOCAL_%)))
|
23
Build/coreLinux/default-application.mk
Normal file
23
Build/coreLinux/default-application.mk
Normal file
@ -0,0 +1,23 @@
|
||||
# Copyright (C) 2010 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.
|
||||
#
|
||||
|
||||
# This is the default Application.mk that is being used for applications
|
||||
# that don't provide $PROJECT_PATH/jni/Application.mk
|
||||
#
|
||||
APP_PROJECT_PATH := $(NDK_PROJECT_PATH)
|
||||
|
||||
# We expect the build script to be located here
|
||||
APP_BUILD_SCRIPT := $(APP_PROJECT_PATH)/jni/Android.mk
|
||||
|
97
Build/coreLinux/default-build-commands.mk
Normal file
97
Build/coreLinux/default-build-commands.mk
Normal file
@ -0,0 +1,97 @@
|
||||
# The following definitions are the defaults used by all toolchains.
|
||||
# This is included in setup-toolchain.mk just before the inclusion
|
||||
# of the toolchain's specific setup.mk file which can then override
|
||||
# these definitions.
|
||||
#
|
||||
|
||||
# These flags are used to ensure that a binary doesn't reference undefined
|
||||
# flags.
|
||||
TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
|
||||
|
||||
# These flags are used to enfore the NX (no execute) security feature in the
|
||||
# generated machine code. This adds a special section to the generated shared
|
||||
# libraries that instruct the Linux kernel to disable code execution from
|
||||
# the stack and the heap.
|
||||
TARGET_NO_EXECUTE_CFLAGS := -Wa,--noexecstack
|
||||
TARGET_NO_EXECUTE_LDFLAGS := -Wl,-z,noexecstack
|
||||
|
||||
# NOTE: Ensure that TARGET_LIBGCC is placed after all private objects
|
||||
# and static libraries, but before any other library in the link
|
||||
# command line when generating shared libraries and executables.
|
||||
#
|
||||
# This ensures that all libgcc.a functions required by the target
|
||||
# will be included into it, instead of relying on what's available
|
||||
# on other libraries like libc.so, which may change between system
|
||||
# releases due to toolchain or library changes.
|
||||
#
|
||||
define cmd-build-shared-library
|
||||
$(PRIVATE_CXX) \
|
||||
-nostdlib -Wl,-soname,$(notdir $@) \
|
||||
-Wl,-shared,-Bsymbolic \
|
||||
$(call host-path,\
|
||||
$(TARGET_CRTBEGIN_SO_O) \
|
||||
$(PRIVATE_OBJECTS)) \
|
||||
$(call link-whole-archives,$(PRIVATE_WHOLE_STATIC_LIBRARIES))\
|
||||
$(call host-path,\
|
||||
$(PRIVATE_STATIC_LIBRARIES) \
|
||||
$(PRIVATE_LIBGCC) \
|
||||
$(PRIVATE_SHARED_LIBRARIES)) \
|
||||
$(PRIVATE_LDFLAGS) \
|
||||
$(PRIVATE_LDLIBS) \
|
||||
$(call host-path,\
|
||||
$(TARGET_CRTEND_SO_O)) \
|
||||
-o $(call host-path,$@)
|
||||
endef
|
||||
|
||||
define cmd-build-executable
|
||||
$(PRIVATE_CXX) \
|
||||
-nostdlib -Bdynamic \
|
||||
-Wl,-dynamic-linker,/system/bin/linker \
|
||||
-Wl,--gc-sections \
|
||||
-Wl,-z,nocopyreloc \
|
||||
$(call host-path,\
|
||||
$(TARGET_CRTBEGIN_DYNAMIC_O) \
|
||||
$(PRIVATE_OBJECTS)) \
|
||||
$(call link-whole-archives,$(PRIVATE_WHOLE_STATIC_LIBRARIES))\
|
||||
$(call host-path,\
|
||||
$(PRIVATE_STATIC_LIBRARIES) \
|
||||
$(PRIVATE_LIBGCC) \
|
||||
$(PRIVATE_SHARED_LIBRARIES)) \
|
||||
$(PRIVATE_LDFLAGS) \
|
||||
$(PRIVATE_LDLIBS) \
|
||||
$(call host-path,\
|
||||
$(TARGET_CRTEND_O)) \
|
||||
-o $(call host-path,$@)
|
||||
endef
|
||||
|
||||
define cmd-build-static-library
|
||||
$(PRIVATE_AR) $(call host-path,$@) $(call host-path,$(PRIVATE_OBJECTS))
|
||||
endef
|
||||
|
||||
# The strip command is only used for shared libraries and executables.
|
||||
# It is thus safe to use --strip-unneeded, which is only dangerous
|
||||
# when applied to static libraries or object files.
|
||||
cmd-strip = $(PRIVATE_STRIP) --strip-unneeded $(call host-path,$1)
|
||||
|
||||
TARGET_LIBGCC = $(shell $(TARGET_CC) -print-libgcc-file-name)
|
||||
TARGET_LDLIBS := -lc -lm
|
||||
|
||||
#
|
||||
# IMPORTANT: The following definitions must use lazy assignment because
|
||||
# the value of TOOLCHAIN_PREFIX or TARGET_CFLAGS can be changed later by
|
||||
# the toolchain's setup.mk script.
|
||||
#
|
||||
|
||||
TARGET_CC = $(TOOLCHAIN_PREFIX)gcc
|
||||
TARGET_CFLAGS =
|
||||
|
||||
TARGET_CXX = $(TOOLCHAIN_PREFIX)g++
|
||||
TARGET_CXXFLAGS = $(TARGET_CFLAGS) -fno-exceptions -fno-rtti
|
||||
|
||||
TARGET_LD = $(TOOLCHAIN_PREFIX)ld
|
||||
TARGET_LDFLAGS :=
|
||||
|
||||
TARGET_AR = $(TOOLCHAIN_PREFIX)ar
|
||||
TARGET_ARFLAGS := crs
|
||||
|
||||
TARGET_STRIP = $(TOOLCHAIN_PREFIX)strip
|
1612
Build/coreLinux/definitions.mk
Normal file
1612
Build/coreLinux/definitions.mk
Normal file
File diff suppressed because it is too large
Load Diff
65
Build/coreLinux/import-locals.mk
Normal file
65
Build/coreLinux/import-locals.mk
Normal file
@ -0,0 +1,65 @@
|
||||
# Copyright (C) 2009 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.
|
||||
#
|
||||
# Handle local variable expor/import during the build
|
||||
#
|
||||
|
||||
$(call assert-defined,LOCAL_MODULE)
|
||||
|
||||
# For LOCAL_CFLAGS, LOCAL_CPPFLAGS and LOCAL_C_INCLUDES, we need
|
||||
# to use the exported definitions of the closure of all modules
|
||||
# we depend on.
|
||||
#
|
||||
# I.e. If module 'foo' depends on 'bar' which depends on 'zoo',
|
||||
# then 'foo' will get the CFLAGS/CPPFLAGS/C_INCLUDES of both 'bar'
|
||||
# and 'zoo'
|
||||
#
|
||||
|
||||
all_depends := $(call module-get-all-dependencies,$(LOCAL_MODULE))
|
||||
all_depends := $(filter-out $(LOCAL_MODULE),$(all_depends))
|
||||
|
||||
imported_CFLAGS := $(call module-get-listed-export,$(all_depends),CFLAGS)
|
||||
imported_CPPFLAGS := $(call module-get-listed-export,$(all_depends),CPPFLAGS)
|
||||
imported_C_INCLUDES := $(call module-get-listed-export,$(all_depends),C_INCLUDES)
|
||||
|
||||
ifdef NDK_DEBUG_IMPORTS
|
||||
$(info Imports for module $(LOCAL_MODULE):)
|
||||
$(info CFLAGS='$(imported_CFLAGS)')
|
||||
$(info CPPFLAGS='$(imported_CPPFLAGS)')
|
||||
$(info C_INCLUDES='$(imported_C_INCLUDES)')
|
||||
$(info All depends='$(all_depends)')
|
||||
endif
|
||||
|
||||
#
|
||||
# The imported compiler flags are prepended to their LOCAL_XXXX value
|
||||
# (this allows the module to override them).
|
||||
#
|
||||
LOCAL_CFLAGS := $(strip $(imported_CFLAGS) $(LOCAL_CFLAGS))
|
||||
LOCAL_CPPFLAGS := $(strip $(imported_CPPFLAGS) $(LOCAL_CPPFLAGS))
|
||||
|
||||
#
|
||||
# The imported include directories are appended to their LOCAL_XXX value
|
||||
# (this allows the module to override them)
|
||||
#
|
||||
LOCAL_C_INCLUDES := $(strip $(LOCAL_C_INCLUDES) $(imported_C_INCLUDES))
|
||||
|
||||
# Similarly, you want the imported flags to appear _after_ the LOCAL_LDLIBS
|
||||
# due to the way Unix linkers work (depending libraries must appear before
|
||||
# dependees on final link command).
|
||||
#
|
||||
imported_LDLIBS := $(call module-get-listed-export,$(all_depends),LDLIBS)
|
||||
|
||||
LOCAL_LDLIBS := $(strip $(LOCAL_LDLIBS) $(imported_LDLIBS))
|
||||
|
||||
# We're done here
|
433
Build/coreLinux/init.mk
Normal file
433
Build/coreLinux/init.mk
Normal file
@ -0,0 +1,433 @@
|
||||
# Copyright (C) 2009-2010 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.
|
||||
#
|
||||
|
||||
# Initialization of the NDK build system. This file is included by
|
||||
# several build scripts.
|
||||
#
|
||||
|
||||
# Define NDK_LOG in your environment to display log traces when
|
||||
# using the build scripts. See also the definition of ndk_log below.
|
||||
#
|
||||
NDK_LOG := $(strip $(NDK_LOG))
|
||||
|
||||
# Check that we have at least GNU Make 3.81
|
||||
# We do this by detecting whether 'lastword' is supported
|
||||
#
|
||||
MAKE_TEST := $(lastword a b c d e f)
|
||||
ifneq ($(MAKE_TEST),f)
|
||||
$(error Android NDK: GNU Make version $(MAKE_VERSION) is too low (should be >= 3.81))
|
||||
endif
|
||||
ifdef NDK_LOG
|
||||
$(info Android NDK: GNU Make version $(MAKE_VERSION) detected)
|
||||
endif
|
||||
|
||||
# NDK_ROOT *must* be defined and point to the root of the NDK installation
|
||||
NDK_ROOT := $(strip $(NDK_ROOT))
|
||||
ifndef NDK_ROOT
|
||||
$(error ERROR while including init.mk: NDK_ROOT must be defined !)
|
||||
endif
|
||||
ifneq ($(words $(NDK_ROOT)),1)
|
||||
$(info,The Android NDK installation path contains spaces: '$(NDK_ROOT)')
|
||||
$(error,Please fix the problem by reinstalling to a different location.)
|
||||
endif
|
||||
|
||||
# ====================================================================
|
||||
#
|
||||
# Define a few useful variables and functions.
|
||||
# More stuff will follow in definitions.mk.
|
||||
#
|
||||
# ====================================================================
|
||||
|
||||
# Used to output warnings and error from the library, it's possible to
|
||||
# disable any warnings or errors by overriding these definitions
|
||||
# manually or by setting NDK_NO_WARNINGS or NDK_NO_ERRORS
|
||||
|
||||
__ndk_name := Android NDK
|
||||
__ndk_info = $(info $(__ndk_name): $1 $2 $3 $4 $5)
|
||||
__ndk_warning = $(warning $(__ndk_name): $1 $2 $3 $4 $5)
|
||||
__ndk_error = $(error $(__ndk_name): $1 $2 $3 $4 $5)
|
||||
|
||||
ifdef NDK_NO_WARNINGS
|
||||
__ndk_warning :=
|
||||
endif
|
||||
ifdef NDK_NO_ERRORS
|
||||
__ndk_error :=
|
||||
endif
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Function : ndk_log
|
||||
# Arguments: 1: text to print when NDK_LOG is defined
|
||||
# Returns : None
|
||||
# Usage : $(call ndk_log,<some text>)
|
||||
# -----------------------------------------------------------------------------
|
||||
ifdef NDK_LOG
|
||||
ndk_log = $(info $(__ndk_name): $1)
|
||||
else
|
||||
ndk_log :=
|
||||
endif
|
||||
|
||||
# ====================================================================
|
||||
#
|
||||
# Host system auto-detection.
|
||||
#
|
||||
# ====================================================================
|
||||
|
||||
#
|
||||
# Determine host system and architecture from the environment
|
||||
#
|
||||
HOST_OS := $(strip $(HOST_OS))
|
||||
ifndef HOST_OS
|
||||
# On all modern variants of Windows (including Cygwin and Wine)
|
||||
# the OS environment variable is defined to 'Windows_NT'
|
||||
#
|
||||
# The value of PROCESSOR_ARCHITECTURE will be x86 or AMD64
|
||||
#
|
||||
ifeq ($(OS),Windows_NT)
|
||||
HOST_OS := windows
|
||||
else
|
||||
# For other systems, use the `uname` output
|
||||
UNAME := $(shell uname -s)
|
||||
ifneq (,$(findstring Linux,$(UNAME)))
|
||||
HOST_OS := linux
|
||||
endif
|
||||
ifneq (,$(findstring Darwin,$(UNAME)))
|
||||
HOST_OS := darwin
|
||||
endif
|
||||
# We should not be there, but just in case !
|
||||
ifneq (,$(findstring CYGWIN,$(UNAME)))
|
||||
HOST_OS := windows
|
||||
endif
|
||||
ifeq ($(HOST_OS),)
|
||||
$(call __ndk_info,Unable to determine HOST_OS from uname -s: $(UNAME))
|
||||
$(call __ndk_info,Please define HOST_OS in your environment.)
|
||||
$(call __ndk_error,Aborting.)
|
||||
endif
|
||||
endif
|
||||
$(call ndk_log,Host OS was auto-detected: $(HOST_OS))
|
||||
else
|
||||
$(call ndk_log,Host OS from environment: $(HOST_OS))
|
||||
endif
|
||||
|
||||
# For all systems, we will have HOST_OS_BASE defined as
|
||||
# $(HOST_OS), except on Cygwin where we will have:
|
||||
#
|
||||
# HOST_OS == cygwin
|
||||
# HOST_OS_BASE == windows
|
||||
#
|
||||
# Trying to detect that we're running from Cygwin is tricky
|
||||
# because we can't use $(OSTYPE): It's a Bash shell variable
|
||||
# that is not exported to sub-processes, and isn't defined by
|
||||
# other shells (for those with really weird setups).
|
||||
#
|
||||
# Instead, we assume that a program named /bin/uname.exe
|
||||
# that can be invoked and returns a valid value corresponds
|
||||
# to a Cygwin installation.
|
||||
#
|
||||
HOST_OS_BASE := $(HOST_OS)
|
||||
|
||||
ifeq ($(HOST_OS),windows)
|
||||
ifneq (,$(strip $(wildcard /bin/uname.exe)))
|
||||
$(call ndk_log,Found /bin/uname.exe on Windows host, checking for Cygwin)
|
||||
UNAME := $(shell /bin/uname.exe -s 2>NUL)
|
||||
$(call ndk_log,uname -s returned: $(UNAME))
|
||||
ifneq (,$(filter CYGWIN%,$(UNAME)))
|
||||
$(call ndk_log,Cygwin detected!)
|
||||
HOST_OS := cygwin
|
||||
else
|
||||
$(call ndk_log,Cygwin *not* detected!)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(HOST_OS),$(HOST_OS_BASE))
|
||||
$(call ndk_log, Host operating system detected: $(HOST_OS), base OS: $(HOST_OS_BASE))
|
||||
else
|
||||
$(call ndk_log, Host operating system detected: $(HOST_OS))
|
||||
endif
|
||||
|
||||
HOST_ARCH := $(strip $(HOST_ARCH))
|
||||
ifndef HOST_ARCH
|
||||
ifeq ($(HOST_OS_BASE),windows)
|
||||
HOST_ARCH := $(PROCESSOR_ARCHITECTURE)
|
||||
ifeq ($(HOST_ARCH),AMD64)
|
||||
HOST_ARCH := x86
|
||||
endif
|
||||
else # HOST_OS_BASE != windows
|
||||
UNAME := $(shell uname -m)
|
||||
ifneq (,$(findstring 86,$(UNAME)))
|
||||
HOST_ARCH := x86
|
||||
endif
|
||||
# We should probably should not care at all
|
||||
ifneq (,$(findstring Power,$(UNAME)))
|
||||
HOST_ARCH := ppc
|
||||
endif
|
||||
ifeq ($(HOST_ARCH),)
|
||||
$(call __ndk_info,Unsupported host architecture: $(UNAME))
|
||||
$(call __ndk_error,Aborting)
|
||||
endif
|
||||
endif # HOST_OS_BASE != windows
|
||||
$(call ndk_log,Host CPU was auto-detected: $(HOST_ARCH))
|
||||
else
|
||||
$(call ndk_log,Host CPU from environment: $(HOST_ARCH))
|
||||
endif
|
||||
|
||||
HOST_TAG := $(HOST_OS_BASE)-$(HOST_ARCH)
|
||||
|
||||
# The directory separator used on this host
|
||||
HOST_DIRSEP := :
|
||||
ifeq ($(HOST_OS),windows)
|
||||
HOST_DIRSEP := ;
|
||||
endif
|
||||
|
||||
# The host executable extension
|
||||
HOST_EXEEXT :=
|
||||
ifeq ($(HOST_OS),windows)
|
||||
HOST_EXEEXT := .exe
|
||||
endif
|
||||
|
||||
# If we are on Windows, we need to check that we are not running
|
||||
# Cygwin 1.5, which is deprecated and won't run our toolchain
|
||||
# binaries properly.
|
||||
#
|
||||
ifeq ($(HOST_TAG),windows-x86)
|
||||
ifeq ($(HOST_OS),cygwin)
|
||||
# On cygwin, 'uname -r' returns something like 1.5.23(0.225/5/3)
|
||||
# We recognize 1.5. as the prefix to look for then.
|
||||
CYGWIN_VERSION := $(shell uname -r)
|
||||
ifneq ($(filter XX1.5.%,XX$(CYGWIN_VERSION)),)
|
||||
$(call __ndk_info,You seem to be running Cygwin 1.5, which is not supported.)
|
||||
$(call __ndk_info,Please upgrade to Cygwin 1.7 or higher.)
|
||||
$(call __ndk_error,Aborting.)
|
||||
endif
|
||||
endif
|
||||
# special-case the host-tag
|
||||
HOST_TAG := windows
|
||||
endif
|
||||
|
||||
$(call ndk_log,HOST_TAG set to $(HOST_TAG))
|
||||
|
||||
# Check for NDK-specific versions of our host tools
|
||||
HOST_PREBUILT := $(strip $(wildcard $(NDK_ROOT)/prebuilt/$(HOST_TAG)/bin))
|
||||
ifdef HOST_PREBUILT
|
||||
$(call ndk_log,Host tools prebuilt directory: $(HOST_PREBUILT))
|
||||
HOST_AWK := $(wildcard $(HOST_PREBUILT)/awk$(HOST_EXEEXT))
|
||||
HOST_SED := $(wildcard $(HOST_PREBUILT)/sed$(HOST_EXEEXT))
|
||||
HOST_MAKE := $(wildcard $(HOST_PREBUILT)/make$(HOST_EXEEXT))
|
||||
else
|
||||
$(call ndk_log,Host tols prebuilt directory not found, using system tools)
|
||||
endif
|
||||
|
||||
HOST_ECHO := $(strip $(HOST_ECHO))
|
||||
ifndef HOST_ECHO
|
||||
HOST_ECHO := $(strip $(wildcard $(NDK_ROOT)/prebuilt/$(HOST_TAG)/bin/echo$(HOST_EXEEXT)))
|
||||
endif
|
||||
ifndef HOST_ECHO
|
||||
HOST_ECHO := echo
|
||||
endif
|
||||
$(call ndk_log,Host 'echo' tool: $(HOST_ECHO))
|
||||
|
||||
#
|
||||
# Verify that the 'awk' tool has the features we need.
|
||||
# Both Nawk and Gawk do.
|
||||
#
|
||||
HOST_AWK := $(strip $(HOST_AWK))
|
||||
ifndef HOST_AWK
|
||||
HOST_AWK := awk
|
||||
endif
|
||||
$(call ndk_log,Host 'awk' tool: $(HOST_AWK))
|
||||
|
||||
# Location of all awk scripts we use
|
||||
BUILD_AWK := $(NDK_ROOT)/build/awk
|
||||
|
||||
AWK_TEST := $(shell $(HOST_AWK) -f $(BUILD_AWK)/check-awk.awk)
|
||||
$(call ndk_log,Host 'awk' test returned: $(AWK_TEST))
|
||||
ifneq ($(AWK_TEST),Pass)
|
||||
$(call __ndk_info,Host 'awk' tool is outdated. Please define HOST_AWK to point to Gawk or Nawk !)
|
||||
$(call __ndk_error,Aborting.)
|
||||
endif
|
||||
|
||||
#
|
||||
# On Cygwin, define the 'cygwin-to-host-path' function here depending on the
|
||||
# environment. The rules are the following:
|
||||
#
|
||||
# 1/ If "cygpath' is not in your path, do not use it at all. It looks like
|
||||
# this allows to build with the NDK from MSys without problems.
|
||||
#
|
||||
# 2/ Since invoking 'cygpath -m' from GNU Make for each source file is
|
||||
# _very_ slow, try to generate a Make function that performs the mapping
|
||||
# from cygwin to host paths through simple substitutions.
|
||||
#
|
||||
# 3/ In case we fail horribly, allow the user to define NDK_USE_CYGPATH to '1'
|
||||
# in order to use 'cygpath -m' nonetheless. This is only a backup plan in
|
||||
# case our automatic substitution function doesn't work (only likely if you
|
||||
# have a very weird cygwin setup).
|
||||
#
|
||||
# The function for 2/ is generated by an awk script. It's really a series
|
||||
# of nested patsubst calls, that look like:
|
||||
#
|
||||
# cygwin-to-host-path = $(patsubst /cygdrive/c/%,c:/%,\
|
||||
# $(patsusbt /cygdrive/d/%,d:/%, \
|
||||
# $1)
|
||||
#
|
||||
# except that the actual definition is built from the list of mounted
|
||||
# drives as reported by "mount" and deals with drive letter cases (i.e.
|
||||
# '/cygdrive/c' and '/cygdrive/C')
|
||||
#
|
||||
ifeq ($(HOST_OS),cygwin)
|
||||
CYGPATH := $(strip $(HOST_CYGPATH))
|
||||
ifndef CYGPATH
|
||||
$(call ndk_log, Probing for 'cygpath' program)
|
||||
CYGPATH := $(strip $(shell which cygpath 2>/dev/null))
|
||||
ifndef CYGPATH
|
||||
$(call ndk_log, 'cygpath' was *not* found in your path)
|
||||
else
|
||||
$(call ndk_log, 'cygpath' found as: $(CYGPATH))
|
||||
endif
|
||||
endif
|
||||
ifndef CYGPATH
|
||||
cygwin-to-host-path = $1
|
||||
else
|
||||
ifeq ($(NDK_USE_CYGPATH),1)
|
||||
$(call ndk_log, Forced usage of 'cygpath -m' through NDK_USE_CYGPATH=1)
|
||||
cygwin-to-host-path = $(strip $(shell $(CYGPATH) -m $1))
|
||||
else
|
||||
# Call an awk script to generate a Makefile fragment used to define a function
|
||||
WINDOWS_HOST_PATH_FRAGMENT := $(shell mount | $(HOST_AWK) -f $(BUILD_AWK)/gen-windows-host-path.awk)
|
||||
ifeq ($(NDK_LOG),1)
|
||||
$(info Using cygwin substitution rules:)
|
||||
$(eval $(shell mount | $(HOST_AWK) -f $(BUILD_AWK)/gen-windows-host-path.awk -vVERBOSE=1))
|
||||
endif
|
||||
$(eval cygwin-to-host-path = $(WINDOWS_HOST_PATH_FRAGMENT))
|
||||
endif
|
||||
endif
|
||||
endif # HOST_OS == cygwin
|
||||
|
||||
# The location of the build system files
|
||||
BUILD_SYSTEM := $(NDK_ROOT)
|
||||
|
||||
# Include common definitions
|
||||
include $(BUILD_SYSTEM)/definitions.mk
|
||||
|
||||
# ====================================================================
|
||||
#
|
||||
# Read all toolchain-specific configuration files.
|
||||
#
|
||||
# Each toolchain must have a corresponding config.mk file located
|
||||
# in build/toolchains/<name>/ that will be included here.
|
||||
#
|
||||
# Each one of these files should define the following variables:
|
||||
# TOOLCHAIN_NAME toolchain name (e.g. arm-linux-androideabi-4.4.3)
|
||||
# TOOLCHAIN_ABIS list of target ABIs supported by the toolchain.
|
||||
#
|
||||
# Then, it should include $(ADD_TOOLCHAIN) which will perform
|
||||
# book-keeping for the build system.
|
||||
#
|
||||
# ====================================================================
|
||||
|
||||
# the build script to include in each toolchain config.mk
|
||||
ADD_TOOLCHAIN := $(BUILD_SYSTEM)/add-toolchain.mk
|
||||
|
||||
# the list of all toolchains in this NDK
|
||||
NDK_ALL_TOOLCHAINS :=
|
||||
NDK_ALL_ABIS :=
|
||||
|
||||
TOOLCHAIN_CONFIGS := $(wildcard $(NDK_ROOT)/toolchains/*/config.mk)
|
||||
$(foreach _config_mk,$(TOOLCHAIN_CONFIGS),\
|
||||
$(eval include $(BUILD_SYSTEM)/add-toolchain.mk)\
|
||||
)
|
||||
|
||||
NDK_ALL_TOOLCHAINS := $(call remove-duplicates,$(NDK_ALL_TOOLCHAINS))
|
||||
NDK_ALL_ABIS := $(call remove-duplicates,$(NDK_ALL_ABIS))
|
||||
|
||||
# Allow the user to define NDK_TOOLCHAIN to a custom toolchain name.
|
||||
# This is normally used when the NDK release comes with several toolchains
|
||||
# for the same architecture (generally for backwards-compatibility).
|
||||
#
|
||||
NDK_TOOLCHAIN := $(strip $(NDK_TOOLCHAIN))
|
||||
ifdef NDK_TOOLCHAIN
|
||||
# check that the toolchain name is supported
|
||||
$(if $(filter-out $(NDK_ALL_TOOLCHAINS),$(NDK_TOOLCHAIN)),\
|
||||
$(call __ndk_info,NDK_TOOLCHAIN is defined to the unsupported value $(NDK_TOOLCHAIN)) \
|
||||
$(call __ndk_info,Please use one of the following values: $(NDK_ALL_TOOLCHAINS))\
|
||||
$(call __ndk_error,Aborting)\
|
||||
,)
|
||||
$(call ndk_log, Using specific toolchain $(NDK_TOOLCHAIN))
|
||||
endif
|
||||
|
||||
$(call ndk_log, This NDK supports the following toolchains and target ABIs:)
|
||||
$(foreach tc,$(NDK_ALL_TOOLCHAINS),\
|
||||
$(call ndk_log, $(space)$(space)$(tc): $(NDK_TOOLCHAIN.$(tc).abis))\
|
||||
)
|
||||
|
||||
# ====================================================================
|
||||
#
|
||||
# Read all platform-specific configuration files.
|
||||
#
|
||||
# Each platform must be located in build/platforms/android-<apilevel>
|
||||
# where <apilevel> corresponds to an API level number, with:
|
||||
# 3 -> Android 1.5
|
||||
# 4 -> next platform release
|
||||
#
|
||||
# ====================================================================
|
||||
|
||||
# The platform files were moved in the Android source tree from
|
||||
# $TOP/ndk/build/platforms to $TOP/development/ndk/platforms. However,
|
||||
# the official NDK release packages still place them under the old
|
||||
# location for now, so deal with this here
|
||||
#
|
||||
NDK_PLATFORMS_ROOT := $(strip $(NDK_PLATFORMS_ROOT))
|
||||
ifndef NDK_PLATFORMS_ROOT
|
||||
NDK_PLATFORMS_ROOT := $(strip $(wildcard $(NDK_ROOT)/platforms))
|
||||
ifndef NDK_PLATFORMS_ROOT
|
||||
NDK_PLATFORMS_ROOT := $(strip $(wildcard $(NDK_ROOT)/build/platforms))
|
||||
endif
|
||||
|
||||
ifndef NDK_PLATFORMS_ROOT
|
||||
$(call __ndk_info,Could not find platform files (headers and libraries))
|
||||
$(if $(strip $(wildcard $(NDK_ROOT)/RELEASE.TXT)),\
|
||||
$(call __ndk_info,Please define NDK_PLATFORMS_ROOT to point to a valid directory.)\
|
||||
,\
|
||||
$(call __ndk_info,Please run build/tools/build-platforms.sh to build the corresponding directory.)\
|
||||
)
|
||||
$(call __ndk_error,Aborting)
|
||||
endif
|
||||
|
||||
$(call ndk_log,Found platform root directory: $(NDK_PLATFORMS_ROOT))
|
||||
endif
|
||||
ifeq ($(strip $(wildcard $(NDK_PLATFORMS_ROOT)/android-*)),)
|
||||
$(call __ndk_info,Your NDK_PLATFORMS_ROOT points to an invalid directory)
|
||||
$(call __ndk_info,Current value: $(NDK_PLATFORMS_ROOT))
|
||||
$(call __ndk_error,Aborting)
|
||||
endif
|
||||
|
||||
NDK_ALL_PLATFORMS := $(strip $(notdir $(wildcard $(NDK_PLATFORMS_ROOT)/android-*)))
|
||||
$(call ndk_log,Found supported platforms: $(NDK_ALL_PLATFORMS))
|
||||
|
||||
$(foreach _platform,$(NDK_ALL_PLATFORMS),\
|
||||
$(eval include $(BUILD_SYSTEM)/add-platform.mk)\
|
||||
)
|
||||
|
||||
# we're going to find the maximum platform number of the form android-<number>
|
||||
# ignore others, which could correspond to special and experimental cases
|
||||
NDK_ALL_PLATFORM_LEVELS := $(filter android-%,$(NDK_ALL_PLATFORMS))
|
||||
NDK_ALL_PLATFORM_LEVELS := $(patsubst android-%,%,$(NDK_ALL_PLATFORM_LEVELS))
|
||||
$(call ndk_log,Found stable platform levels: $(NDK_ALL_PLATFORM_LEVELS))
|
||||
|
||||
NDK_MAX_PLATFORM_LEVEL := 3
|
||||
$(foreach level,$(NDK_ALL_PLATFORM_LEVELS),\
|
||||
$(eval NDK_MAX_PLATFORM_LEVEL := $$(call max,$$(NDK_MAX_PLATFORM_LEVEL),$$(level)))\
|
||||
)
|
||||
$(call ndk_log,Found max platform level: $(NDK_MAX_PLATFORM_LEVEL))
|
||||
|
138
Build/coreLinux/main.mk
Normal file
138
Build/coreLinux/main.mk
Normal file
@ -0,0 +1,138 @@
|
||||
# Copyright (C) 2009 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.
|
||||
#
|
||||
|
||||
# ====================================================================
|
||||
#
|
||||
# Define the main configuration variables, and read the host-specific
|
||||
# configuration file that is normally generated by build/host-setup.sh
|
||||
#
|
||||
# ====================================================================
|
||||
|
||||
# Detect the NDK installation path by processing this Makefile's location.
|
||||
# This assumes we are located under $NDK_ROOT/main.mk
|
||||
#
|
||||
NDK_ROOT := $(lastword $(MAKEFILE_LIST))
|
||||
NDK_ROOT := $(strip $(NDK_ROOT:%build/core/main.mk=%))
|
||||
ifeq ($(NDK_ROOT),)
|
||||
# for the case when we're invoked from the NDK install path
|
||||
NDK_ROOT := .
|
||||
else
|
||||
# get rid of trailing slash
|
||||
NDK_ROOT := $(NDK_ROOT:%/=%)
|
||||
endif
|
||||
ifdef NDK_LOG
|
||||
$(info Android NDK: NDK installation path auto-detected: '$(NDK_ROOT)')
|
||||
endif
|
||||
|
||||
include $(NDK_ROOT)/init.mk
|
||||
|
||||
# ====================================================================
|
||||
#
|
||||
# Read all application configuration files
|
||||
#
|
||||
# Each 'application' must have a corresponding Application.mk file
|
||||
# located in apps/<name> where <name> is a liberal name that doesn't
|
||||
# contain any space in it, used to uniquely identify the
|
||||
#
|
||||
# See docs/ANDROID-MK.TXT for their specification.
|
||||
#
|
||||
# ====================================================================
|
||||
|
||||
NDK_ALL_APPS :=
|
||||
NDK_APPS_ROOT := $(NDK_ROOT)/apps
|
||||
|
||||
# Get the list of apps listed under apps/*
|
||||
NDK_APPLICATIONS := $(wildcard $(NDK_APPS_ROOT)/*)
|
||||
NDK_ALL_APPS := $(NDK_APPLICATIONS:$(NDK_APPS_ROOT)/%=%)
|
||||
|
||||
# Check that APP is not empty
|
||||
APP := $(strip $(APP))
|
||||
ifndef APP
|
||||
$(call __ndk_info,\
|
||||
The APP variable is undefined or empty.)
|
||||
$(call __ndk_info,\
|
||||
Please define it to one of: $(NDK_ALL_APPS))
|
||||
$(call __ndk_info,\
|
||||
You can also add new applications by writing an Application.mk file.)
|
||||
$(call __ndk_info,\
|
||||
See docs/APPLICATION-MK.TXT for details.)
|
||||
$(call __ndk_error, Aborting)
|
||||
endif
|
||||
|
||||
# Check that all apps listed in APP do exist
|
||||
_bad_apps := $(strip $(filter-out $(NDK_ALL_APPS),$(APP)))
|
||||
ifdef _bad_apps
|
||||
$(call __ndk_info,\
|
||||
APP variable defined to unknown applications: $(_bad_apps))
|
||||
$(call __ndk_info,\
|
||||
You might want to use one of the following: $(NDK_ALL_APPS))
|
||||
$(call __ndk_error, Aborting)
|
||||
endif
|
||||
|
||||
# Check that all apps listed in APP have an Application.mk
|
||||
|
||||
$(foreach _app,$(APP),\
|
||||
$(eval _application_mk := $(strip $(wildcard $(NDK_ROOT)/apps/$(_app)/Application.mk))) \
|
||||
$(call ndk_log,Parsing $(_application_mk))\
|
||||
$(if $(_application_mk),\
|
||||
$(eval include $(BUILD_SYSTEM)/add-application.mk)\
|
||||
,\
|
||||
$(call __ndk_info,\
|
||||
Missing file: apps/$(_app)/Application.mk !)\
|
||||
$(call __ndk_error, Aborting)\
|
||||
)\
|
||||
)
|
||||
|
||||
# clean up environment, just to be safe
|
||||
$(call clear-vars, $(NDK_APP_VARS))
|
||||
|
||||
ifeq ($(strip $(NDK_ALL_APPS)),)
|
||||
$(call __ndk_info,\
|
||||
The NDK could not find a proper application description under apps/*/Application.mk)
|
||||
$(call __ndk_info,\
|
||||
Please follow the instructions in docs/NDK-APPS.TXT to write one.)
|
||||
$(call __ndk_error, Aborting)
|
||||
endif
|
||||
|
||||
# now check that APP doesn't contain an unknown app name
|
||||
# if it does, we ignore them if there is at least one known
|
||||
# app name in the list. Otherwise, abort with an error message
|
||||
#
|
||||
_unknown_apps := $(filter-out $(NDK_ALL_APPS),$(APP))
|
||||
_known_apps := $(filter $(NDK_ALL_APPS),$(APP))
|
||||
|
||||
NDK_APPS := $(APP)
|
||||
|
||||
$(if $(_unknown_apps),\
|
||||
$(if $(_known_apps),\
|
||||
$(call __ndk_info,WARNING:\
|
||||
Removing unknown names from APP variable: $(_unknown_apps))\
|
||||
$(eval NDK_APPS := $(_known_apps))\
|
||||
,\
|
||||
$(call __ndk_info,\
|
||||
The APP variable contains unknown app names: $(_unknown_apps))\
|
||||
$(call __ndk_info,\
|
||||
Please use one of: $(NDK_ALL_APPS))\
|
||||
$(call __ndk_error, Aborting)\
|
||||
)\
|
||||
)
|
||||
|
||||
$(call __ndk_info,Building for application '$(NDK_APPS)')
|
||||
|
||||
# Where all app-specific generated files will be stored
|
||||
NDK_APP_OUT := $(NDK_ROOT)/out/apps
|
||||
|
||||
include $(BUILD_SYSTEM)/setup-imports.mk
|
||||
include $(BUILD_SYSTEM)/build-all.mk
|
775
Build/coreLinux/ndk-common.sh
Normal file
775
Build/coreLinux/ndk-common.sh
Normal file
@ -0,0 +1,775 @@
|
||||
# Copyright (C) 2009 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.
|
||||
#
|
||||
|
||||
# A collection of shell function definitions used by various build scripts
|
||||
# in the Android NDK (Native Development Kit)
|
||||
#
|
||||
|
||||
# Get current script name into PROGNAME
|
||||
PROGNAME=`basename $0`
|
||||
|
||||
# Find the Android NDK root, assuming we are invoked from a script
|
||||
# within its directory structure.
|
||||
#
|
||||
# $1: Variable name that will receive the path
|
||||
# $2: Path of invoking script
|
||||
find_ndk_root ()
|
||||
{
|
||||
# Try to auto-detect the NDK root by walking up the directory
|
||||
# path to the current script.
|
||||
local PROGDIR="`dirname \"$2\"`"
|
||||
while [ -n "1" ] ; do
|
||||
if [ -d "$PROGDIR" ] ; then
|
||||
break
|
||||
fi
|
||||
if [ -z "$PROGDIR" -o "$PROGDIR" = '/' ] ; then
|
||||
return 1
|
||||
fi
|
||||
PROGDIR="`cd \"$PROGDIR/..\" && pwd`"
|
||||
done
|
||||
eval $1="$PROGDIR"
|
||||
}
|
||||
|
||||
# Put location of Android NDK into ANDROID_NDK_ROOT and
|
||||
# perform a tiny amount of sanity check
|
||||
#
|
||||
if [ -z "$ANDROID_NDK_ROOT" ] ; then
|
||||
find_ndk_root ANDROID_NDK_ROOT "$0"
|
||||
if [ $? != 0 ]; then
|
||||
echo "Please define ANDROID_NDK_ROOT to point to the root of your"
|
||||
echo "Android NDK installation."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$ANDROID_NDK_ROOT" | grep -q -e " "
|
||||
if [ $? = 0 ] ; then
|
||||
echo "ERROR: The Android NDK installation path contains a space !"
|
||||
echo "Please install to a different location."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d $ANDROID_NDK_ROOT ] ; then
|
||||
echo "ERROR: Your ANDROID_NDK_ROOT variable does not point to a directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f $ANDROID_NDK_ROOT/ndk-common.sh ] ; then
|
||||
echo "ERROR: Your ANDROID_NDK_ROOT variable does not point to a valid directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
## Logging support
|
||||
##
|
||||
VERBOSE=${VERBOSE-yes}
|
||||
VERBOSE2=${VERBOSE2-no}
|
||||
|
||||
|
||||
# If NDK_LOGFILE is defined in the environment, use this as the log file
|
||||
TMPLOG=
|
||||
if [ -n "$NDK_LOGFILE" ] ; then
|
||||
mkdir -p `dirname "$NDK_LOGFILE"` && touch "$NDK_LOGFILE"
|
||||
TMPLOG="$NDK_LOGFILE"
|
||||
fi
|
||||
|
||||
# Setup a log file where all log() and log2() output will be sent
|
||||
#
|
||||
# $1: log file path (optional)
|
||||
#
|
||||
setup_default_log_file ()
|
||||
{
|
||||
if [ -n "$NDK_LOGFILE" ] ; then
|
||||
return
|
||||
fi
|
||||
if [ -n "$1" ] ; then
|
||||
NDK_LOGFILE="$1"
|
||||
else
|
||||
NDK_LOGFILE=/tmp/ndk-log-$$.txt
|
||||
fi
|
||||
export NDK_LOGFILE
|
||||
TMPLOG="$NDK_LOGFILE"
|
||||
rm -rf "$TMPLOG" && mkdir -p `dirname "$TMPLOG"` && touch "$TMPLOG"
|
||||
echo "To follow build in another terminal, please use: tail -F $TMPLOG"
|
||||
}
|
||||
|
||||
dump ()
|
||||
{
|
||||
if [ -n "$TMPLOG" ] ; then
|
||||
echo "$@" >> $TMPLOG
|
||||
fi
|
||||
echo "$@"
|
||||
}
|
||||
|
||||
log ()
|
||||
{
|
||||
if [ "$VERBOSE" = "yes" ] ; then
|
||||
echo "$@"
|
||||
else
|
||||
if [ -n "$TMPLOG" ] ; then
|
||||
echo "$@" >> $TMPLOG
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
log2 ()
|
||||
{
|
||||
if [ "$VERBOSE2" = "yes" ] ; then
|
||||
echo "$@"
|
||||
else
|
||||
if [ -n "$TMPLOG" ] ; then
|
||||
echo "$@" >> $TMPLOG
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
run ()
|
||||
{
|
||||
if [ "$VERBOSE" = "yes" ] ; then
|
||||
echo "## COMMAND: $@"
|
||||
$@ 2>&1
|
||||
else
|
||||
if [ -n "$TMPLOG" ] ; then
|
||||
echo "## COMMAND: $@" >> $TMPLOG
|
||||
$@ >>$TMPLOG 2>&1
|
||||
else
|
||||
$@ > /dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
panic ()
|
||||
{
|
||||
dump "ERROR: $@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
fail_panic ()
|
||||
{
|
||||
if [ $? != 0 ] ; then
|
||||
dump "ERROR: $@"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
## Utilities
|
||||
##
|
||||
|
||||
# Return the value of a given named variable
|
||||
# $1: variable name
|
||||
#
|
||||
# example:
|
||||
# FOO=BAR
|
||||
# BAR=ZOO
|
||||
# echo `var_value $FOO`
|
||||
# will print 'ZOO'
|
||||
#
|
||||
var_value ()
|
||||
{
|
||||
# find a better way to do that ?
|
||||
eval echo "$`echo $1`"
|
||||
}
|
||||
|
||||
# convert to uppercase
|
||||
# assumes tr is installed on the platform ?
|
||||
#
|
||||
to_uppercase ()
|
||||
{
|
||||
echo $1 | tr "[:lower:]" "[:upper:]"
|
||||
}
|
||||
|
||||
## Normalize OS and CPU
|
||||
##
|
||||
HOST_ARCH=`uname -m`
|
||||
case "$HOST_ARCH" in
|
||||
i?86) HOST_ARCH=x86
|
||||
;;
|
||||
amd64) HOST_ARCH=x86_64
|
||||
;;
|
||||
powerpc) HOST_ARCH=ppc
|
||||
;;
|
||||
esac
|
||||
|
||||
log2 "HOST_ARCH=$HOST_ARCH"
|
||||
|
||||
# at this point, the supported values for CPU are:
|
||||
# x86
|
||||
# x86_64
|
||||
# ppc
|
||||
#
|
||||
# other values may be possible but haven't been tested
|
||||
#
|
||||
HOST_EXE=""
|
||||
HOST_OS=`uname -s`
|
||||
case "$HOST_OS" in
|
||||
Darwin)
|
||||
HOST_OS=darwin
|
||||
;;
|
||||
Linux)
|
||||
# note that building 32-bit binaries on x86_64 is handled later
|
||||
HOST_OS=linux
|
||||
;;
|
||||
FreeBsd) # note: this is not tested
|
||||
HOST_OS=freebsd
|
||||
;;
|
||||
CYGWIN*|*_NT-*)
|
||||
HOST_OS=windows
|
||||
HOST_EXE=.exe
|
||||
if [ "x$OSTYPE" = xcygwin ] ; then
|
||||
HOST_OS=cygwin
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
log2 "HOST_OS=$HOST_OS"
|
||||
log2 "HOST_EXE=$HOST_EXE"
|
||||
|
||||
# at this point, the value of HOST_OS should be one of the following:
|
||||
# linux
|
||||
# darwin
|
||||
# windows (MSys)
|
||||
# cygwin
|
||||
#
|
||||
# Note that cygwin is treated as a special case because it behaves very differently
|
||||
# for a few things. Other values may be possible but have not been tested
|
||||
#
|
||||
|
||||
# define HOST_TAG as a unique tag used to identify both the host OS and CPU
|
||||
# supported values are:
|
||||
#
|
||||
# linux-x86
|
||||
# linux-x86_64
|
||||
# darwin-x86
|
||||
# darwin-ppc
|
||||
# windows
|
||||
#
|
||||
# other values are possible but were not tested.
|
||||
#
|
||||
compute_host_tag ()
|
||||
{
|
||||
case "$HOST_OS" in
|
||||
windows|cygwin)
|
||||
HOST_TAG="windows"
|
||||
;;
|
||||
*) HOST_TAG="${HOST_OS}-${HOST_ARCH}"
|
||||
esac
|
||||
log2 "HOST_TAG=$HOST_TAG"
|
||||
}
|
||||
|
||||
compute_host_tag
|
||||
|
||||
# Compute the number of host CPU cores an HOST_NUM_CPUS
|
||||
#
|
||||
case "$HOST_OS" in
|
||||
linux)
|
||||
HOST_NUM_CPUS=`cat /proc/cpuinfo | grep processor | wc -l`
|
||||
;;
|
||||
darwin|freebsd)
|
||||
HOST_NUM_CPUS=`sysctl -n hw.ncpu`
|
||||
;;
|
||||
windows|cygwin)
|
||||
HOST_NUM_CPUS=$NUMBER_OF_PROCESSORS
|
||||
;;
|
||||
*) # let's play safe here
|
||||
HOST_NUM_CPUS=1
|
||||
esac
|
||||
|
||||
log2 "HOST_NUM_CPUS=$HOST_NUM_CPUS"
|
||||
|
||||
# If BUILD_NUM_CPUS is not already defined in your environment,
|
||||
# define it as the double of HOST_NUM_CPUS. This is used to
|
||||
# run Make commands in parralles, as in 'make -j$BUILD_NUM_CPUS'
|
||||
#
|
||||
if [ -z "$BUILD_NUM_CPUS" ] ; then
|
||||
BUILD_NUM_CPUS=`expr $HOST_NUM_CPUS \* 2`
|
||||
fi
|
||||
|
||||
log2 "BUILD_NUM_CPUS=$BUILD_NUM_CPUS"
|
||||
|
||||
|
||||
## HOST TOOLCHAIN SUPPORT
|
||||
##
|
||||
|
||||
# force the generation of 32-bit binaries on 64-bit systems
|
||||
#
|
||||
FORCE_32BIT=no
|
||||
force_32bit_binaries ()
|
||||
{
|
||||
if [ "$HOST_ARCH" = x86_64 ] ; then
|
||||
log2 "Forcing generation of 32-bit host binaries on $HOST_ARCH"
|
||||
FORCE_32BIT=yes
|
||||
HOST_ARCH=x86
|
||||
log2 "HOST_ARCH=$HOST_ARCH"
|
||||
compute_host_tag
|
||||
fi
|
||||
}
|
||||
|
||||
# On Windows, cygwin binaries will be generated by default, but
|
||||
# you can force mingw ones that do not link to cygwin.dll if you
|
||||
# call this function.
|
||||
#
|
||||
disable_cygwin ()
|
||||
{
|
||||
if [ $OS = cygwin ] ; then
|
||||
log2 "Disabling cygwin binaries generation"
|
||||
CFLAGS="$CFLAGS -mno-cygwin"
|
||||
LDFLAGS="$LDFLAGS -mno-cygwin"
|
||||
OS=windows
|
||||
HOST_OS=windows
|
||||
compute_host_tag
|
||||
fi
|
||||
}
|
||||
|
||||
# Various probes are going to need to run a small C program
|
||||
mkdir -p /tmp/ndk-$USER/tmp/tests
|
||||
|
||||
TMPC=/tmp/ndk-$USER/tmp/tests/test-$$.c
|
||||
TMPO=/tmp/ndk-$USER/tmp/tests/test-$$.o
|
||||
TMPE=/tmp/ndk-$USER/tmp/tests/test-$$$EXE
|
||||
TMPL=/tmp/ndk-$USER/tmp/tests/test-$$.log
|
||||
|
||||
# cleanup temporary files
|
||||
clean_temp ()
|
||||
{
|
||||
rm -f $TMPC $TMPO $TMPL $TMPE
|
||||
}
|
||||
|
||||
# cleanup temp files then exit with an error
|
||||
clean_exit ()
|
||||
{
|
||||
clean_temp
|
||||
exit 1
|
||||
}
|
||||
|
||||
# this function will setup the compiler and linker and check that they work as advertised
|
||||
# note that you should call 'force_32bit_binaries' before this one if you want it to
|
||||
# generate 32-bit binaries on 64-bit systems (that support it).
|
||||
#
|
||||
setup_toolchain ()
|
||||
{
|
||||
if [ -z "$CC" ] ; then
|
||||
CC=gcc
|
||||
fi
|
||||
if [ -z "$CXX" ] ; then
|
||||
CXX=g++
|
||||
fi
|
||||
if [ -z "$CXXFLAGS" ] ; then
|
||||
CXXFLAGS="$CFLAGS"
|
||||
fi
|
||||
if [ -z "$LD" ] ; then
|
||||
LD="$CC"
|
||||
fi
|
||||
|
||||
log2 "Using '$CC' as the C compiler"
|
||||
|
||||
# check that we can compile a trivial C program with this compiler
|
||||
mkdir -p $(dirname "$TMPC")
|
||||
cat > $TMPC <<EOF
|
||||
int main(void) {}
|
||||
EOF
|
||||
|
||||
if [ "$FORCE_32BIT" = yes ] ; then
|
||||
CC="$CC -m32"
|
||||
CXX="$CXX -m32"
|
||||
LD="$LD -m32"
|
||||
compile
|
||||
if [ $? != 0 ] ; then
|
||||
# sometimes, we need to also tell the assembler to generate 32-bit binaries
|
||||
# this is highly dependent on your GCC installation (and no, we can't set
|
||||
# this flag all the time)
|
||||
CFLAGS="$CFLAGS -Wa,--32"
|
||||
compile
|
||||
fi
|
||||
fi
|
||||
|
||||
compile
|
||||
if [ $? != 0 ] ; then
|
||||
echo "your C compiler doesn't seem to work:"
|
||||
cat $TMPL
|
||||
clean_exit
|
||||
fi
|
||||
log "CC : compiler check ok ($CC)"
|
||||
|
||||
# check that we can link the trivial program into an executable
|
||||
link
|
||||
if [ $? != 0 ] ; then
|
||||
OLD_LD="$LD"
|
||||
LD="$CC"
|
||||
compile
|
||||
link
|
||||
if [ $? != 0 ] ; then
|
||||
LD="$OLD_LD"
|
||||
echo "your linker doesn't seem to work:"
|
||||
cat $TMPL
|
||||
clean_exit
|
||||
fi
|
||||
fi
|
||||
log2 "Using '$LD' as the linker"
|
||||
log "LD : linker check ok ($LD)"
|
||||
|
||||
# check the C++ compiler
|
||||
log2 "Using '$CXX' as the C++ compiler"
|
||||
|
||||
cat > $TMPC <<EOF
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout << "Hello World!" << endl;
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
|
||||
compile_cpp
|
||||
if [ $? != 0 ] ; then
|
||||
echo "your C++ compiler doesn't seem to work"
|
||||
cat $TMPL
|
||||
clean_exit
|
||||
fi
|
||||
|
||||
log "CXX : C++ compiler check ok ($CXX)"
|
||||
|
||||
# XXX: TODO perform AR checks
|
||||
AR=ar
|
||||
ARFLAGS=
|
||||
}
|
||||
|
||||
# try to compile the current source file in $TMPC into an object
|
||||
# stores the error log into $TMPL
|
||||
#
|
||||
compile ()
|
||||
{
|
||||
log2 "Object : $CC -o $TMPO -c $CFLAGS $TMPC"
|
||||
$CC -o $TMPO -c $CFLAGS $TMPC 2> $TMPL
|
||||
}
|
||||
|
||||
compile_cpp ()
|
||||
{
|
||||
log2 "Object : $CXX -o $TMPO -c $CXXFLAGS $TMPC"
|
||||
$CXX -o $TMPO -c $CXXFLAGS $TMPC 2> $TMPL
|
||||
}
|
||||
|
||||
# try to link the recently built file into an executable. error log in $TMPL
|
||||
#
|
||||
link()
|
||||
{
|
||||
log2 "Link : $LD -o $TMPE $TMPO $LDFLAGS"
|
||||
$LD -o $TMPE $TMPO $LDFLAGS 2> $TMPL
|
||||
}
|
||||
|
||||
# run a command
|
||||
#
|
||||
execute()
|
||||
{
|
||||
log2 "Running: $*"
|
||||
$*
|
||||
}
|
||||
|
||||
# perform a simple compile / link / run of the source file in $TMPC
|
||||
compile_exec_run()
|
||||
{
|
||||
log2 "RunExec : $CC -o $TMPE $CFLAGS $TMPC"
|
||||
compile
|
||||
if [ $? != 0 ] ; then
|
||||
echo "Failure to compile test program"
|
||||
cat $TMPC
|
||||
cat $TMPL
|
||||
clean_exit
|
||||
fi
|
||||
link
|
||||
if [ $? != 0 ] ; then
|
||||
echo "Failure to link test program"
|
||||
cat $TMPC
|
||||
echo "------"
|
||||
cat $TMPL
|
||||
clean_exit
|
||||
fi
|
||||
$TMPE
|
||||
}
|
||||
|
||||
pattern_match ()
|
||||
{
|
||||
echo "$2" | grep -q -E -e "$1"
|
||||
}
|
||||
|
||||
# Let's check that we have a working md5sum here
|
||||
check_md5sum ()
|
||||
{
|
||||
A_MD5=`echo "A" | md5sum | cut -d' ' -f1`
|
||||
if [ "$A_MD5" != "bf072e9119077b4e76437a93986787ef" ] ; then
|
||||
echo "Please install md5sum on this machine"
|
||||
exit 2
|
||||
fi
|
||||
}
|
||||
|
||||
# Find if a given shell program is available.
|
||||
# We need to take care of the fact that the 'which <foo>' command
|
||||
# may return either an empty string (Linux) or something like
|
||||
# "no <foo> in ..." (Darwin). Also, we need to redirect stderr
|
||||
# to /dev/null for Cygwin
|
||||
#
|
||||
# $1: variable name
|
||||
# $2: program name
|
||||
#
|
||||
# Result: set $1 to the full path of the corresponding command
|
||||
# or to the empty/undefined string if not available
|
||||
#
|
||||
find_program ()
|
||||
{
|
||||
local PROG
|
||||
PROG=`which $2 2>/dev/null`
|
||||
if [ -n "$PROG" ] ; then
|
||||
if pattern_match '^no ' "$PROG"; then
|
||||
PROG=
|
||||
fi
|
||||
fi
|
||||
eval $1="$PROG"
|
||||
}
|
||||
|
||||
prepare_download ()
|
||||
{
|
||||
find_program CMD_WGET wget
|
||||
find_program CMD_CURL curl
|
||||
find_program CMD_SCRP scp
|
||||
}
|
||||
|
||||
# Download a file with either 'curl', 'wget' or 'scp'
|
||||
#
|
||||
# $1: source URL (e.g. http://foo.com, ssh://blah, /some/path)
|
||||
# $2: target file
|
||||
download_file ()
|
||||
{
|
||||
# Is this HTTP, HTTPS or FTP ?
|
||||
if pattern_match "^(http|https|ftp):.*" "$1"; then
|
||||
if [ -n "$CMD_WGET" ] ; then
|
||||
run $CMD_WGET -O $2 $1
|
||||
elif [ -n "$CMD_CURL" ] ; then
|
||||
run $CMD_CURL -o $2 $1
|
||||
else
|
||||
echo "Please install wget or curl on this machine"
|
||||
exit 1
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
# Is this SSH ?
|
||||
# Accept both ssh://<path> or <machine>:<path>
|
||||
#
|
||||
if pattern_match "^(ssh|[^:]+):.*" "$1"; then
|
||||
if [ -n "$CMD_SCP" ] ; then
|
||||
scp_src=`echo $1 | sed -e s%ssh://%%g`
|
||||
run $CMD_SCP $scp_src $2
|
||||
else
|
||||
echo "Please install scp on this machine"
|
||||
exit 1
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
# Is this a file copy ?
|
||||
# Accept both file://<path> or /<path>
|
||||
#
|
||||
if pattern_match "^(file://|/).*" "$1"; then
|
||||
cp_src=`echo $1 | sed -e s%^file://%%g`
|
||||
run cp -f $cp_src $2
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Unpack a given archive
|
||||
#
|
||||
# $1: archive file path
|
||||
# $2: optional target directory (current one if omitted)
|
||||
#
|
||||
unpack_archive ()
|
||||
{
|
||||
local ARCHIVE="$1"
|
||||
local DIR=${2-.}
|
||||
local RESULT TARFLAGS ZIPFLAGS
|
||||
mkdir -p "$DIR"
|
||||
if [ "$VERBOSE2" = "yes" ] ; then
|
||||
TARFLAGS="vxpf"
|
||||
ZIPFLAGS=""
|
||||
else
|
||||
TARFLAGS="xpf"
|
||||
ZIPFLAGS="q"
|
||||
fi
|
||||
case "$ARCHIVE" in
|
||||
*.zip)
|
||||
(cd $DIR && run unzip $ZIPFLAGS "$ARCHIVE")
|
||||
;;
|
||||
*.tar)
|
||||
run tar $TARFLAGS "$ARCHIVE" -C $DIR
|
||||
;;
|
||||
*.tar.gz)
|
||||
run tar z$TARFLAGS "$ARCHIVE" -C $DIR
|
||||
;;
|
||||
*.tar.bz2)
|
||||
run tar j$TARFLAGS "$ARCHIVE" -C $DIR
|
||||
;;
|
||||
*)
|
||||
panic "Cannot unpack archive with unknown extension: $ARCHIVE"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Pack a given archive
|
||||
#
|
||||
# $1: archive file path (including extension)
|
||||
# $2: source directory for archive content
|
||||
# $3+: list of files (including patterns), all if empty
|
||||
pack_archive ()
|
||||
{
|
||||
local ARCHIVE="$1"
|
||||
local SRCDIR="$2"
|
||||
local SRCFILES
|
||||
local TARFLAGS ZIPFLAGS
|
||||
shift; shift;
|
||||
if [ -z "$1" ] ; then
|
||||
SRCFILES="*"
|
||||
else
|
||||
SRCFILES="$@"
|
||||
fi
|
||||
if [ "`basename $ARCHIVE`" = "$ARCHIVE" ] ; then
|
||||
ARCHIVE="`pwd`/$ARCHIVE"
|
||||
fi
|
||||
mkdir -p `dirname $ARCHIVE`
|
||||
if [ "$VERBOSE2" = "yes" ] ; then
|
||||
TARFLAGS="vcf"
|
||||
ZIPFLAGS="-9r"
|
||||
else
|
||||
TARFLAGS="cf"
|
||||
ZIPFLAGS="-9qr"
|
||||
fi
|
||||
case "$ARCHIVE" in
|
||||
*.zip)
|
||||
(cd $SRCDIR && run zip $ZIPFLAGS "$ARCHIVE" $SRCFILES)
|
||||
;;
|
||||
*.tar)
|
||||
(cd $SRCDIR && run tar $TARFLAGS "$ARCHIVE" $SRCFILES)
|
||||
;;
|
||||
*.tar.gz)
|
||||
(cd $SRCDIR && run tar z$TARFLAGS "$ARCHIVE" $SRCFILES)
|
||||
;;
|
||||
*.tar.bz2)
|
||||
(cd $SRCDIR && run tar j$TARFLAGS "$ARCHIVE" $SRCFILES)
|
||||
;;
|
||||
*)
|
||||
panic "Unsupported archive format: $ARCHIVE"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Copy a directory, create target location if needed
|
||||
#
|
||||
# $1: source directory
|
||||
# $2: target directory location
|
||||
#
|
||||
copy_directory ()
|
||||
{
|
||||
local SRCDIR="$1"
|
||||
local DSTDIR="$2"
|
||||
if [ ! -d "$SRCDIR" ] ; then
|
||||
panic "Can't copy from non-directory: $SRCDIR"
|
||||
fi
|
||||
log "Copying directory: "
|
||||
log " from $SRCDIR"
|
||||
log " to $DSTDIR"
|
||||
mkdir -p "$DSTDIR" && (cd "$SRCDIR" && 2>/dev/null tar cf - *) | (tar xf - -C "$DSTDIR")
|
||||
fail_panic "Cannot copy to directory: $DSTDIR"
|
||||
}
|
||||
|
||||
# This is the same than copy_directory(), but symlinks will be replaced
|
||||
# by the file they actually point to instead.
|
||||
copy_directory_nolinks ()
|
||||
{
|
||||
local SRCDIR="$1"
|
||||
local DSTDIR="$2"
|
||||
if [ ! -d "$SRCDIR" ] ; then
|
||||
panic "Can't copy from non-directory: $SRCDIR"
|
||||
fi
|
||||
log "Copying directory (without symlinks): "
|
||||
log " from $SRCDIR"
|
||||
log " to $DSTDIR"
|
||||
mkdir -p "$DSTDIR" && (cd "$SRCDIR" && tar chf - *) | (tar xf - -C "$DSTDIR")
|
||||
fail_panic "Cannot copy to directory: $DSTDIR"
|
||||
}
|
||||
|
||||
# Copy certain files from one directory to another one
|
||||
# $1: source directory
|
||||
# $2: target directory
|
||||
# $3+: file list (including patterns)
|
||||
copy_file_list ()
|
||||
{
|
||||
local SRCDIR="$1"
|
||||
local DSTDIR="$2"
|
||||
shift; shift;
|
||||
if [ ! -d "$SRCDIR" ] ; then
|
||||
panic "Cant' copy from non-directory: $SRCDIR"
|
||||
fi
|
||||
log "Copying file: $@"
|
||||
log " from $SRCDIR"
|
||||
log " to $DSTDIR"
|
||||
mkdir -p "$DSTDIR" && (cd "$SRCDIR" && tar cf - $@) | (tar xf - -C "$DSTDIR")
|
||||
fail_panic "Cannot copy files to directory: $DSTDIR"
|
||||
}
|
||||
|
||||
# Rotate a log file
|
||||
# If the given log file exist, add a -1 to the end of the file.
|
||||
# If older log files exist, rename them to -<n+1>
|
||||
# $1: log file
|
||||
# $2: maximum version to retain [optional]
|
||||
rotate_log ()
|
||||
{
|
||||
# Default Maximum versions to retain
|
||||
local MAXVER="5"
|
||||
local LOGFILE="$1"
|
||||
shift;
|
||||
if [ ! -z "$1" ] ; then
|
||||
local tmpmax="$1"
|
||||
shift;
|
||||
tmpmax=`expr $tmpmax + 0`
|
||||
if [ $tmpmax -lt 1 ] ; then
|
||||
panic "Invalid maximum log file versions '$tmpmax' invalid; defaulting to $MAXVER"
|
||||
else
|
||||
MAXVER=$tmpmax;
|
||||
fi
|
||||
fi
|
||||
|
||||
# Do Nothing if the log file does not exist
|
||||
if [ ! -f "${LOGFILE}" ] ; then
|
||||
return
|
||||
fi
|
||||
|
||||
# Rename existing older versions
|
||||
ver=$MAXVER
|
||||
while [ $ver -ge 1 ]
|
||||
do
|
||||
local prev=$(( $ver - 1 ))
|
||||
local old="-$prev"
|
||||
|
||||
# Instead of old version 0; use the original filename
|
||||
if [ $ver -eq 1 ] ; then
|
||||
old=""
|
||||
fi
|
||||
|
||||
if [ -f "${LOGFILE}${old}" ] ; then
|
||||
mv -f "${LOGFILE}${old}" "${LOGFILE}-${ver}"
|
||||
fi
|
||||
|
||||
ver=$prev
|
||||
done
|
||||
}
|
66
Build/coreLinux/prebuilt-library.mk
Normal file
66
Build/coreLinux/prebuilt-library.mk
Normal file
@ -0,0 +1,66 @@
|
||||
# Copyright (C) 2010 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.
|
||||
#
|
||||
|
||||
# this file is included from prebuilt-shared-library.mk or
|
||||
# prebuilt-static-library.mk to declare prebuilt library binaries.
|
||||
#
|
||||
|
||||
$(call assert-defined, LOCAL_BUILD_SCRIPT LOCAL_MAKEFILE LOCAL_PREBUILT_PREFIX LOCAL_PREBUILT_SUFFIX)
|
||||
|
||||
$(call check-defined-LOCAL_MODULE,$(LOCAL_BUILD_SCRIPT))
|
||||
$(call check-LOCAL_MODULE,$(LOCAL_MAKEFILE))
|
||||
$(call check-LOCAL_MODULE_FILENAME)
|
||||
|
||||
# Check that LOCAL_SRC_FILES contains only paths to shared libraries
|
||||
ifneq ($(words $(LOCAL_SRC_FILES)),1)
|
||||
$(call __ndk_info,ERROR:$(LOCAL_MAKEFILE):$(LOCAL_MODULE): The LOCAL_SRC_FILES for a prebuilt static library should only contain one item))
|
||||
$(call __ndk_error,Aborting)
|
||||
endif
|
||||
|
||||
bad_prebuilts := $(filter-out %$(LOCAL_PREBUILT_SUFFIX),$(LOCAL_SRC_FILES))
|
||||
ifdef bad_prebuilts
|
||||
$(call __ndk_info,ERROR:$(LOCAL_MAKEFILE):$(LOCAL_MODULE): LOCAL_SRC_FILES should point to a file ending with "$(LOCAL_PREBUILT_SUFFIX)")
|
||||
$(call __ndk_info,The following file is unsupported: $(bad_prebuilts))
|
||||
$(call __ndk_error,Aborting)
|
||||
endif
|
||||
|
||||
prebuilt := $(strip $(wildcard $(LOCAL_PATH)/$(LOCAL_SRC_FILES)))
|
||||
ifndef prebuilt
|
||||
$(call __ndk_info,ERROR:$(LOCAL_MAKEFILE):$(LOCAL_MODULE): LOCAL_SRC_FILES points to a missing file)
|
||||
$(call __ndk_info,Check that $(LOCAL_PATH)/$(LOCAL_SRC_FILES) exists, or that its path is correct)
|
||||
$(call __ndk_error,Aborting)
|
||||
endif
|
||||
|
||||
# If LOCAL_MODULE_FILENAME is defined, it will be used to name the file
|
||||
# in the TARGET_OUT directory, and then the installation one. Note that
|
||||
# if shouldn't have an .a or .so extension nor contain directory separators.
|
||||
#
|
||||
# If the variable is not defined, we determine its value from LOCAL_SRC_FILES
|
||||
#
|
||||
LOCAL_MODULE_FILENAME := $(strip $(LOCAL_MODULE_FILENAME))
|
||||
ifndef LOCAL_MODULE_FILENAME
|
||||
LOCAL_MODULE_FILENAME := $(notdir $(LOCAL_SRC_FILES))
|
||||
LOCAL_MODULE_FILENAME := $(LOCAL_MODULE_FILENAME:%$(LOCAL_PREBUILT_SUFFIX)=%)
|
||||
endif
|
||||
$(eval $(call ev-check-module-filename))
|
||||
|
||||
LOCAL_BUILT_MODULE := $(TARGET_OUT)/$(LOCAL_MODULE_FILENAME)$(LOCAL_PREBUILT_SUFFIX)
|
||||
LOCAL_OBJS_DIR := $(TARGET_OBJS)/$(LOCAL_MODULE)
|
||||
LOCAL_OBJECTS := $(prebuilt)
|
||||
LOCAL_SRC_FILES :=
|
||||
|
||||
$(LOCAL_BUILT_MODULE): $(LOCAL_OBJECTS)
|
||||
|
||||
include $(BUILD_SYSTEM)/build-module.mk
|
27
Build/coreLinux/prebuilt-shared-library.mk
Normal file
27
Build/coreLinux/prebuilt-shared-library.mk
Normal file
@ -0,0 +1,27 @@
|
||||
# Copyright (C) 2010 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.
|
||||
#
|
||||
|
||||
# this file is included from Android.mk files to build a target-specific
|
||||
# shared library
|
||||
#
|
||||
|
||||
LOCAL_BUILD_SCRIPT := PREBUILT_SHARED_LIBRARY
|
||||
LOCAL_MODULE_CLASS := PREBUILT_SHARED_LIBRARY
|
||||
LOCAL_MAKEFILE := $(local-makefile)
|
||||
|
||||
LOCAL_PREBUILT_PREFIX := lib
|
||||
LOCAL_PREBUILT_SUFFIX := .so
|
||||
|
||||
include $(BUILD_SYSTEM)/prebuilt-library.mk
|
27
Build/coreLinux/prebuilt-static-library.mk
Normal file
27
Build/coreLinux/prebuilt-static-library.mk
Normal file
@ -0,0 +1,27 @@
|
||||
# Copyright (C) 2010 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.
|
||||
#
|
||||
|
||||
# this file is included from Android.mk files to build a target-specific
|
||||
# shared library
|
||||
#
|
||||
|
||||
LOCAL_BUILD_SCRIPT := PREBUILT_STATIC_LIBRARY
|
||||
LOCAL_MODULE_CLASS := PREBUILT_STATIC_LIBRARY
|
||||
LOCAL_MAKEFILE := $(local-makefile)
|
||||
|
||||
LOCAL_PREBUILT_PREFIX := lib
|
||||
LOCAL_PREBUILT_SUFFIX := .a
|
||||
|
||||
include $(BUILD_SYSTEM)/prebuilt-library.mk
|
54
Build/coreLinux/setup-abi.mk
Normal file
54
Build/coreLinux/setup-abi.mk
Normal file
@ -0,0 +1,54 @@
|
||||
# Copyright (C) 2009 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.
|
||||
#
|
||||
|
||||
# this file is included multiple times by build/core/setup-app.mk
|
||||
#
|
||||
|
||||
$(call ndk_log,Building application '$(NDK_APP_NAME)' for ABI '$(TARGET_ARCH_ABI)')
|
||||
|
||||
# Map ABIs to a target architecture
|
||||
TARGET_ARCH_for_armeabi := arm
|
||||
TARGET_ARCH_for_armeabi-v7a := arm
|
||||
TARGET_ARCH_for_x86 := x86
|
||||
|
||||
TARGET_ARCH := $(TARGET_ARCH_for_$(TARGET_ARCH_ABI))
|
||||
|
||||
TARGET_OUT := $(NDK_APP_OUT)/$(_app)/$(TARGET_ARCH_ABI)
|
||||
|
||||
# Special handling for x86: The minimal platform is android-9 here
|
||||
# For now, handle this with a simple substitution. We may want to implement
|
||||
# more general filtering in the future when introducing other ABIs.
|
||||
TARGET_PLATFORM_SAVED := $(TARGET_PLATFORM)
|
||||
ifeq ($(TARGET_ARCH),x86)
|
||||
$(foreach _plat,3 4 5 8,\
|
||||
$(eval TARGET_PLATFORM := $$(subst android-$(_plat),android-9,$$(TARGET_PLATFORM)))\
|
||||
)
|
||||
endif
|
||||
|
||||
# Separate the debug and release objects. This prevents rebuilding
|
||||
# everything when you switch between these two modes. For projects
|
||||
# with lots of C++ sources, this can be a considerable time saver.
|
||||
ifeq ($(NDK_APP_OPTIM),debug)
|
||||
TARGET_OBJS := $(TARGET_OUT)/objs-debug
|
||||
else
|
||||
TARGET_OBJS := $(TARGET_OUT)/objs
|
||||
endif
|
||||
|
||||
TARGET_GDB_SETUP := $(TARGET_OUT)/setup.gdb
|
||||
|
||||
include $(BUILD_SYSTEM)/setup-toolchain.mk
|
||||
|
||||
# Restore TARGET_PLATFORM, see above.
|
||||
TARGET_PLATFORM := $(TARGET_PLATFORM_SAVED)
|
83
Build/coreLinux/setup-app.mk
Normal file
83
Build/coreLinux/setup-app.mk
Normal file
@ -0,0 +1,83 @@
|
||||
# Copyright (C) 2009 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.
|
||||
#
|
||||
|
||||
# this file is included repeatedly from build/core/main.mk
|
||||
# and is used to prepare for app-specific build rules.
|
||||
#
|
||||
|
||||
$(call assert-defined,_app)
|
||||
|
||||
_map := NDK_APP.$(_app)
|
||||
|
||||
# ok, let's parse all Android.mk source files in order to build
|
||||
# the modules for this app.
|
||||
#
|
||||
|
||||
# Restore the APP_XXX variables just for this pass as NDK_APP_XXX
|
||||
#
|
||||
NDK_APP_NAME := $(_app)
|
||||
NDK_APP_APPLICATION_MK := $(call get,$(_map),Application.mk)
|
||||
|
||||
$(foreach __name,$(NDK_APP_VARS),\
|
||||
$(eval NDK_$(__name) := $(call get,$(_map),$(__name)))\
|
||||
)
|
||||
|
||||
# make the application depend on the modules it requires
|
||||
.PHONY: ndk-app-$(_app)
|
||||
ndk-app-$(_app): $(NDK_APP_MODULES)
|
||||
all: ndk-app-$(_app)
|
||||
|
||||
# which platform/abi/toolchain are we going to use?
|
||||
TARGET_PLATFORM := $(call get,$(_map),APP_PLATFORM)
|
||||
|
||||
# The ABI(s) to use
|
||||
NDK_APP_ABI := $(strip $(NDK_APP_ABI))
|
||||
ifndef NDK_APP_ABI
|
||||
# the default ABI for now is armeabi
|
||||
NDK_APP_ABI := armeabi
|
||||
endif
|
||||
|
||||
# If APP_ABI is 'all', then set it to all supported ABIs
|
||||
# Otherwise, check that we don't have an invalid value here.
|
||||
#
|
||||
ifeq ($(NDK_APP_ABI),all)
|
||||
NDK_APP_ABI := $(NDK_ALL_ABIS)
|
||||
else
|
||||
# check the target ABIs for this application
|
||||
_bad_abis = $(strip $(filter-out $(NDK_ALL_ABIS),$(NDK_APP_ABI)))
|
||||
ifneq ($(_bad_abis),)
|
||||
$(call __ndk_info,NDK Application '$(_app)' targets unknown ABI(s): $(_bad_abis))
|
||||
$(call __ndk_info,Please fix the APP_ABI definition in $(NDK_APP_APPLICATION_MK))
|
||||
$(call __ndk_error,Aborting)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Clear all installed binaries for this application
|
||||
# This ensures that if the build fails, you're not going to mistakenly
|
||||
# package an obsolete version of it. Or if you change the ABIs you're targetting,
|
||||
# you're not going to leave a stale shared library for the old one.
|
||||
#
|
||||
ifeq ($(NDK_APP.$(_app).cleaned_binaries),)
|
||||
NDK_APP.$(_app).cleaned_binaries := true
|
||||
clean-installed-binaries::
|
||||
$(hide) $(call host-rm,$(NDK_ALL_ABIS:%=$(NDK_APP_PROJECT_PATH)/libs/%/lib*.so))
|
||||
$(hide) $(call host-rm,$(NDK_ALL_ABIS:%=$(NDK_APP_PROJECT_PATH)/libs/%/gdbserver))
|
||||
$(hide) $(call host-rm,$(NDK_ALL_ABIS:%=$(NDK_APP_PROJECT_PATH)/libs/%/gdb.setup))
|
||||
endif
|
||||
|
||||
$(foreach _abi,$(NDK_APP_ABI),\
|
||||
$(eval TARGET_ARCH_ABI := $(_abi))\
|
||||
$(eval include $(BUILD_SYSTEM)/setup-abi.mk) \
|
||||
)
|
36
Build/coreLinux/setup-imports.mk
Normal file
36
Build/coreLinux/setup-imports.mk
Normal file
@ -0,0 +1,36 @@
|
||||
# Copyright (C) 2009-2010 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.
|
||||
#
|
||||
|
||||
# ====================================================================
|
||||
#
|
||||
# Check the import path
|
||||
#
|
||||
# ====================================================================
|
||||
|
||||
NDK_MODULE_PATH := $(strip $(NDK_MODULE_PATH))
|
||||
ifdef NDK_MODULE_PATH
|
||||
ifneq ($(words $(NDK_MODULE_PATH)),1)
|
||||
$(call __ndk_info,ERROR: You NDK_MODULE_PATH variable contains spaces)
|
||||
$(call __ndk_info,Please fix the error and start again.)
|
||||
$(call __ndk_error,Aborting)
|
||||
endif
|
||||
endif
|
||||
|
||||
$(call import-init)
|
||||
$(foreach __path,$(subst $(HOST_DIRSEP),$(space),$(NDK_MODULE_PATH)),\
|
||||
$(call import-add-path,$(__path))\
|
||||
)
|
||||
$(call import-add-path-optional,$(NDK_ROOT)/sources)
|
||||
$(call import-add-path-optional,$(NDK_ROOT)/../development/ndk/sources)
|
177
Build/coreLinux/setup-toolchain.mk
Normal file
177
Build/coreLinux/setup-toolchain.mk
Normal file
@ -0,0 +1,177 @@
|
||||
# Copyright (C) 2009 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.
|
||||
#
|
||||
|
||||
# this file is included repeatedly from build/core/setup-abi.mk and is used
|
||||
# to setup the target toolchain for a given platform/abi combination.
|
||||
#
|
||||
|
||||
$(call assert-defined,TARGET_PLATFORM TARGET_ARCH TARGET_ARCH_ABI)
|
||||
$(call assert-defined,NDK_APPS NDK_APP_STL)
|
||||
|
||||
# Check that we have a toolchain that supports the current ABI.
|
||||
# NOTE: If NDK_TOOLCHAIN is defined, we're going to use it.
|
||||
#
|
||||
ifndef NDK_TOOLCHAIN
|
||||
TARGET_TOOLCHAIN_LIST := $(strip $(sort $(NDK_ABI.$(TARGET_ARCH_ABI).toolchains)))
|
||||
ifndef TARGET_TOOLCHAIN_LIST
|
||||
$(call __ndk_info,There is no toolchain that supports the $(TARGET_ARCH_ABI) ABI.)
|
||||
$(call __ndk_info,Please modify the APP_ABI definition in $(NDK_APP_APPLICATION_MK) to use)
|
||||
$(call __ndk_info,a set of the following values: $(NDK_ALL_ABIS))
|
||||
$(call __ndk_error,Aborting)
|
||||
endif
|
||||
# Select the last toolchain from the sorted list.
|
||||
# For now, this is enough to select armeabi-4.4.0 by default for ARM
|
||||
TARGET_TOOLCHAIN := $(lastword $(TARGET_TOOLCHAIN_LIST))
|
||||
$(call ndk_log,Using target toolchain '$(TARGET_TOOLCHAIN)' for '$(TARGET_ARCH_ABI)' ABI)
|
||||
else # NDK_TOOLCHAIN is not empty
|
||||
TARGET_TOOLCHAIN_LIST := $(strip $(filter $(NDK_TOOLCHAIN),$(NDK_ABI.$(TARGET_ARCH_ABI).toolchains)))
|
||||
ifndef TARGET_TOOLCHAIN_LIST
|
||||
$(call __ndk_info,The selected toolchain ($(NDK_TOOLCHAIN)) does not support the $(TARGET_ARCH_ABI) ABI.)
|
||||
$(call __ndk_info,Please modify the APP_ABI definition in $(NDK_APP_APPLICATION_MK) to use)
|
||||
$(call __ndk_info,a set of the following values: $(NDK_TOOLCHAIN.$(NDK_TOOLCHAIN).abis))
|
||||
$(call __ndk_info,Or change your NDK_TOOLCHAIN definition.)
|
||||
$(call __ndk_error,Aborting)
|
||||
endif
|
||||
TARGET_TOOLCHAIN := $(NDK_TOOLCHAIN)
|
||||
endif # NDK_TOOLCHAIN is not empty
|
||||
|
||||
TARGET_ABI := $(TARGET_PLATFORM)-$(TARGET_ARCH_ABI)
|
||||
|
||||
# setup sysroot-related variables. The SYSROOT point to a directory
|
||||
# that contains all public header files for a given platform, plus
|
||||
# some libraries and object files used for linking the generated
|
||||
# target files properly.
|
||||
#
|
||||
SYSROOT := $(NDK_PLATFORMS_ROOT)/$(TARGET_PLATFORM)/arch-$(TARGET_ARCH)
|
||||
|
||||
TARGET_CRTBEGIN_STATIC_O := $(SYSROOT)/usr/lib/crtbegin_static.o
|
||||
TARGET_CRTBEGIN_DYNAMIC_O := $(SYSROOT)/usr/lib/crtbegin_dynamic.o
|
||||
TARGET_CRTEND_O := $(SYSROOT)/usr/lib/crtend_android.o
|
||||
|
||||
# crtbegin_so.o and crtend_so.o are not available for all platforms, so
|
||||
# only define them if they are in the sysroot
|
||||
#
|
||||
TARGET_CRTBEGIN_SO_O := $(strip $(wildcard $(SYSROOT)/usr/lib/crtbegin_so.o))
|
||||
TARGET_CRTEND_SO_O := $(strip $(wildcard $(SYSROOT)/usr/lib/crtend_so.o))
|
||||
|
||||
TARGET_PREBUILT_SHARED_LIBRARIES :=
|
||||
|
||||
# Define default values for TOOLCHAIN_NAME, this can be overriden in
|
||||
# the setup file.
|
||||
TOOLCHAIN_NAME := $(TARGET_TOOLCHAIN)
|
||||
|
||||
# Define the root path of the toolchain in the NDK tree.
|
||||
TOOLCHAIN_ROOT := $(NDK_ROOT)/toolchains/$(TOOLCHAIN_NAME)
|
||||
|
||||
# Define the root path where toolchain prebuilts are stored
|
||||
TOOLCHAIN_PREBUILT_ROOT := $(TOOLCHAIN_ROOT)/prebuilt/$(HOST_TAG)
|
||||
|
||||
# Do the same for TOOLCHAIN_PREFIX. Note that we must chop the version
|
||||
# number from the toolchain name, e.g. arm-eabi-4.4.0 -> path/bin/arm-eabi-
|
||||
# to do that, we split at dashes, remove the last element, then merge the
|
||||
# result. Finally, add the complete path prefix.
|
||||
#
|
||||
TOOLCHAIN_PREFIX := $(call merge,-,$(call chop,$(call split,-,$(TOOLCHAIN_NAME))))-
|
||||
TOOLCHAIN_PREFIX := $(TOOLCHAIN_PREBUILT_ROOT)/bin/$(TOOLCHAIN_PREFIX)
|
||||
|
||||
# Default build commands, can be overriden by the toolchain's setup script
|
||||
include $(BUILD_SYSTEM)/default-build-commands.mk
|
||||
|
||||
# now call the toolchain-specific setup script
|
||||
include $(NDK_TOOLCHAIN.$(TARGET_TOOLCHAIN).setup)
|
||||
|
||||
# We expect the gdbserver binary for this toolchain to be located at its root.
|
||||
TARGET_GDBSERVER := $(TOOLCHAIN_ROOT)/prebuilt/gdbserver
|
||||
|
||||
# compute NDK_APP_DST_DIR as the destination directory for the generated files
|
||||
NDK_APP_DST_DIR := $(NDK_APP_PROJECT_PATH)/libs/$(TARGET_ARCH_ABI)
|
||||
|
||||
clean-installed-binaries::
|
||||
|
||||
# Ensure that for debuggable applications, gdbserver will be copied to
|
||||
# the proper location
|
||||
ifeq ($(NDK_APP_DEBUGGABLE),true)
|
||||
|
||||
NDK_APP_GDBSERVER := $(NDK_APP_DST_DIR)/gdbserver
|
||||
|
||||
installed_modules: $(NDK_APP_GDBSERVER)
|
||||
|
||||
$(NDK_APP_GDBSERVER): PRIVATE_NAME := $(TOOLCHAIN_NAME)
|
||||
$(NDK_APP_GDBSERVER): PRIVATE_SRC := $(TARGET_GDBSERVER)
|
||||
$(NDK_APP_GDBSERVER): PRIVATE_DST_DIR := $(NDK_APP_DST_DIR)
|
||||
$(NDK_APP_GDBSERVER): PRIVATE_DST := $(NDK_APP_GDBSERVER)
|
||||
|
||||
$(NDK_APP_GDBSERVER): clean-installed-binaries
|
||||
@ $(HOST_ECHO) "Gdbserver : [$(PRIVATE_NAME)] $(call pretty-dir,$(PRIVATE_DST))"
|
||||
$(hide) $(call host-mkdir,$(PRIVATE_DST_DIR))
|
||||
$(hide) $(call host-install,$(PRIVATE_SRC),$(PRIVATE_DST))
|
||||
|
||||
NDK_APP_GDBSETUP := $(NDK_APP_DST_DIR)/gdb.setup
|
||||
installed_modules: $(NDK_APP_GDBSETUP)
|
||||
|
||||
$(NDK_APP_GDBSETUP): PRIVATE_DST := $(NDK_APP_GDBSETUP)
|
||||
$(NDK_APP_GDBSETUP): PRIVATE_DST_DIR := $(NDK_APP_DST_DIR)
|
||||
$(NDK_APP_GDBSETUP): PRIVATE_SOLIB_PATH := $(TARGET_OUT)
|
||||
$(NDK_APP_GDBSETUP): PRIVATE_SRC_DIRS := $(SYSROOT)/usr/include
|
||||
|
||||
$(NDK_APP_GDBSETUP):
|
||||
@ $(HOST_ECHO) "Gdbsetup : $(call pretty-dir,$(PRIVATE_DST))"
|
||||
$(hide) $(call host-mkdir,$(PRIVATE_DST_DIR))
|
||||
$(hide) $(HOST_ECHO) "set solib-search-path $(call host-path,$(PRIVATE_SOLIB_PATH))" > $(PRIVATE_DST)
|
||||
$(hide) $(HOST_ECHO) "directory $(call host-path,$(call remove-duplicates,$(PRIVATE_SRC_DIRS)))" >> $(PRIVATE_DST)
|
||||
|
||||
# This prevents parallel execution to clear gdb.setup after it has been written to
|
||||
$(NDK_APP_GDBSETUP): clean-installed-binaries
|
||||
endif
|
||||
|
||||
# free the dictionary of LOCAL_MODULE definitions
|
||||
$(call modules-clear)
|
||||
|
||||
$(call ndk-stl-select,$(NDK_APP_STL))
|
||||
|
||||
# now parse the Android.mk for the application, this records all
|
||||
# module declarations, but does not populate the dependency graph yet.
|
||||
include $(NDK_APP_BUILD_SCRIPT)
|
||||
|
||||
$(call ndk-stl-add-dependencies,$(NDK_APP_STL))
|
||||
|
||||
# recompute all dependencies between modules
|
||||
$(call modules-compute-dependencies)
|
||||
|
||||
# for debugging purpose
|
||||
ifdef NDK_DEBUG_MODULES
|
||||
$(call modules-dump-database)
|
||||
endif
|
||||
|
||||
# now, really build the modules, the second pass allows one to deal
|
||||
# with exported values
|
||||
$(foreach __pass2_module,$(__ndk_modules),\
|
||||
$(eval LOCAL_MODULE := $(__pass2_module))\
|
||||
$(eval include $(BUILD_SYSTEM)/build-binary.mk)\
|
||||
)
|
||||
|
||||
# Now compute the closure of all module dependencies.
|
||||
#
|
||||
# If APP_MODULES is not defined in the Application.mk, we
|
||||
# will build all modules that were listed from the top-level Android.mk
|
||||
# and the installable imported ones they depend on
|
||||
#
|
||||
ifeq ($(strip $(NDK_APP_MODULES)),)
|
||||
WANTED_MODULES := $(call modules-get-all-installable,$(modules-get-top-list))
|
||||
else
|
||||
WANTED_MODULES := $(call module-get-all-dependencies,$(NDK_APP_MODULES))
|
||||
endif
|
||||
|
||||
WANTED_INSTALLED_MODULES += $(call map,module-get-installed,$(WANTED_MODULES))
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user