]> git.cworth.org Git - apitrace/blob - Android.mk
retrace: Implement glxCopySubBufferMESA
[apitrace] / Android.mk
1 #
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.
6 #
7 # This may work in other than FirefoxOS environments, but has not been tested.
8 #
9
10 NDK := prebuilt/ndk/android-ndk-r7
11
12 ifeq ($(shell which cmake),)
13 $(shell echo "CMake not found, will not compile apitrace" >&2)
14 else # cmake
15 ifeq ($(wildcard $(NDK)),)
16 $(shell echo "CMake present but NDK not found at $(abspath $(NDK)), will not compile apitrace" >&2)
17 else # NDK
18 $(shell echo "CMake and NDK ($(abspath $(NDK))) found, will compile apitrace" >&2)
19
20 LOCAL_PATH := $(call my-dir)
21
22 include $(CLEAR_VARS)
23
24 LOCAL_MODULE := egltrace
25 LOCAL_MODULE_TAGS := debug eng
26
27 include $(BUILD_SHARED_LIBRARY)
28
29 # Below we hook the process of configuring and compiling apitrace,
30 # described in INSTALL.markdown (but we use the FirefoxOS's NDK). We override
31 # the $(linked_module): targed, which is already defined by
32 # $(BUILD_SHARED_LIBRARY) - by default it would want to compile the
33 # library out of some source files.
34 # We also override the target $(LOCAL_INSTALLED_MODULE): which installs
35 # the shared library because we want it installed in
36 # /lib/apitrace/wrappers/egltrace.so instead of /lib/egltrace.so because
37 # /bin/apitrace searches for the library in that directory.
38 # The rules will end up with /lib/apitrace/wrappers/egltrace.so and
39 # /bin/apitrace inside system.img.
40 MY_APITRACE_ROOT := $(TOPDIR)external/apitrace
41 MY_APITRACE_BUILD_ROOT_HOST := out/host/apitrace
42 MY_APITRACE_BUILD_ROOT_TARGET := out/target/apitrace
43
44 apitrace_private_target:
45         $(hide) # apitrace: run cmake for the host if it has not been run
46         $(hide) if [ ! -e $(MY_APITRACE_BUILD_ROOT_HOST)/Makefile ] ; then \
47                 cd $(MY_APITRACE_ROOT) && \
48                 cmake -H. -B../../$(MY_APITRACE_BUILD_ROOT_HOST) ; \
49         fi
50         $(hide) # apitrace: compile for the host
51         $(hide) make -C $(MY_APITRACE_BUILD_ROOT_HOST)
52         $(hide) # apitrace: run cmake for android if it has not been run
53         $(hide) if [ ! -e $(MY_APITRACE_BUILD_ROOT_TARGET)/Makefile ] ; then \
54                 cd $(MY_APITRACE_ROOT) && \
55                 cmake \
56                 -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain/android.toolchain.cmake \
57                 -DANDROID_NDK=../../$(NDK) \
58                 -DANDROID_NDK_LAYOUT=LINARO \
59                 -DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.4.x \
60                 -DANDROID_API_LEVEL=9 \
61                 -DANDROID_NO_UNDEFINED=OFF \
62                 -DLIBRARY_OUTPUT_PATH_ROOT=../../$(MY_APITRACE_BUILD_ROOT_TARGET) \
63                 -H. -B../../$(MY_APITRACE_BUILD_ROOT_TARGET) ; \
64         fi
65         $(hide) # apitrace: compile for android
66         $(hide) make -C $(MY_APITRACE_BUILD_ROOT_TARGET)
67
68 $(linked_module): apitrace_private_target
69         $(hide) # apitrace: copy egltrace lib to where the build system expects it
70         $(hide) mkdir -p $(dir $@)
71         $(hide) cp $(MY_APITRACE_BUILD_ROOT_TARGET)/libs/*/egltrace$(TARGET_SHLIB_SUFFIX) $@
72
73 $(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE) | $(ACP)
74         @echo "Install (overridden): $@"
75         @mkdir -p $(dir $@)/apitrace/wrappers
76         $(hide) $(ACP) -fp $< $(dir $@)/apitrace/wrappers/egltrace$(TARGET_SHLIB_SUFFIX)
77
78 #
79
80 include $(CLEAR_VARS)
81
82 LOCAL_MODULE := apitrace
83 LOCAL_MODULE_TAGS := debug eng
84
85 include $(BUILD_EXECUTABLE)
86
87 $(linked_module): apitrace_private_target
88         $(hide) # apitrace: copy apitrace executable to where the build system expects it
89         $(hide) mkdir -p $(dir $@)
90         $(hide) cp $(MY_APITRACE_BUILD_ROOT_TARGET)/apitrace$(TARGET_EXECUTABLE_SUFFIX) $@
91
92 endif # NDK
93 endif # cmake