android: add marshal_generated c and h files to generated sources
[mesa.git] / src / mesa / Android.gen.mk
1 # Mesa 3-D graphics library
2 #
3 # Copyright (C) 2010-2011 Chia-I Wu <olvaffe@gmail.com>
4 # Copyright (C) 2010-2011 LunarG Inc.
5 #
6 # Permission is hereby granted, free of charge, to any person obtaining a
7 # copy of this software and associated documentation files (the "Software"),
8 # to deal in the Software without restriction, including without limitation
9 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 # and/or sell copies of the Software, and to permit persons to whom the
11 # Software is furnished to do so, subject to the following conditions:
12 #
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 # DEALINGS IN THE SOFTWARE.
23
24 # included by core mesa Android.mk for source generation
25
26 ifeq ($(LOCAL_MODULE_CLASS),)
27 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
28 endif
29
30 intermediates := $(call local-generated-sources-dir)
31
32 # This is the list of auto-generated files: sources and headers
33 sources := \
34 main/enums.c \
35 main/api_exec.c \
36 main/dispatch.h \
37 main/format_pack.c \
38 main/format_unpack.c \
39 main/format_info.h \
40 main/remap_helper.h \
41 main/get_hash.h \
42 main/marshal_generated.c \
43 main/marshal_generated.h
44
45 LOCAL_SRC_FILES := $(filter-out $(sources), $(LOCAL_SRC_FILES))
46
47 LOCAL_C_INCLUDES += $(intermediates)/main
48
49 ifeq ($(strip $(MESA_ENABLE_ASM)),true)
50 ifeq ($(TARGET_ARCH),x86)
51 sources += x86/matypes.h
52 LOCAL_C_INCLUDES += $(intermediates)/x86
53 endif
54 endif
55
56 sources += main/git_sha1.h
57
58 sources := $(addprefix $(intermediates)/, $(sources))
59
60 LOCAL_GENERATED_SOURCES += $(sources)
61
62 glapi := $(MESA_TOP)/src/mapi/glapi/gen
63
64 dispatch_deps := \
65 $(wildcard $(glapi)/*.py) \
66 $(wildcard $(glapi)/*.xml)
67
68 define es-gen
69 @mkdir -p $(dir $@)
70 @echo "Gen ES: $(PRIVATE_MODULE) <= $(notdir $(@))"
71 $(hide) $(PRIVATE_SCRIPT) $(1) $(PRIVATE_XML) > $@
72 endef
73
74 $(intermediates)/main/git_sha1.h:
75 @mkdir -p $(dir $@)
76 @echo "GIT-SHA1: $(PRIVATE_MODULE) <= git"
77 $(hide) touch $@
78 $(hide) if which git > /dev/null; then \
79 git --git-dir $(PRIVATE_PATH)/../../.git log -n 1 --oneline | \
80 sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \
81 > $@; \
82 fi
83
84 matypes_deps := \
85 $(BUILD_OUT_EXECUTABLES)/mesa_gen_matypes$(BUILD_EXECUTABLE_SUFFIX) \
86 $(LOCAL_PATH)/main/mtypes.h \
87 $(LOCAL_PATH)/tnl/t_context.h
88
89 $(intermediates)/x86/matypes.h: $(matypes_deps)
90 @mkdir -p $(dir $@)
91 @echo "MATYPES: $(PRIVATE_MODULE) <= $(notdir $@)"
92 $(hide) $< > $@
93
94 $(intermediates)/main/dispatch.h: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(glapi)/gl_table.py
95 $(intermediates)/main/dispatch.h: PRIVATE_XML := -f $(glapi)/gl_and_es_API.xml
96
97 $(intermediates)/main/dispatch.h: $(dispatch_deps)
98 $(call es-gen, $* -m remap_table)
99
100 $(intermediates)/main/remap_helper.h: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(glapi)/remap_helper.py
101 $(intermediates)/main/remap_helper.h: PRIVATE_XML := -f $(glapi)/gl_and_es_API.xml
102
103 $(intermediates)/main/remap_helper.h: $(dispatch_deps)
104 $(call es-gen, $*)
105
106 $(intermediates)/main/enums.c: PRIVATE_SCRIPT :=$(MESA_PYTHON2) $(glapi)/gl_enums.py
107 $(intermediates)/main/enums.c: PRIVATE_XML := -f $(glapi)/../registry/gl.xml
108
109 $(intermediates)/main/enums.c: $(dispatch_deps)
110 $(call es-gen)
111
112 $(intermediates)/main/api_exec.c: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(glapi)/gl_genexec.py
113 $(intermediates)/main/api_exec.c: PRIVATE_XML := -f $(glapi)/gl_and_es_API.xml
114
115 $(intermediates)/main/api_exec.c: $(dispatch_deps)
116 $(call es-gen)
117
118 $(intermediates)/main/marshal_generated.c: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(glapi)/gl_marshal.py
119 $(intermediates)/main/marshal_generated.c: PRIVATE_XML := -f $(glapi)/gl_and_es_API.xml
120
121 $(intermediates)/main/marshal_generated.c: $(dispatch_deps)
122 $(call es-gen)
123
124 $(intermediates)/main/marshal_generated.h: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(glapi)/gl_marshal_h.py
125 $(intermediates)/main/marshal_generated.h: PRIVATE_XML := -f $(glapi)/gl_and_es_API.xml
126
127 $(intermediates)/main/marshal_generated.h: $(dispatch_deps)
128 $(call es-gen)
129
130 GET_HASH_GEN := $(LOCAL_PATH)/main/get_hash_generator.py
131
132 $(intermediates)/main/get_hash.h: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(GET_HASH_GEN)
133 $(intermediates)/main/get_hash.h: PRIVATE_XML := -f $(glapi)/gl_and_es_API.xml
134 $(intermediates)/main/get_hash.h: $(glapi)/gl_and_es_API.xml \
135 $(LOCAL_PATH)/main/get_hash_params.py $(GET_HASH_GEN)
136 $(call es-gen)
137
138 FORMAT_INFO := $(LOCAL_PATH)/main/format_info.py
139 format_info_deps := \
140 $(LOCAL_PATH)/main/formats.csv \
141 $(LOCAL_PATH)/main/format_parser.py \
142 $(FORMAT_INFO)
143
144 $(intermediates)/main/format_info.h: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(FORMAT_INFO)
145 $(intermediates)/main/format_info.h: PRIVATE_XML :=
146 $(intermediates)/main/format_info.h: $(format_info_deps)
147 $(call es-gen, $<)
148
149 FORMAT_PACK := $(LOCAL_PATH)/main/format_pack.py
150 format_pack_deps := \
151 $(LOCAL_PATH)/main/formats.csv \
152 $(LOCAL_PATH)/main/format_parser.py \
153 $(FORMAT_PACK)
154
155 $(intermediates)/main/format_pack.c: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(FORMAT_PACK)
156 $(intermediates)/main/format_pack.c: PRIVATE_XML :=
157 $(intermediates)/main/format_pack.c: $(format_pack_deps)
158 $(call es-gen, $<)
159
160 FORMAT_UNPACK := $(LOCAL_PATH)/main/format_unpack.py
161 format_unpack_deps := \
162 $(LOCAL_PATH)/main/formats.csv \
163 $(LOCAL_PATH)/main/format_parser.py \
164 $(FORMAT_UNPACK)
165
166 $(intermediates)/main/format_unpack.c: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(FORMAT_UNPACK)
167 $(intermediates)/main/format_unpack.c: PRIVATE_XML :=
168 $(intermediates)/main/format_unpack.c: $(format_unpack_deps)
169 $(call es-gen, $<)