gbm: use the loader util lib
[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-intermediates-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/remap_helper.h \
38 main/get_hash.h
39
40 LOCAL_SRC_FILES := $(filter-out $(sources), $(LOCAL_SRC_FILES))
41
42 LOCAL_C_INCLUDES += $(intermediates)/main
43
44 ifeq ($(strip $(MESA_ENABLE_ASM)),true)
45 ifeq ($(TARGET_ARCH),x86)
46 sources += x86/matypes.h
47 LOCAL_C_INCLUDES += $(intermediates)/x86
48 endif
49 endif
50
51 sources += main/git_sha1.h
52
53 sources := $(addprefix $(intermediates)/, $(sources))
54
55 LOCAL_GENERATED_SOURCES += $(sources)
56
57 glapi := $(MESA_TOP)/src/mapi/glapi/gen
58
59 dispatch_deps := \
60 $(wildcard $(glapi)/*.py) \
61 $(wildcard $(glapi)/*.xml)
62
63 define es-gen
64 @mkdir -p $(dir $@)
65 @echo "Gen ES: $(PRIVATE_MODULE) <= $(notdir $(@))"
66 $(hide) $(PRIVATE_SCRIPT) $(1) $(PRIVATE_XML) > $@
67 endef
68
69 $(intermediates)/main/git_sha1.h:
70 @mkdir -p $(dir $@)
71 @echo "GIT-SHA1: $(PRIVATE_MODULE) <= git"
72 $(hide) touch $@
73 $(hide) if which git > /dev/null; then \
74 git --git-dir $(PRIVATE_PATH)/../../.git log -n 1 --oneline | \
75 sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \
76 > $@; \
77 fi
78
79 matypes_deps := \
80 $(BUILD_OUT_EXECUTABLES)/mesa_gen_matypes$(BUILD_EXECUTABLE_SUFFIX) \
81 $(LOCAL_PATH)/main/mtypes.h \
82 $(LOCAL_PATH)/tnl/t_context.h
83
84 $(intermediates)/x86/matypes.h: $(matypes_deps)
85 @mkdir -p $(dir $@)
86 @echo "MATYPES: $(PRIVATE_MODULE) <= $(notdir $@)"
87 $(hide) $< > $@
88
89 $(intermediates)/main/dispatch.h: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(glapi)/gl_table.py
90 $(intermediates)/main/dispatch.h: PRIVATE_XML := -f $(glapi)/gl_and_es_API.xml
91
92 $(intermediates)/main/dispatch.h: $(dispatch_deps)
93 $(call es-gen, $* -m remap_table)
94
95 $(intermediates)/main/remap_helper.h: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(glapi)/remap_helper.py
96 $(intermediates)/main/remap_helper.h: PRIVATE_XML := -f $(glapi)/gl_and_es_API.xml
97
98 $(intermediates)/main/remap_helper.h: $(dispatch_deps)
99 $(call es-gen, $*)
100
101 $(intermediates)/main/enums.c: PRIVATE_SCRIPT :=$(MESA_PYTHON2) $(glapi)/gl_enums.py
102 $(intermediates)/main/enums.c: PRIVATE_XML := -f $(glapi)/gl_and_es_API.xml
103
104 $(intermediates)/main/enums.c: $(dispatch_deps)
105 $(call es-gen)
106
107 $(intermediates)/main/api_exec.c: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(glapi)/gl_genexec.py
108 $(intermediates)/main/api_exec.c: PRIVATE_XML := -f $(glapi)/gl_and_es_API.xml
109
110 $(intermediates)/main/api_exec.c: $(dispatch_deps)
111 $(call es-gen)
112
113 GET_HASH_GEN := $(LOCAL_PATH)/main/get_hash_generator.py
114
115 $(intermediates)/main/get_hash.h: $(glapi)/gl_and_es_API.xml \
116 $(LOCAL_PATH)/main/get_hash_params.py $(GET_HASH_GEN)
117 @$(MESA_PYTHON2) $(GET_HASH_GEN) -f $< > $@