• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
26ifeq ($(LOCAL_MODULE_CLASS),)
27LOCAL_MODULE_CLASS := STATIC_LIBRARIES
28endif
29
30intermediates := $(call local-generated-sources-dir)
31prebuilt_intermediates := $(MESA_TOP)/prebuilt-intermediates
32
33LOCAL_SRC_FILES := $(LOCAL_SRC_FILES)
34
35LOCAL_C_INCLUDES += \
36	$(intermediates)/glsl \
37	$(intermediates)/glsl/glcpp \
38	$(LOCAL_PATH)/glsl \
39	$(LOCAL_PATH)/glsl/glcpp
40
41LOCAL_GENERATED_SOURCES += $(addprefix $(intermediates)/, \
42	$(LIBGLCPP_GENERATED_FILES) \
43	$(LIBGLSL_GENERATED_FILES))
44
45LOCAL_EXPORT_C_INCLUDE_DIRS += \
46	$(intermediates)/glsl
47
48# Modules using libmesa_nir must set LOCAL_GENERATED_SOURCES to this
49MESA_GEN_GLSL_H := $(addprefix $(call local-generated-sources-dir)/, \
50	glsl/ir_expression_operation.h \
51	glsl/ir_expression_operation_constant.h \
52	glsl/ir_expression_operation_strings.h)
53
54define local-l-or-ll-to-c-or-cpp
55	@mkdir -p $(dir $@)
56	@echo "Mesa Lex: $(PRIVATE_MODULE) <= $<"
57	$(hide) M4=$(M4) $(LEX) --nounistd -o$@ $<
58endef
59
60$(intermediates)/glsl/glsl_lexer.cpp: $(LOCAL_PATH)/glsl/glsl_lexer.ll $(LEX) $(M4)
61	$(call local-l-or-ll-to-c-or-cpp)
62
63$(intermediates)/glsl/glsl_parser.cpp: PRIVATE_YACCFLAGS := -p "_mesa_glsl_"
64$(intermediates)/glsl/glsl_parser.cpp: .KATI_IMPLICIT_OUTPUTS := $(intermediates)/glsl/glsl_parser.h
65$(intermediates)/glsl/glsl_parser.cpp: $(LOCAL_PATH)/glsl/glsl_parser.yy $(BISON) $(BISON_DATA) $(M4)
66	$(transform-y-to-c-or-cpp)
67
68$(intermediates)/glsl/glcpp/glcpp-lex.c: $(LOCAL_PATH)/glsl/glcpp/glcpp-lex.l $(LEX) $(M4)
69	$(call local-l-or-ll-to-c-or-cpp)
70
71$(intermediates)/glsl/glcpp/glcpp-parse.c: PRIVATE_YACCFLAGS := -p "glcpp_parser_"
72$(intermediates)/glsl/glcpp/glcpp-parse.c: .KATI_IMPLICIT_OUTPUTS := $(intermediates)/glsl/glcpp/glcpp-parse.h
73$(intermediates)/glsl/glcpp/glcpp-parse.c: $(LOCAL_PATH)/glsl/glcpp/glcpp-parse.y $(BISON) $(BISON_DATA) $(M4)
74	$(transform-y-to-c-or-cpp)
75
76$(intermediates)/glsl/ir_expression_operation.h: $(prebuilt_intermediates)/glsl/ir_expression_operation.h
77	cp -a $< $@
78
79$(intermediates)/glsl/ir_expression_operation_constant.h: $(prebuilt_intermediates)/glsl/ir_expression_operation_constant.h
80	cp -a $< $@
81
82$(intermediates)/glsl/ir_expression_operation_strings.h: $(prebuilt_intermediates)/glsl/ir_expression_operation_strings.h
83	cp -a $< $@
84
85$(intermediates)/glsl/float64_glsl.h: $(MESA_TOP)/src/util/xxd.py
86	@mkdir -p $(dir $@)
87	$(hide) $(MESA_PYTHON2) $< $(MESA_TOP)/src/compiler/glsl/float64.glsl $@ -n float64_source > $@
88