1b8e80941Smrg# Mesa 3-D graphics library 2b8e80941Smrg# 3b8e80941Smrg# Copyright (C) 2010-2011 Chia-I Wu <olvaffe@gmail.com> 4b8e80941Smrg# Copyright (C) 2010-2011 LunarG Inc. 5b8e80941Smrg# 6b8e80941Smrg# Permission is hereby granted, free of charge, to any person obtaining a 7b8e80941Smrg# copy of this software and associated documentation files (the "Software"), 8b8e80941Smrg# to deal in the Software without restriction, including without limitation 9b8e80941Smrg# the rights to use, copy, modify, merge, publish, distribute, sublicense, 10b8e80941Smrg# and/or sell copies of the Software, and to permit persons to whom the 11b8e80941Smrg# Software is furnished to do so, subject to the following conditions: 12b8e80941Smrg# 13b8e80941Smrg# The above copyright notice and this permission notice shall be included 14b8e80941Smrg# in all copies or substantial portions of the Software. 15b8e80941Smrg# 16b8e80941Smrg# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17b8e80941Smrg# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18b8e80941Smrg# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19b8e80941Smrg# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20b8e80941Smrg# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21b8e80941Smrg# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22b8e80941Smrg# DEALINGS IN THE SOFTWARE. 23b8e80941Smrg 24b8e80941Smrg# included by glsl Android.mk for source generation 25b8e80941Smrg 26b8e80941Smrgifeq ($(LOCAL_MODULE_CLASS),) 27b8e80941SmrgLOCAL_MODULE_CLASS := STATIC_LIBRARIES 28b8e80941Smrgendif 29b8e80941Smrg 30b8e80941Smrgintermediates := $(call local-generated-sources-dir) 31b8e80941Smrg 32b8e80941SmrgLOCAL_SRC_FILES := $(LOCAL_SRC_FILES) 33b8e80941Smrg 34b8e80941SmrgLOCAL_C_INCLUDES += \ 35b8e80941Smrg $(intermediates)/glsl \ 36b8e80941Smrg $(intermediates)/glsl/glcpp \ 37b8e80941Smrg $(LOCAL_PATH)/glsl \ 38b8e80941Smrg $(LOCAL_PATH)/glsl/glcpp 39b8e80941Smrg 40b8e80941SmrgLOCAL_GENERATED_SOURCES += $(addprefix $(intermediates)/, \ 41b8e80941Smrg $(LIBGLCPP_GENERATED_FILES) \ 42b8e80941Smrg $(LIBGLSL_GENERATED_FILES)) 43b8e80941Smrg 44b8e80941SmrgLOCAL_EXPORT_C_INCLUDE_DIRS += \ 45b8e80941Smrg $(intermediates)/glsl 46b8e80941Smrg 47b8e80941Smrg# Modules using libmesa_nir must set LOCAL_GENERATED_SOURCES to this 48b8e80941SmrgMESA_GEN_GLSL_H := $(addprefix $(call local-generated-sources-dir)/, \ 49b8e80941Smrg glsl/ir_expression_operation.h \ 50b8e80941Smrg glsl/ir_expression_operation_constant.h \ 51b8e80941Smrg glsl/ir_expression_operation_strings.h) 52b8e80941Smrg 53b8e80941Smrgdefine local-l-or-ll-to-c-or-cpp 54b8e80941Smrg @mkdir -p $(dir $@) 55b8e80941Smrg @echo "Mesa Lex: $(PRIVATE_MODULE) <= $<" 56b8e80941Smrg $(hide) $(LEX) --nounistd -o$@ $< 57b8e80941Smrgendef 58b8e80941Smrg 59b8e80941Smrgdefine glsl_local-y-to-c-and-h 60b8e80941Smrg @mkdir -p $(dir $@) 61b8e80941Smrg @echo "Mesa Yacc: $(PRIVATE_MODULE) <= $<" 62b8e80941Smrg $(hide) $(YACC) -o $@ -p "glcpp_parser_" $< 63b8e80941Smrgendef 64b8e80941Smrg 65b8e80941SmrgYACC_HEADER_SUFFIX := .hpp 66b8e80941Smrg 67b8e80941Smrgdefine local-yy-to-cpp-and-h 68b8e80941Smrg @mkdir -p $(dir $@) 69b8e80941Smrg @echo "Mesa Yacc: $(PRIVATE_MODULE) <= $<" 70b8e80941Smrg $(hide) $(YACC) -p "_mesa_glsl_" -o $@ $< 71b8e80941Smrg touch $(@:$1=$(YACC_HEADER_SUFFIX)) 72b8e80941Smrg echo '#ifndef '$(@F:$1=_h) > $(@:$1=.h) 73b8e80941Smrg echo '#define '$(@F:$1=_h) >> $(@:$1=.h) 74b8e80941Smrg cat $(@:$1=$(YACC_HEADER_SUFFIX)) >> $(@:$1=.h) 75b8e80941Smrg echo '#endif' >> $(@:$1=.h) 76b8e80941Smrg rm -f $(@:$1=$(YACC_HEADER_SUFFIX)) 77b8e80941Smrgendef 78b8e80941Smrg 79b8e80941Smrg$(intermediates)/glsl/glsl_lexer.cpp: $(LOCAL_PATH)/glsl/glsl_lexer.ll 80b8e80941Smrg $(call local-l-or-ll-to-c-or-cpp) 81b8e80941Smrg 82b8e80941Smrg$(intermediates)/glsl/glsl_parser.cpp: $(LOCAL_PATH)/glsl/glsl_parser.yy 83b8e80941Smrg $(call local-yy-to-cpp-and-h,.cpp) 84b8e80941Smrg 85b8e80941Smrg$(intermediates)/glsl/glsl_parser.h: $(intermediates)/glsl/glsl_parser.cpp 86b8e80941Smrg 87b8e80941Smrg$(intermediates)/glsl/glcpp/glcpp-lex.c: $(LOCAL_PATH)/glsl/glcpp/glcpp-lex.l 88b8e80941Smrg $(call local-l-or-ll-to-c-or-cpp) 89b8e80941Smrg 90b8e80941Smrg$(intermediates)/glsl/glcpp/glcpp-parse.c: $(LOCAL_PATH)/glsl/glcpp/glcpp-parse.y 91b8e80941Smrg $(call glsl_local-y-to-c-and-h) 92b8e80941Smrg 93b8e80941Smrg$(LOCAL_PATH)/glsl/ir.h: $(intermediates)/glsl/ir_expression_operation.h 94b8e80941Smrg 95b8e80941Smrg$(intermediates)/glsl/ir_expression_operation.h: $(LOCAL_PATH)/glsl/ir_expression_operation.py 96b8e80941Smrg @mkdir -p $(dir $@) 97b8e80941Smrg $(hide) $(MESA_PYTHON2) $< enum > $@ 98b8e80941Smrg 99b8e80941Smrg$(intermediates)/glsl/ir_expression_operation_constant.h: $(LOCAL_PATH)/glsl/ir_expression_operation.py 100b8e80941Smrg @mkdir -p $(dir $@) 101b8e80941Smrg $(hide) $(MESA_PYTHON2) $< constant > $@ 102b8e80941Smrg 103b8e80941Smrg$(intermediates)/glsl/ir_expression_operation_strings.h: $(LOCAL_PATH)/glsl/ir_expression_operation.py 104b8e80941Smrg @mkdir -p $(dir $@) 105b8e80941Smrg $(hide) $(MESA_PYTHON2) $< strings > $@ 106b8e80941Smrg 107b8e80941Smrg$(intermediates)/glsl/float64_glsl.h: $(LOCAL_PATH)/glsl/xxd.py 108b8e80941Smrg @mkdir -p $(dir $@) 109b8e80941Smrg $(hide) $(MESA_PYTHON2) $< $(MESA_TOP)/src/compiler/glsl/float64.glsl $@ -n float64_source > $@ 110