2 # This file helps integrate apitrace into FirefoxOS - when apitrace
3 # sources are put in B2GROOT/external/apitrace (including this Android.mk
4 # file), then the B2G build system will pick apitrace automatically and
5 # compile and install it into the system images seamlessly.
7 # This may work in other than FirefoxOS environments, but has not been tested.
10 LOCAL_PATH := $(call my-dir)
14 LOCAL_MODULE := egltrace
15 LOCAL_MODULE_TAGS := debug eng
17 include $(BUILD_SHARED_LIBRARY)
19 # Below we hook the process of configuring and compiling apitrace,
20 # described in INSTALL.markdown (but we use the FirefoxOS's NDK). We override
21 # the $(linked_module): targed, which is already defined by
22 # $(BUILD_SHARED_LIBRARY) - by default it would want to compile the
23 # library out of some source files.
24 # We also override the target $(LOCAL_INSTALLED_MODULE): which installs
25 # the shared library because we want it installed in
26 # /lib/apitrace/wrappers/egltrace.so instead of /lib/egltrace.so because
27 # /bin/apitrace searches for the library in that directory.
28 # The rules will end up with /lib/apitrace/wrappers/egltrace.so and
29 # /bin/apitrace inside system.img.
30 MY_APITRACE_ROOT := $(TOPDIR)external/apitrace
31 MY_APITRACE_BUILD_ROOT_HOST := out/host/apitrace
32 MY_APITRACE_BUILD_ROOT_TARGET := out/target/apitrace
34 apitrace_private_target:
35 $(hide) # apitrace: run cmake for the host if it has not been run
36 $(hide) if [ ! -e $(MY_APITRACE_BUILD_ROOT_HOST)/Makefile ] ; then \
37 cd $(MY_APITRACE_ROOT) && \
38 cmake -H. -B../../$(MY_APITRACE_BUILD_ROOT_HOST) ; \
40 $(hide) # apitrace: compile for the host
41 $(hide) make -C $(MY_APITRACE_BUILD_ROOT_HOST)
42 $(hide) # apitrace: run cmake for android if it has not been run
43 $(hide) if [ ! -e $(MY_APITRACE_BUILD_ROOT_TARGET)/Makefile ] ; then \
44 cd $(MY_APITRACE_ROOT) && \
46 -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain/android.toolchain.cmake \
47 -DANDROID_NDK=../../prebuilt/ndk/android-ndk-r7 \
48 -DANDROID_NDK_LAYOUT=LINARO \
49 -DANDROID_API_LEVEL=9 \
50 -DANDROID_NO_UNDEFINED=OFF \
51 -DLIBRARY_OUTPUT_PATH_ROOT=../../$(MY_APITRACE_BUILD_ROOT_TARGET) \
52 -H. -B../../$(MY_APITRACE_BUILD_ROOT_TARGET) ; \
54 $(hide) # apitrace: compile for android
55 $(hide) make -C $(MY_APITRACE_BUILD_ROOT_TARGET)
57 $(linked_module): apitrace_private_target
58 $(hide) # apitrace: copy egltrace lib to where the build system expects it
59 $(hide) mkdir -p $(dir $@)
60 $(hide) cp $(MY_APITRACE_BUILD_ROOT_TARGET)/libs/*/egltrace$(TARGET_SHLIB_SUFFIX) $@
62 $(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE) | $(ACP)
63 @echo "Install (overridden): $@"
64 @mkdir -p $(dir $@)/apitrace/wrappers
65 $(hide) $(ACP) -fp $< $(dir $@)/apitrace/wrappers/egltrace$(TARGET_SHLIB_SUFFIX)
71 LOCAL_MODULE := apitrace
72 LOCAL_MODULE_TAGS := debug eng
74 include $(BUILD_EXECUTABLE)
76 $(linked_module): apitrace_private_target
77 $(hide) # apitrace: copy apitrace executable to where the build system expects it
78 $(hide) mkdir -p $(dir $@)
79 $(hide) cp $(MY_APITRACE_BUILD_ROOT_TARGET)/apitrace$(TARGET_EXECUTABLE_SUFFIX) $@