1 # Mesa 3-D graphics library
3 # Copyright (C) 2010-2011 Chia-I Wu <olvaffe@gmail.com>
4 # Copyright (C) 2010-2011 LunarG Inc.
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:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
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.
24 # included by glsl Android.mk for source generation
26 ifeq ($(LOCAL_MODULE_CLASS
),)
27 LOCAL_MODULE_CLASS
:= STATIC_LIBRARIES
30 intermediates
:= $(call local-generated-sources-dir
)
32 LOCAL_SRC_FILES
:= $(LOCAL_SRC_FILES
)
35 $(intermediates
)/glsl \
36 $(intermediates
)/glsl
/glcpp \
38 $(LOCAL_PATH
)/glsl
/glcpp
40 LOCAL_GENERATED_SOURCES
+= $(addprefix $(intermediates
)/, \
41 $(LIBGLCPP_GENERATED_FILES
) \
42 $(LIBGLSL_GENERATED_FILES
))
44 LOCAL_EXPORT_C_INCLUDE_DIRS
+= \
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
)
53 define local-l-or-ll-to-c-or-cpp
55 @echo
"Mesa Lex: $(PRIVATE_MODULE) <= $<"
56 $(hide
) $(LEX
) --nounistd
-o
$@
$<
59 define glsl_local-y-to-c-and-h
61 @echo
"Mesa Yacc: $(PRIVATE_MODULE) <= $<"
62 $(hide
) $(YACC
) -o
$@
-p
"glcpp_parser_" $<
65 YACC_HEADER_SUFFIX
:= .hpp
67 define local-yy-to-cpp-and-h
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
))
79 $(intermediates
)/glsl
/glsl_lexer.
cpp: $(LOCAL_PATH
)/glsl
/glsl_lexer.ll
80 $(call local-l-or-ll-to-c-or-cpp
)
82 $(intermediates
)/glsl
/glsl_parser.
cpp: $(LOCAL_PATH
)/glsl
/glsl_parser.yy
83 $(call local-yy-to-cpp-and-h
,.
cpp)
85 $(intermediates
)/glsl
/glsl_parser.h
: $(intermediates
)/glsl
/glsl_parser.
cpp
87 $(intermediates
)/glsl
/glcpp
/glcpp-lex.c
: $(LOCAL_PATH
)/glsl
/glcpp
/glcpp-lex.l
88 $(call local-l-or-ll-to-c-or-cpp
)
90 $(intermediates
)/glsl
/glcpp
/glcpp-parse.c
: $(LOCAL_PATH
)/glsl
/glcpp
/glcpp-parse.y
91 $(call glsl_local-y-to-c-and-h
)
93 $(LOCAL_PATH
)/glsl
/ir.h
: $(intermediates
)/glsl
/ir_expression_operation.h
95 $(intermediates
)/glsl
/ir_expression_operation.h
: $(LOCAL_PATH
)/glsl
/ir_expression_operation.py
97 $(hide
) $(MESA_PYTHON2
) $< enum
> $@
99 $(intermediates
)/glsl
/ir_expression_operation_constant.h
: $(LOCAL_PATH
)/glsl
/ir_expression_operation.py
101 $(hide
) $(MESA_PYTHON2
) $< constant
> $@
103 $(intermediates
)/glsl
/ir_expression_operation_strings.h
: $(LOCAL_PATH
)/glsl
/ir_expression_operation.py
105 $(hide
) $(MESA_PYTHON2
) $< strings
> $@
107 $(intermediates
)/glsl
/float64_glsl.h
: $(LOCAL_PATH
)/glsl
/xxd.py
109 $(hide
) $(MESA_PYTHON2
) $< $(MESA_TOP
)/src
/compiler
/glsl
/float64.glsl
$@
-n float64_source
> $@