nir: add support for gather offsets
[mesa.git] / src / compiler / Android.glsl.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 glsl 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 LOCAL_SRC_FILES := $(LOCAL_SRC_FILES)
33
34 LOCAL_C_INCLUDES += \
35 $(intermediates)/glsl \
36 $(intermediates)/glsl/glcpp \
37 $(LOCAL_PATH)/glsl \
38 $(LOCAL_PATH)/glsl/glcpp
39
40 LOCAL_GENERATED_SOURCES += $(addprefix $(intermediates)/, \
41 $(LIBGLCPP_GENERATED_FILES) \
42 $(LIBGLSL_GENERATED_FILES))
43
44 LOCAL_EXPORT_C_INCLUDE_DIRS += \
45 $(intermediates)/glsl
46
47 # Modules using libmesa_nir must set LOCAL_GENERATED_SOURCES to this
48 MESA_GEN_GLSL_H := $(addprefix $(call local-generated-sources-dir)/, \
49 glsl/ir_expression_operation.h \
50 glsl/ir_expression_operation_constant.h \
51 glsl/ir_expression_operation_strings.h)
52
53 define local-l-or-ll-to-c-or-cpp
54 @mkdir -p $(dir $@)
55 @echo "Mesa Lex: $(PRIVATE_MODULE) <= $<"
56 $(hide) $(LEX) --nounistd -o$@ $<
57 endef
58
59 define glsl_local-y-to-c-and-h
60 @mkdir -p $(dir $@)
61 @echo "Mesa Yacc: $(PRIVATE_MODULE) <= $<"
62 $(hide) $(YACC) -o $@ -p "glcpp_parser_" $<
63 endef
64
65 YACC_HEADER_SUFFIX := .hpp
66
67 define local-yy-to-cpp-and-h
68 @mkdir -p $(dir $@)
69 @echo "Mesa Yacc: $(PRIVATE_MODULE) <= $<"
70 $(hide) $(YACC) -p "_mesa_glsl_" -o $@ $<
71 touch $(@:$1=$(YACC_HEADER_SUFFIX))
72 echo '#ifndef '$(@F:$1=_h) > $(@:$1=.h)
73 echo '#define '$(@F:$1=_h) >> $(@:$1=.h)
74 cat $(@:$1=$(YACC_HEADER_SUFFIX)) >> $(@:$1=.h)
75 echo '#endif' >> $(@:$1=.h)
76 rm -f $(@:$1=$(YACC_HEADER_SUFFIX))
77 endef
78
79 $(intermediates)/glsl/glsl_lexer.cpp: $(LOCAL_PATH)/glsl/glsl_lexer.ll
80 $(call local-l-or-ll-to-c-or-cpp)
81
82 $(intermediates)/glsl/glsl_parser.cpp: $(LOCAL_PATH)/glsl/glsl_parser.yy
83 $(call local-yy-to-cpp-and-h,.cpp)
84
85 $(intermediates)/glsl/glsl_parser.h: $(intermediates)/glsl/glsl_parser.cpp
86
87 $(intermediates)/glsl/glcpp/glcpp-lex.c: $(LOCAL_PATH)/glsl/glcpp/glcpp-lex.l
88 $(call local-l-or-ll-to-c-or-cpp)
89
90 $(intermediates)/glsl/glcpp/glcpp-parse.c: $(LOCAL_PATH)/glsl/glcpp/glcpp-parse.y
91 $(call glsl_local-y-to-c-and-h)
92
93 $(LOCAL_PATH)/glsl/ir.h: $(intermediates)/glsl/ir_expression_operation.h
94
95 $(intermediates)/glsl/ir_expression_operation.h: $(LOCAL_PATH)/glsl/ir_expression_operation.py
96 @mkdir -p $(dir $@)
97 $(hide) $(MESA_PYTHON2) $< enum > $@
98
99 $(intermediates)/glsl/ir_expression_operation_constant.h: $(LOCAL_PATH)/glsl/ir_expression_operation.py
100 @mkdir -p $(dir $@)
101 $(hide) $(MESA_PYTHON2) $< constant > $@
102
103 $(intermediates)/glsl/ir_expression_operation_strings.h: $(LOCAL_PATH)/glsl/ir_expression_operation.py
104 @mkdir -p $(dir $@)
105 $(hide) $(MESA_PYTHON2) $< strings > $@
106
107 $(intermediates)/glsl/float64_glsl.h: $(LOCAL_PATH)/glsl/xxd.py
108 @mkdir -p $(dir $@)
109 $(hide) $(MESA_PYTHON2) $< $(MESA_TOP)/src/compiler/glsl/float64.glsl $@ -n float64_source > $@