Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 1 | # Only build if BUILD_RENDERSCRIPT is defined to true in the environment. |
| 2 | ifeq ($(BUILD_RENDERSCRIPT),true) |
| 3 | |
| 4 | TOP_LOCAL_PATH:=$(call my-dir) |
Jack Palevich | bfdc92c | 2009-05-26 13:45:08 -0700 | [diff] [blame] | 5 | include $(CLEAR_VARS) |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 6 | LOCAL_PATH:= $(TOP_LOCAL_PATH) |
| 7 | |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 8 | # Build rsg-generator |
| 9 | |
| 10 | LOCAL_MODULE := rsg-generator |
| 11 | |
| 12 | # These symbols are normally defined by BUILD_XXX, but we need to define them |
| 13 | # here so that local-intermediates-dir works. |
| 14 | |
| 15 | LOCAL_IS_HOST_MODULE := true |
| 16 | LOCAL_MODULE_CLASS := EXECUTABLES |
| 17 | intermediates:= $(local-intermediates-dir) |
| 18 | |
| 19 | GEN := $(addprefix $(intermediates)/, \ |
| 20 | lex.yy.c \ |
| 21 | ) |
| 22 | $(GEN): PRIVATE_CUSTOM_TOOL = flex -o $@ $< |
| 23 | |
| 24 | $(intermediates)/lex.yy.c : $(LOCAL_PATH)/spec.lex |
| 25 | $(transform-generated-source) |
| 26 | |
| 27 | $(LOCAL_PATH)/rsg_generator.c : $(intermediates)/lex.yy.c |
| 28 | |
| 29 | LOCAL_SRC_FILES:= \ |
| 30 | rsg_generator.c |
| 31 | |
| 32 | include $(BUILD_HOST_EXECUTABLE) |
| 33 | |
| 34 | RSG_GENERATOR:=$(LOCAL_BUILT_MODULE) |
| 35 | |
| 36 | # Build render script lib |
| 37 | |
| 38 | include $(CLEAR_VARS) |
| 39 | LOCAL_MODULE := libRS |
| 40 | |
| 41 | LOCAL_MODULE_CLASS := SHARED_LIBRARIES |
| 42 | intermediates:= $(local-intermediates-dir) |
| 43 | |
| 44 | RS_GENERATED_INCLUDE_DIR:=$(intermediates) |
| 45 | |
| 46 | # Generate custom headers |
| 47 | |
| 48 | GEN := $(addprefix $(intermediates)/, \ |
| 49 | rsgApiStructs.h \ |
| 50 | rsgApiFuncDecl.h \ |
| 51 | ) |
| 52 | |
Jack Palevich | bfdc92c | 2009-05-26 13:45:08 -0700 | [diff] [blame] | 53 | $(GEN) : PRIVATE_CUSTOM_TOOL = $(RSG_GENERATOR) $< $@ <$(TOP_LOCAL_PATH)/rs.spec |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 54 | $(GEN) : $(RSG_GENERATOR) $(LOCAL_PATH)/rs.spec |
| 55 | $(GEN): $(intermediates)/%.h : $(LOCAL_PATH)/%.h.rsg |
| 56 | $(transform-generated-source) |
Jack Palevich | a5e094b | 2009-05-26 17:23:34 -0700 | [diff] [blame^] | 57 | |
| 58 | RS_GENERATED_SOURCES += $(GEN) |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 59 | LOCAL_GENERATED_SOURCES += $(GEN) |
| 60 | |
| 61 | # Generate custom source files |
| 62 | |
| 63 | GEN := $(addprefix $(intermediates)/, \ |
| 64 | rsgApi.cpp \ |
| 65 | rsgApiReplay.cpp \ |
| 66 | ) |
Jack Palevich | a5e094b | 2009-05-26 17:23:34 -0700 | [diff] [blame^] | 67 | |
Jack Palevich | bfdc92c | 2009-05-26 13:45:08 -0700 | [diff] [blame] | 68 | $(GEN) : PRIVATE_CUSTOM_TOOL = $(RSG_GENERATOR) $< $@ <$(TOP_LOCAL_PATH)/rs.spec |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 69 | $(GEN) : $(RSG_GENERATOR) $(LOCAL_PATH)/rs.spec |
| 70 | $(GEN): $(intermediates)/%.cpp : $(LOCAL_PATH)/%.cpp.rsg |
| 71 | $(transform-generated-source) |
Jack Palevich | a5e094b | 2009-05-26 17:23:34 -0700 | [diff] [blame^] | 72 | |
| 73 | RS_GENERATED_SOURCES += $(GEN) |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 74 | LOCAL_GENERATED_SOURCES += $(GEN) |
| 75 | |
| 76 | LOCAL_SRC_FILES:= \ |
| 77 | rsAdapter.cpp \ |
| 78 | rsAllocation.cpp \ |
| 79 | rsComponent.cpp \ |
| 80 | rsContext.cpp \ |
| 81 | rsDevice.cpp \ |
| 82 | rsElement.cpp \ |
| 83 | rsLocklessFifo.cpp \ |
| 84 | rsObjectBase.cpp \ |
| 85 | rsMatrix.cpp \ |
| 86 | rsProgram.cpp \ |
| 87 | rsProgramFragment.cpp \ |
| 88 | rsProgramFragmentStore.cpp \ |
| 89 | rsProgramVertex.cpp \ |
| 90 | rsSampler.cpp \ |
| 91 | rsScript.cpp \ |
| 92 | rsScriptC.cpp \ |
| 93 | rsThreadIO.cpp \ |
| 94 | rsType.cpp \ |
| 95 | rsTriangleMesh.cpp |
| 96 | |
| 97 | LOCAL_SHARED_LIBRARIES += libcutils libutils libEGL libGLESv1_CM libui |
| 98 | LOCAL_LDLIBS := -lpthread -ldl |
| 99 | LOCAL_MODULE:= libRS |
| 100 | |
| 101 | #LOCAL_MODULE_TAGS := tests |
| 102 | |
| 103 | include $(BUILD_SHARED_LIBRARY) |
| 104 | |
| 105 | # Build JNI library |
| 106 | |
| 107 | LOCAL_PATH:= $(TOP_LOCAL_PATH)/jni |
| 108 | include $(CLEAR_VARS) |
| 109 | |
| 110 | LOCAL_SRC_FILES:= \ |
| 111 | RenderScript_jni.cpp |
| 112 | |
| 113 | LOCAL_SHARED_LIBRARIES := \ |
| 114 | libandroid_runtime \ |
| 115 | libnativehelper \ |
| 116 | libRS \ |
| 117 | libcutils \ |
| 118 | libutils \ |
| 119 | libui |
| 120 | |
| 121 | LOCAL_STATIC_LIBRARIES := |
| 122 | |
| 123 | LOCAL_C_INCLUDES += \ |
| 124 | $(JNI_H_INCLUDE) \ |
| 125 | $(RS_GENERATED_INCLUDE_DIR) \ |
| 126 | $(call include-path-for, corecg graphics) |
| 127 | |
| 128 | LOCAL_CFLAGS += |
| 129 | |
| 130 | LOCAL_LDLIBS := -lpthread |
| 131 | |
| 132 | LOCAL_MODULE:= libRS_jni |
| 133 | |
Jack Palevich | a5e094b | 2009-05-26 17:23:34 -0700 | [diff] [blame^] | 134 | LOCAL_ADDITIONAL_DEPENDENCIES += $(RS_GENERATED_SOURCES) |
| 135 | |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 136 | include $(BUILD_SHARED_LIBRARY) |
| 137 | |
Jack Palevich | bfdc92c | 2009-05-26 13:45:08 -0700 | [diff] [blame] | 138 | include $(call all-subdir-makefiles) |
| 139 | endif # BUILD_RENDERSCRIPT |