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 include Makefile.sources
27 -I$(top_srcdir)/include \
29 -I$(top_srcdir)/src/mapi \
30 -I$(top_srcdir)/src/mesa/ \
31 -I$(top_builddir)/src/compiler/glsl\
32 -I$(top_srcdir)/src/compiler/glsl\
33 -I$(top_srcdir)/src/compiler/glsl/glcpp\
34 -I$(top_srcdir)/src/gallium/include \
35 -I$(top_srcdir)/src/gallium/auxiliary \
36 -I$(top_srcdir)/src/gtest/include \
40 $(VISIBILITY_CFLAGS) \
41 $(MSVC2013_COMPAT_CFLAGS)
44 $(VISIBILITY_CXXFLAGS) \
45 $(MSVC2013_COMPAT_CXXFLAGS)
47 noinst_LTLIBRARIES = libcompiler.la
49 libcompiler_la_SOURCES = $(LIBCOMPILER_FILES)
55 EXTRA_DIST = SConscript
58 EXTRA_DIST += glsl/tests glsl/glcpp/tests glsl/README \
59 glsl/TODO glsl/glcpp/README \
62 glsl/glcpp/glcpp-lex.l \
63 glsl/glcpp/glcpp-parse.y \
64 glsl/Makefile.sources \
67 TESTS += glsl/glcpp/tests/glcpp-test \
68 glsl/glcpp/tests/glcpp-test-cr-lf \
69 glsl/tests/blob-test \
70 glsl/tests/general-ir-test \
71 glsl/tests/optimization-test \
72 glsl/tests/sampler-types-test \
73 glsl/tests/uniform-initializer-test
76 export PYTHON2=$(PYTHON2); \
77 export PYTHON_FLAGS=$(PYTHON_FLAGS);
82 glsl/tests/blob-test \
83 glsl/tests/general-ir-test \
84 glsl/tests/sampler-types-test \
85 glsl/tests/uniform-initializer-test
87 noinst_PROGRAMS = glsl_compiler spirv2nir
89 glsl_tests_blob_test_SOURCES = \
90 glsl/tests/blob_test.c
91 glsl_tests_blob_test_LDADD = \
94 glsl_tests_general_ir_test_SOURCES = \
95 glsl/standalone_scaffolding.cpp \
96 glsl/tests/builtin_variable_test.cpp \
97 glsl/tests/invalidate_locations_test.cpp \
98 glsl/tests/general_ir_test.cpp \
99 glsl/tests/varyings_test.cpp
100 glsl_tests_general_ir_test_CFLAGS = \
102 glsl_tests_general_ir_test_LDADD = \
103 $(top_builddir)/src/gtest/libgtest.la \
105 $(top_builddir)/src/libglsl_util.la \
108 glsl_tests_uniform_initializer_test_SOURCES = \
109 glsl/tests/copy_constant_to_storage_tests.cpp \
110 glsl/tests/set_uniform_initializer_tests.cpp \
111 glsl/tests/uniform_initializer_utils.cpp \
112 glsl/tests/uniform_initializer_utils.h
113 glsl_tests_uniform_initializer_test_CFLAGS = \
115 glsl_tests_uniform_initializer_test_LDADD = \
116 $(top_builddir)/src/gtest/libgtest.la \
118 $(top_builddir)/src/libglsl_util.la \
121 glsl_tests_sampler_types_test_SOURCES = \
122 glsl/tests/sampler_types_test.cpp
123 glsl_tests_sampler_types_test_CFLAGS = \
125 glsl_tests_sampler_types_test_LDADD = \
126 $(top_builddir)/src/gtest/libgtest.la \
128 $(top_builddir)/src/libglsl_util.la \
131 noinst_LTLIBRARIES += glsl/libglsl.la glsl/libglcpp.la
133 glsl_libglcpp_la_LIBADD = \
134 $(top_builddir)/src/util/libmesautil.la
135 glsl_libglcpp_la_SOURCES = \
136 glsl/glcpp/glcpp-lex.c \
137 glsl/glcpp/glcpp-parse.c \
138 glsl/glcpp/glcpp-parse.h \
141 glsl_glcpp_glcpp_SOURCES = \
143 glsl_glcpp_glcpp_LDADD = \
145 $(top_builddir)/src/libglsl_util.la \
148 glsl_libglsl_la_LIBADD = \
152 glsl_libglsl_la_SOURCES = \
153 glsl/glsl_lexer.cpp \
154 glsl/glsl_parser.cpp \
159 glsl_compiler_SOURCES = \
160 $(GLSL_COMPILER_CXX_FILES)
162 glsl_compiler_LDADD = \
164 $(top_builddir)/src/libglsl_util.la \
165 $(top_builddir)/src/util/libmesautil.la \
168 glsl_glsl_test_SOURCES = \
169 glsl/standalone_scaffolding.cpp \
171 glsl/test_optpass.cpp \
174 glsl_glsl_test_LDADD = \
176 $(top_builddir)/src/libglsl_util.la \
179 spirv2nir_SOURCES = \
182 spirv2nir_CPPFLAGS = \
184 -I$(top_builddir)/src/compiler/nir \
185 -I$(top_srcdir)/src/compiler/nir
189 $(top_builddir)/src/util/libmesautil.la \
193 # We write our own rules for yacc and lex below. We'd rather use automake,
194 # but automake makes it especially difficult for a number of reasons:
196 # * < automake-1.12 generates .h files from .yy and .ypp files, but
197 # >=automake-1.12 generates .hh and .hpp files respectively. There's no
198 # good way of making a project that uses C++ yacc files compatible with
199 # both versions of automake. Strong work automake developers.
201 # * Since we're generating code from .l/.y files in a subdirectory (glcpp/)
202 # we'd like the resulting generated code to also go in glcpp/ for purposes
203 # of distribution. Automake gives no way to do this.
205 # * Since we're building multiple yacc parsers into one library (and via one
206 # Makefile) we have to use per-target YFLAGS. Using per-target YFLAGS causes
207 # automake to name the resulting generated code as <library-name>_filename.c.
208 # Frankly, that's ugly and we don't want a libglcpp_glcpp_parser.h file.
210 # In order to make build output print "LEX" and "YACC", we reproduce the
211 # automake variables below.
213 AM_V_LEX = $(am__v_LEX_$(V))
214 am__v_LEX_ = $(am__v_LEX_$(AM_DEFAULT_VERBOSITY))
215 am__v_LEX_0 = @echo " LEX " $@;
218 AM_V_YACC = $(am__v_YACC_$(V))
219 am__v_YACC_ = $(am__v_YACC_$(AM_DEFAULT_VERBOSITY))
220 am__v_YACC_0 = @echo " YACC " $@;
223 MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
224 YACC_GEN = $(AM_V_YACC)$(YACC) $(YFLAGS)
225 LEX_GEN = $(AM_V_LEX)$(LEX) $(LFLAGS)
227 glsl/glsl_parser.cpp glsl/glsl_parser.h: glsl/glsl_parser.yy
229 $(YACC_GEN) -o $@ -p "_mesa_glsl_" --defines=$(builddir)/glsl/glsl_parser.h $(srcdir)/glsl/glsl_parser.yy
231 glsl/glsl_lexer.cpp: glsl/glsl_lexer.ll
233 $(LEX_GEN) -o $@ $(srcdir)/glsl/glsl_lexer.ll
235 glsl/glcpp/glcpp-parse.c glsl/glcpp/glcpp-parse.h: glsl/glcpp/glcpp-parse.y
237 $(YACC_GEN) -o $@ -p "glcpp_parser_" --defines=$(builddir)/glsl/glcpp/glcpp-parse.h $(srcdir)/glsl/glcpp/glcpp-parse.y
239 glsl/glcpp/glcpp-lex.c: glsl/glcpp/glcpp-lex.l
241 $(LEX_GEN) -o $@ $(srcdir)/glsl/glcpp/glcpp-lex.l
243 # Only the parsers (specifically the header files generated at the same time)
244 # need to be in BUILT_SOURCES. Though if we list the parser headers YACC is
245 # called for the .c/.cpp file and the .h files. By listing the .c/.cpp files
246 # YACC is only executed once for each parser. The rest of the generated code
247 # will be created at the appropriate times according to standard automake
250 glsl/glsl_parser.cpp \
251 glsl/glsl_lexer.cpp \
252 glsl/glcpp/glcpp-parse.c \
253 glsl/glcpp/glcpp-lex.c
255 glsl/glcpp/glcpp-parse.h \
257 glsl/glsl_parser.cpp \
258 glsl/glsl_lexer.cpp \
259 glsl/glcpp/glcpp-parse.c \
260 glsl/glcpp/glcpp-lex.c
263 $(RM) -r subtest-cr subtest-cr-lf subtest-lf subtest-lf-cr
266 $(RM) glsl/glcpp/tests/*.out
267 $(RM) glsl/glcpp/tests/subtest*/*.out
269 noinst_LTLIBRARIES += nir/libnir.la
271 nir_libnir_la_CPPFLAGS = \
273 -I$(top_builddir)/src/compiler/nir \
274 -I$(top_srcdir)/src/compiler/nir
276 nir_libnir_la_LIBADD = \
279 nir_libnir_la_SOURCES = \
282 $(NIR_GENERATED_FILES)
284 PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
286 nir/nir_builder_opcodes.h: nir/nir_opcodes.py nir/nir_builder_opcodes_h.py
288 $(PYTHON_GEN) $(srcdir)/nir/nir_builder_opcodes_h.py > $@ || ($(RM) $@; false)
290 nir/nir_constant_expressions.c: nir/nir_opcodes.py nir/nir_constant_expressions.py
292 $(PYTHON_GEN) $(srcdir)/nir/nir_constant_expressions.py > $@ || ($(RM) $@; false)
294 nir/nir_opcodes.h: nir/nir_opcodes.py nir/nir_opcodes_h.py
296 $(PYTHON_GEN) $(srcdir)/nir/nir_opcodes_h.py > $@ || ($(RM) $@; false)
298 nir/nir_opcodes.c: nir/nir_opcodes.py nir/nir_opcodes_c.py
300 $(PYTHON_GEN) $(srcdir)/nir/nir_opcodes_c.py > $@ || ($(RM) $@; false)
302 nir/nir_opt_algebraic.c: nir/nir_opt_algebraic.py nir/nir_algebraic.py
304 $(PYTHON_GEN) $(srcdir)/nir/nir_opt_algebraic.py > $@ || ($(RM) $@; false)
307 check_PROGRAMS += nir/tests/control_flow_tests
309 nir_tests_control_flow_tests_CPPFLAGS = \
311 -I$(top_builddir)/src/compiler/nir \
312 -I$(top_srcdir)/src/compiler/nir
314 nir_tests_control_flow_tests_SOURCES = \
315 nir/tests/control_flow_tests.cpp
316 nir_tests_control_flow_tests_CFLAGS = \
318 nir_tests_control_flow_tests_LDADD = \
319 $(top_builddir)/src/gtest/libgtest.la \
321 $(top_builddir)/src/util/libmesautil.la \
325 TESTS += nir/tests/control_flow_tests
328 BUILT_SOURCES += $(NIR_GENERATED_FILES)
329 CLEANFILES += $(NIR_GENERATED_FILES)
332 nir/nir_algebraic.py \
333 nir/nir_builder_opcodes_h.py \
334 nir/nir_constant_expressions.py \
336 nir/nir_opcodes_c.py \
337 nir/nir_opcodes_h.py \
338 nir/nir_opt_algebraic.py \