build-module.mk revision 48ef1859ef0bb25547e5aceeedb9b175c6193bc5
1# Copyright (C) 2008 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14# 15 16# 17# Base rules shared to control the build of all modules. 18# This should be included from build-binary.mk 19# 20 21$(call assert-defined,LOCAL_MODULE_CLASS LOCAL_BUILD_SCRIPT LOCAL_BUILT_MODULE) 22 23# Check LOCAL_IS_HOST_MODULE and define 'my' as either HOST_ or TARGET_ 24# 25LOCAL_IS_HOST_MODULE := $(strip $(LOCAL_IS_HOST_MODULE)) 26ifdef LOCAL_IS_HOST_MODULE 27 ifneq ($(LOCAL_IS_HOST_MODULE),true) 28 $(call __ndk_log,$(LOCAL_PATH): LOCAL_IS_HOST_MODULE must be "true" or empty, not "$(LOCAL_IS_HOST_MODULE)") 29 endif 30 my := HOST_ 31else 32 my := TARGET_ 33endif 34 35# Compute 'intermediates' which is the location where we're going to store 36# intermediate generated files like object (.o) files. 37# 38intermediates := $($(my)OBJS) 39 40# LOCAL_INTERMEDIATES lists the targets that are generated by this module 41# 42LOCAL_INTERMEDIATES := $(LOCAL_BUILT_MODULE) 43 44# LOCAL_BUILD_MODE will be either arm or thumb 45# 46ifneq ($(NDK_APP_OPTIM),) 47 LOCAL_BUILD_MODE := $(NDK_APP_OPTIM) 48else 49 LOCAL_BUILD_MODE := thumb 50endif 51 52# 53# Ensure that 'make <module>' and 'make clean-<module>' work 54# 55.PHONY: $(LOCAL_MODULE) 56$(LOCAL_MODULE): $(LOCAL_BUILT_MODULE) 57 58cleantarget := clean-$(LOCAL_MODULE) 59.PHONY: $(cleantarget) 60clean: $(cleantarget) 61 62$(cleantarget): PRIVATE_MODULE := $(LOCAL_MODULE) 63$(cleantarget): PRIVATE_CLEAN_FILES := $(PRIVATE_CLEAN_FILES) \ 64 $(LOCAL_BUILT_MODULE) \ 65 $(LOCAL_INSTALLED_MODULE) \ 66 $(intermediates) 67 68$(cleantarget):: 69 @echo "Clean: $(PRIVATE_MODULE)" 70 $(hide) rm -rf $(PRIVATE_CLEAN_FILES) 71 72# 73# Register module 74# 75 76ALL_MODULES += $(LOCAL_MODULE) 77 78 79