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# definitions shared by host_executable.make and host_static_library.make
17#
18
19# the directory where we're going to place our object files
20LOCAL_OBJS_DIR  := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE))
21LOCAL_OBJECTS   :=
22LOCAL_CC        ?= $(CC)
23LOCAL_C_SOURCES := $(filter  %.c,$(LOCAL_SRC_FILES))
24LOCAL_GENERATED_C_SOURCES := $(filter %.c,$(LOCAL_GENERATED_SOURCES))
25LOCAL_CXX_SOURCES := $(filter %$(LOCAL_CPP_EXTENSION),$(LOCAL_SRC_FILES) $(LOCAL_GENERATED_SOURCES))
26LOCAL_OBJC_SOURCES := $(filter %.m,$(LOCAL_SRC_FILES) $(LOCAL_GENERATED_SOURCES))
27
28LOCAL_CFLAGS := $(strip $(patsubst %,-I%,$(LOCAL_C_INCLUDES)) $(LOCAL_CFLAGS))
29
30$(foreach src,$(LOCAL_C_SOURCES), \
31    $(eval $(call compile-c-source,$(src))) \
32)
33
34$(foreach src,$(LOCAL_GENERATED_C_SOURCES), \
35    $(eval $(call compile-generated-c-source,$(src))) \
36)
37
38$(foreach src,$(LOCAL_CXX_SOURCES), \
39    $(eval $(call compile-cxx-source,$(src))) \
40)
41
42$(foreach src,$(LOCAL_OBJC_SOURCES), \
43    $(eval $(call compile-objc-source,$(src))) \
44)
45
46# Ensure that we build all generated sources before the objects
47$(LOCAL_OBJECTS): | $(LOCAL_GENERATED_SOURCES)
48
49CLEAN_OBJS_DIRS += $(LOCAL_OBJS_DIR)
50