OSDN Git Service

nir/builder: Add deref building helpers
[android-x86/external-mesa.git] / src / compiler / Makefile.glsl.am
1 #
2 # Copyright © 2012 Jon TURNEY
3 # Copyright (C) 2015 Intel Corporation
4 #
5 # Permission is hereby granted, free of charge, to any person obtaining a
6 # copy of this software and associated documentation files (the "Software"),
7 # to deal in the Software without restriction, including without limitation
8 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 # and/or sell copies of the Software, and to permit persons to whom the
10 # Software is furnished to do so, subject to the following conditions:
11 #
12 # The above copyright notice and this permission notice (including the next
13 # paragraph) shall be included in all copies or substantial portions of the
14 # 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 DEALINGS
22 # IN THE SOFTWARE.
23
24 EXTRA_DIST += glsl/tests glsl/glcpp/tests glsl/README   \
25         glsl/TODO glsl/glcpp/README                     \
26         glsl/glsl_lexer.ll                              \
27         glsl/glsl_parser.yy                             \
28         glsl/ir_expression_operation.py                 \
29         glsl/glcpp/glcpp-lex.l                          \
30         glsl/glcpp/glcpp-parse.y                        \
31         SConscript.glsl
32
33 TESTS += glsl/glcpp/tests/glcpp-test.sh                 \
34         glsl/tests/blob-test                            \
35         glsl/tests/cache-test                           \
36         glsl/tests/general-ir-test                      \
37         glsl/tests/optimization-test.sh                 \
38         glsl/tests/sampler-types-test                   \
39         glsl/tests/uniform-initializer-test             \
40         glsl/tests/warnings-test.sh
41
42 TESTS_ENVIRONMENT= \
43         export abs_builddir=$(abs_builddir); \
44         export PYTHON2=$(PYTHON2); \
45         export PYTHON_FLAGS=$(PYTHON_FLAGS);
46
47 check_PROGRAMS +=                                       \
48         glsl/glcpp/glcpp                                \
49         glsl/glsl_test                                  \
50         glsl/tests/blob-test                            \
51         glsl/tests/cache-test                           \
52         glsl/tests/general-ir-test                      \
53         glsl/tests/sampler-types-test                   \
54         glsl/tests/uniform-initializer-test
55
56 noinst_PROGRAMS += glsl_compiler
57
58 glsl_tests_blob_test_SOURCES =                          \
59         glsl/tests/blob_test.c
60 glsl_tests_blob_test_LDADD =                            \
61         glsl/libglsl.la
62
63 glsl_tests_cache_test_SOURCES =                         \
64         glsl/tests/cache_test.c
65 glsl_tests_cache_test_CFLAGS =                          \
66         $(PTHREAD_CFLAGS)
67 glsl_tests_cache_test_LDADD =                           \
68         glsl/libglsl.la                                 \
69         $(PTHREAD_LIBS)                                 \
70         $(CLOCK_LIB)
71
72 glsl_tests_general_ir_test_SOURCES =                    \
73         glsl/tests/array_refcount_test.cpp              \
74         glsl/tests/builtin_variable_test.cpp            \
75         glsl/tests/invalidate_locations_test.cpp        \
76         glsl/tests/general_ir_test.cpp                  \
77         glsl/tests/lower_int64_test.cpp                 \
78         glsl/tests/opt_add_neg_to_sub_test.cpp          \
79         glsl/tests/varyings_test.cpp
80 glsl_tests_general_ir_test_CFLAGS =                     \
81         $(PTHREAD_CFLAGS)
82 glsl_tests_general_ir_test_LDADD =                      \
83         $(top_builddir)/src/gtest/libgtest.la           \
84         glsl/libglsl.la         \
85         glsl/libstandalone.la                           \
86         $(top_builddir)/src/libglsl_util.la             \
87         $(PTHREAD_LIBS)                                 \
88         $(CLOCK_LIB)
89
90 glsl_tests_uniform_initializer_test_SOURCES =           \
91         glsl/tests/copy_constant_to_storage_tests.cpp   \
92         glsl/tests/set_uniform_initializer_tests.cpp    \
93         glsl/tests/uniform_initializer_utils.cpp        \
94         glsl/tests/uniform_initializer_utils.h
95 glsl_tests_uniform_initializer_test_CFLAGS =            \
96         $(PTHREAD_CFLAGS)
97 glsl_tests_uniform_initializer_test_LDADD =             \
98         $(top_builddir)/src/gtest/libgtest.la           \
99         glsl/libglsl.la         \
100         $(top_builddir)/src/libglsl_util.la             \
101         $(PTHREAD_LIBS)
102
103 glsl_tests_sampler_types_test_SOURCES =                 \
104         glsl/tests/sampler_types_test.cpp
105 glsl_tests_sampler_types_test_CFLAGS =                  \
106         $(PTHREAD_CFLAGS)
107 glsl_tests_sampler_types_test_LDADD =                   \
108         $(top_builddir)/src/gtest/libgtest.la           \
109         glsl/libglsl.la                                 \
110         $(top_builddir)/src/libglsl_util.la             \
111         $(PTHREAD_LIBS)
112
113 noinst_LTLIBRARIES += glsl/libglsl.la glsl/libglcpp.la glsl/libstandalone.la
114
115 glsl_libglcpp_la_LIBADD =                               \
116         $(top_builddir)/src/util/libmesautil.la
117 glsl_libglcpp_la_SOURCES =                              \
118         glsl/glcpp/glcpp-lex.c                          \
119         glsl/glcpp/glcpp-parse.c                        \
120         glsl/glcpp/glcpp-parse.h                        \
121         $(LIBGLCPP_FILES)
122
123 glsl_glcpp_glcpp_SOURCES =                              \
124         glsl/glcpp/glcpp.c
125 glsl_glcpp_glcpp_LDADD =                                \
126         glsl/libglcpp.la        \
127         $(top_builddir)/src/libglsl_util.la             \
128         -lm
129
130 glsl_libglsl_la_LIBADD = \
131         nir/libnir.la \
132         glsl/libglcpp.la
133
134 glsl_libglsl_la_SOURCES =                               \
135         $(LIBGLSL_GENERATED_FILES)                      \
136         $(LIBGLSL_FILES)                                \
137         $(LIBGLSL_SHADER_CACHE_FILES)
138
139 glsl_libstandalone_la_SOURCES = \
140         $(GLSL_COMPILER_CXX_FILES)
141
142 glsl_libstandalone_la_LIBADD =                          \
143         glsl/libglsl.la                                 \
144         $(top_builddir)/src/libglsl_util.la             \
145         $(top_builddir)/src/util/libmesautil.la         \
146         $(PTHREAD_LIBS)
147
148 glsl_compiler_SOURCES = \
149         glsl/main.cpp
150
151 glsl_compiler_LDADD = \
152         glsl/libstandalone.la \
153         $(CLOCK_LIB)
154
155 glsl_glsl_test_SOURCES = \
156         glsl/test.cpp \
157         glsl/test_optpass.cpp \
158         glsl/test_optpass.h
159
160 glsl_glsl_test_LDADD =                                  \
161         glsl/libglsl.la                                 \
162         glsl/libstandalone.la                           \
163         $(top_builddir)/src/libglsl_util.la             \
164         $(PTHREAD_LIBS)                                 \
165         $(CLOCK_LIB)
166
167 # We write our own rules for yacc and lex below. We'd rather use automake,
168 # but automake makes it especially difficult for a number of reasons:
169 #
170 #  * < automake-1.12 generates .h files from .yy and .ypp files, but
171 #    >=automake-1.12 generates .hh and .hpp files respectively. There's no
172 #    good way of making a project that uses C++ yacc files compatible with
173 #    both versions of automake. Strong work automake developers.
174 #
175 #  * Since we're generating code from .l/.y files in a subdirectory (glcpp/)
176 #    we'd like the resulting generated code to also go in glcpp/ for purposes
177 #    of distribution. Automake gives no way to do this.
178 #
179 #  * Since we're building multiple yacc parsers into one library (and via one
180 #    Makefile) we have to use per-target YFLAGS. Using per-target YFLAGS causes
181 #    automake to name the resulting generated code as <library-name>_filename.c.
182 #    Frankly, that's ugly and we don't want a libglcpp_glcpp_parser.h file.
183
184 # In order to make build output print "LEX" and "YACC", we reproduce the
185 # automake variables below.
186
187 AM_V_LEX = $(am__v_LEX_$(V))
188 am__v_LEX_ = $(am__v_LEX_$(AM_DEFAULT_VERBOSITY))
189 am__v_LEX_0 = @echo "  LEX     " $@;
190 am__v_LEX_1 =
191
192 AM_V_YACC = $(am__v_YACC_$(V))
193 am__v_YACC_ = $(am__v_YACC_$(AM_DEFAULT_VERBOSITY))
194 am__v_YACC_0 = @echo "  YACC    " $@;
195 am__v_YACC_1 =
196
197 YACC_GEN = $(AM_V_YACC)$(YACC) $(YFLAGS)
198 LEX_GEN = $(AM_V_LEX)$(LEX) $(LFLAGS)
199
200 glsl/glsl_parser.cpp glsl/glsl_parser.h: glsl/glsl_parser.yy
201         $(MKDIR_GEN)
202         $(YACC_GEN) -o $@ -p "_mesa_glsl_" --defines=$(builddir)/glsl/glsl_parser.h $(srcdir)/glsl/glsl_parser.yy
203
204 glsl/glsl_lexer.cpp: glsl/glsl_lexer.ll
205         $(MKDIR_GEN)
206         $(LEX_GEN) -o $@ $(srcdir)/glsl/glsl_lexer.ll
207
208 glsl/glcpp/glcpp-parse.c glsl/glcpp/glcpp-parse.h: glsl/glcpp/glcpp-parse.y
209         $(MKDIR_GEN)
210         $(YACC_GEN) -o $@ -p "glcpp_parser_" --defines=$(builddir)/glsl/glcpp/glcpp-parse.h $(srcdir)/glsl/glcpp/glcpp-parse.y
211
212 glsl/glcpp/glcpp-lex.c: glsl/glcpp/glcpp-lex.l
213         $(MKDIR_GEN)
214         $(LEX_GEN) -o $@ $(srcdir)/glsl/glcpp/glcpp-lex.l
215
216 glsl/ir_expression_operation.h: glsl/ir_expression_operation.py
217         $(MKDIR_GEN)
218         $(PYTHON_GEN) $(srcdir)/glsl/ir_expression_operation.py enum > $@ || ($(RM) $@; false)
219
220 glsl/ir_expression_operation_constant.h: glsl/ir_expression_operation.py
221         $(MKDIR_GEN)
222         $(PYTHON_GEN) $(srcdir)/glsl/ir_expression_operation.py constant > $@ || ($(RM) $@; false)
223
224 glsl/ir_expression_operation_strings.h: glsl/ir_expression_operation.py
225         $(MKDIR_GEN)
226         $(PYTHON_GEN) $(srcdir)/glsl/ir_expression_operation.py strings > $@ || ($(RM) $@; false)
227
228 # Only the parsers (specifically the header files generated at the same time)
229 # need to be in BUILT_SOURCES. Though if we list the parser headers YACC is
230 # called for the .c/.cpp file and the .h files. By listing the .c/.cpp files
231 # YACC is only executed once for each parser. The rest of the generated code
232 # will be created at the appropriate times according to standard automake
233 # dependency rules.
234 BUILT_SOURCES +=                                        \
235         glsl/glsl_parser.cpp                            \
236         glsl/glsl_lexer.cpp                             \
237         glsl/ir_expression_operation.h                  \
238         glsl/ir_expression_operation_constant.h         \
239         glsl/ir_expression_operation_strings.h          \
240         glsl/glcpp/glcpp-parse.c                        \
241         glsl/glcpp/glcpp-lex.c
242 CLEANFILES +=                                           \
243         glsl/glcpp/glcpp-parse.h                        \
244         glsl/glsl_parser.h                              \
245         glsl/glsl_parser.cpp                            \
246         glsl/glsl_lexer.cpp                             \
247         glsl/ir_expression_operation.h                  \
248         glsl/ir_expression_operation_constant.h         \
249         glsl/ir_expression_operation_strings.h          \
250         glsl/glcpp/glcpp-parse.c                        \
251         glsl/glcpp/glcpp-lex.c
252
253 clean-local:
254         $(RM) glsl/tests/lower_jumps/*.opt_test
255         $(RM) glsl/tests/lower_jumps/*.expected
256         $(RM) glsl/tests/lower_jumps/*.out
257         $(RM) glsl/tests/warnings/*.out
258         $(RM) glsl/glcpp/tests/*.out
259         $(RM) -r glsl/glcpp/tests/subtest*/
260         $(RM) -r subtest-cr subtest-cr-lf subtest-lf subtest-lf-cr
261
262 dist-hook:
263         $(RM) glsl/glcpp/tests/*.out
264         $(RM) glsl/glcpp/tests/subtest*/*.out