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