host_executable.make revision df7881f07f53b041dc0568be8528e9dbb74994cc
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# first, call a library containing all object files
17include $(BUILD_HOST_STATIC_LIBRARY)
18
19# now, link the executable with it
20LOCAL_BUILT_LIBRARY := $(LOCAL_BUILT_MODULE)
21LOCAL_BUILT_MODULE := $(call executable-path,$(LOCAL_MODULE))
22
23LOCAL_LDLIBS := $(foreach lib,$(LOCAL_STATIC_LIBRARIES),$(call library-path,$(lib))) $(LOCAL_LDLIBS)
24
25$(LOCAL_BUILT_MODULE): PRIVATE_LDFLAGS := $(LDFLAGS) $(LOCAL_LDFLAGS)
26$(LOCAL_BUILT_MODULE): PRIVATE_LDLIBS  := $(LOCAL_LDLIBS)
27$(LOCAL_BUILT_MODULE): PRIVATE_LIBRARY := $(LOCAL_BUILT_LIBRARY)
28
29$(LOCAL_BUILT_MODULE): $(LOCAL_BUILT_LIBRARY)
30	@ mkdir -p $(dir $@)
31	@ echo "Executable: $@"
32	$(hide) $(LD) $(PRIVATE_LDFLAGS) -o $@ $(PRIVATE_LIBRARY) $(PRIVATE_LDLIBS)
33
34EXECUTABLES += $(LOCAL_BUILT_MODULE)
35$(LOCAL_BUILT_MODULE): $(foreach lib,$(LOCAL_STATIC_LIBRARIES),$(call library-path,$(lib)))
36
37