2 # Copyright © 2012 Jon TURNEY
3 # Copyright (C) 2015 Intel Corporation
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:
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
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
24 EXTRA_DIST += glsl/tests glsl/glcpp/tests glsl/README \
25 glsl/TODO glsl/glcpp/README \
28 glsl/ir_expression_operation.py \
29 glsl/glcpp/glcpp-lex.l \
30 glsl/glcpp/glcpp-parse.y \
33 TESTS += glsl/glcpp/tests/glcpp-test \
34 glsl/glcpp/tests/glcpp-test-cr-lf \
35 glsl/tests/blob-test \
36 glsl/tests/cache-test \
37 glsl/tests/general-ir-test \
38 glsl/tests/optimization-test \
39 glsl/tests/sampler-types-test \
40 glsl/tests/uniform-initializer-test \
41 glsl/tests/warnings-test
44 export PYTHON2=$(PYTHON2); \
45 export PYTHON_FLAGS=$(PYTHON_FLAGS);
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
56 noinst_PROGRAMS = glsl_compiler
58 glsl_tests_blob_test_SOURCES = \
59 glsl/tests/blob_test.c
60 glsl_tests_blob_test_LDADD = \
63 glsl_tests_cache_test_SOURCES = \
64 glsl/tests/cache_test.c
65 glsl_tests_cache_test_LDADD = \
68 glsl_tests_general_ir_test_SOURCES = \
69 glsl/tests/builtin_variable_test.cpp \
70 glsl/tests/invalidate_locations_test.cpp \
71 glsl/tests/general_ir_test.cpp \
72 glsl/tests/varyings_test.cpp
73 glsl_tests_general_ir_test_CFLAGS = \
75 glsl_tests_general_ir_test_LDADD = \
76 $(top_builddir)/src/gtest/libgtest.la \
78 glsl/libstandalone.la \
79 $(top_builddir)/src/libglsl_util.la \
82 glsl_tests_uniform_initializer_test_SOURCES = \
83 glsl/tests/copy_constant_to_storage_tests.cpp \
84 glsl/tests/set_uniform_initializer_tests.cpp \
85 glsl/tests/uniform_initializer_utils.cpp \
86 glsl/tests/uniform_initializer_utils.h
87 glsl_tests_uniform_initializer_test_CFLAGS = \
89 glsl_tests_uniform_initializer_test_LDADD = \
90 $(top_builddir)/src/gtest/libgtest.la \
92 $(top_builddir)/src/libglsl_util.la \
95 glsl_tests_sampler_types_test_SOURCES = \
96 glsl/tests/sampler_types_test.cpp
97 glsl_tests_sampler_types_test_CFLAGS = \
99 glsl_tests_sampler_types_test_LDADD = \
100 $(top_builddir)/src/gtest/libgtest.la \
102 $(top_builddir)/src/libglsl_util.la \
105 noinst_LTLIBRARIES += glsl/libglsl.la glsl/libglcpp.la glsl/libstandalone.la
107 glsl_libglcpp_la_LIBADD = \
108 $(top_builddir)/src/util/libmesautil.la
109 glsl_libglcpp_la_SOURCES = \
110 glsl/glcpp/glcpp-lex.c \
111 glsl/glcpp/glcpp-parse.c \
112 glsl/glcpp/glcpp-parse.h \
115 glsl_glcpp_glcpp_SOURCES = \
117 glsl_glcpp_glcpp_LDADD = \
119 $(top_builddir)/src/libglsl_util.la \
122 glsl_libglsl_la_LIBADD = \
126 glsl_libglsl_la_SOURCES = \
127 $(LIBGLSL_GENERATED_FILES) \
130 if ENABLE_SHADER_CACHE
131 glsl_libglsl_la_SOURCES += $(LIBGLSL_SHADER_CACHE_FILES)
134 glsl_libstandalone_la_SOURCES = \
135 $(GLSL_COMPILER_CXX_FILES)
137 glsl_libstandalone_la_LIBADD = \
139 $(top_builddir)/src/libglsl_util.la \
140 $(top_builddir)/src/util/libmesautil.la \
143 glsl_compiler_SOURCES = \
146 glsl_compiler_LDADD = \
147 glsl/libstandalone.la
149 glsl_glsl_test_SOURCES = \
151 glsl/test_optpass.cpp \
154 glsl_glsl_test_LDADD = \
156 glsl/libstandalone.la \
157 $(top_builddir)/src/libglsl_util.la \
160 # We write our own rules for yacc and lex below. We'd rather use automake,
161 # but automake makes it especially difficult for a number of reasons:
163 # * < automake-1.12 generates .h files from .yy and .ypp files, but
164 # >=automake-1.12 generates .hh and .hpp files respectively. There's no
165 # good way of making a project that uses C++ yacc files compatible with
166 # both versions of automake. Strong work automake developers.
168 # * Since we're generating code from .l/.y files in a subdirectory (glcpp/)
169 # we'd like the resulting generated code to also go in glcpp/ for purposes
170 # of distribution. Automake gives no way to do this.
172 # * Since we're building multiple yacc parsers into one library (and via one
173 # Makefile) we have to use per-target YFLAGS. Using per-target YFLAGS causes
174 # automake to name the resulting generated code as <library-name>_filename.c.
175 # Frankly, that's ugly and we don't want a libglcpp_glcpp_parser.h file.
177 # In order to make build output print "LEX" and "YACC", we reproduce the
178 # automake variables below.
180 AM_V_LEX = $(am__v_LEX_$(V))
181 am__v_LEX_ = $(am__v_LEX_$(AM_DEFAULT_VERBOSITY))
182 am__v_LEX_0 = @echo " LEX " $@;
185 AM_V_YACC = $(am__v_YACC_$(V))
186 am__v_YACC_ = $(am__v_YACC_$(AM_DEFAULT_VERBOSITY))
187 am__v_YACC_0 = @echo " YACC " $@;
190 YACC_GEN = $(AM_V_YACC)$(YACC) $(YFLAGS)
191 LEX_GEN = $(AM_V_LEX)$(LEX) $(LFLAGS)
192 PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
194 glsl/glsl_parser.cpp glsl/glsl_parser.h: glsl/glsl_parser.yy
196 $(YACC_GEN) -o $@ -p "_mesa_glsl_" --defines=$(builddir)/glsl/glsl_parser.h $(srcdir)/glsl/glsl_parser.yy
198 glsl/glsl_lexer.cpp: glsl/glsl_lexer.ll
200 $(LEX_GEN) -o $@ $(srcdir)/glsl/glsl_lexer.ll
202 glsl/glcpp/glcpp-parse.c glsl/glcpp/glcpp-parse.h: glsl/glcpp/glcpp-parse.y
204 $(YACC_GEN) -o $@ -p "glcpp_parser_" --defines=$(builddir)/glsl/glcpp/glcpp-parse.h $(srcdir)/glsl/glcpp/glcpp-parse.y
206 glsl/glcpp/glcpp-lex.c: glsl/glcpp/glcpp-lex.l
208 $(LEX_GEN) -o $@ $(srcdir)/glsl/glcpp/glcpp-lex.l
210 glsl/ir_expression_operation.h: glsl/ir_expression_operation.py
212 $(PYTHON_GEN) $(srcdir)/glsl/ir_expression_operation.py enum > $@ || ($(RM) $@; false)
214 glsl/ir_expression_operation_constant.h: glsl/ir_expression_operation.py
216 $(PYTHON_GEN) $(srcdir)/glsl/ir_expression_operation.py constant > $@ || ($(RM) $@; false)
218 glsl/ir_expression_operation_strings.h: glsl/ir_expression_operation.py
220 $(PYTHON_GEN) $(srcdir)/glsl/ir_expression_operation.py strings > $@ || ($(RM) $@; false)
222 # Only the parsers (specifically the header files generated at the same time)
223 # need to be in BUILT_SOURCES. Though if we list the parser headers YACC is
224 # called for the .c/.cpp file and the .h files. By listing the .c/.cpp files
225 # YACC is only executed once for each parser. The rest of the generated code
226 # will be created at the appropriate times according to standard automake
229 glsl/glsl_parser.cpp \
230 glsl/glsl_lexer.cpp \
231 glsl/ir_expression_operation.h \
232 glsl/ir_expression_operation_constant.h \
233 glsl/ir_expression_operation_strings.h \
234 glsl/glcpp/glcpp-parse.c \
235 glsl/glcpp/glcpp-lex.c
237 glsl/glcpp/glcpp-parse.h \
239 glsl/glsl_parser.cpp \
240 glsl/glsl_lexer.cpp \
241 glsl/ir_expression_operation.h \
242 glsl/ir_expression_operation_constant.h \
243 glsl/ir_expression_operation_strings.h \
244 glsl/glcpp/glcpp-parse.c \
245 glsl/glcpp/glcpp-lex.c
248 $(RM) -r subtest-cr subtest-cr-lf subtest-lf subtest-lf-cr
251 $(RM) glsl/glcpp/tests/*.out
252 $(RM) glsl/glcpp/tests/subtest*/*.out