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 = \
184 $(top_builddir)/src/util/libmesautil.la \
188 # We write our own rules for yacc and lex below. We'd rather use automake,
189 # but automake makes it especially difficult for a number of reasons:
191 # * < automake-1.12 generates .h files from .yy and .ypp files, but
192 # >=automake-1.12 generates .hh and .hpp files respectively. There's no
193 # good way of making a project that uses C++ yacc files compatible with
194 # both versions of automake. Strong work automake developers.
196 # * Since we're generating code from .l/.y files in a subdirectory (glcpp/)
197 # we'd like the resulting generated code to also go in glcpp/ for purposes
198 # of distribution. Automake gives no way to do this.
200 # * Since we're building multiple yacc parsers into one library (and via one
201 # Makefile) we have to use per-target YFLAGS. Using per-target YFLAGS causes
202 # automake to name the resulting generated code as <library-name>_filename.c.
203 # Frankly, that's ugly and we don't want a libglcpp_glcpp_parser.h file.
205 # In order to make build output print "LEX" and "YACC", we reproduce the
206 # automake variables below.
208 AM_V_LEX = $(am__v_LEX_$(V))
209 am__v_LEX_ = $(am__v_LEX_$(AM_DEFAULT_VERBOSITY))
210 am__v_LEX_0 = @echo " LEX " $@;
213 AM_V_YACC = $(am__v_YACC_$(V))
214 am__v_YACC_ = $(am__v_YACC_$(AM_DEFAULT_VERBOSITY))
215 am__v_YACC_0 = @echo " YACC " $@;
218 MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
219 YACC_GEN = $(AM_V_YACC)$(YACC) $(YFLAGS)
220 LEX_GEN = $(AM_V_LEX)$(LEX) $(LFLAGS)
222 glsl/glsl_parser.cpp glsl/glsl_parser.h: glsl/glsl_parser.yy
224 $(YACC_GEN) -o $@ -p "_mesa_glsl_" --defines=$(builddir)/glsl/glsl_parser.h $(srcdir)/glsl/glsl_parser.yy
226 glsl/glsl_lexer.cpp: glsl/glsl_lexer.ll
228 $(LEX_GEN) -o $@ $(srcdir)/glsl/glsl_lexer.ll
230 glsl/glcpp/glcpp-parse.c glsl/glcpp/glcpp-parse.h: glsl/glcpp/glcpp-parse.y
232 $(YACC_GEN) -o $@ -p "glcpp_parser_" --defines=$(builddir)/glsl/glcpp/glcpp-parse.h $(srcdir)/glsl/glcpp/glcpp-parse.y
234 glsl/glcpp/glcpp-lex.c: glsl/glcpp/glcpp-lex.l
236 $(LEX_GEN) -o $@ $(srcdir)/glsl/glcpp/glcpp-lex.l
238 # Only the parsers (specifically the header files generated at the same time)
239 # need to be in BUILT_SOURCES. Though if we list the parser headers YACC is
240 # called for the .c/.cpp file and the .h files. By listing the .c/.cpp files
241 # YACC is only executed once for each parser. The rest of the generated code
242 # will be created at the appropriate times according to standard automake
245 glsl/glsl_parser.cpp \
246 glsl/glsl_lexer.cpp \
247 glsl/glcpp/glcpp-parse.c \
248 glsl/glcpp/glcpp-lex.c
250 glsl/glcpp/glcpp-parse.h \
252 glsl/glsl_parser.cpp \
253 glsl/glsl_lexer.cpp \
254 glsl/glcpp/glcpp-parse.c \
255 glsl/glcpp/glcpp-lex.c
258 $(RM) -r subtest-cr subtest-cr-lf subtest-lf subtest-lf-cr
261 $(RM) glsl/glcpp/tests/*.out
262 $(RM) glsl/glcpp/tests/subtest*/*.out
264 noinst_LTLIBRARIES += nir/libnir.la
266 nir_libnir_la_CPPFLAGS = \
268 -I$(top_builddir)/src/compiler/nir \
269 -I$(top_srcdir)/src/compiler/nir
271 nir_libnir_la_LIBADD = \
274 nir_libnir_la_SOURCES = \
277 $(NIR_GENERATED_FILES)
279 PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
281 nir/nir_builder_opcodes.h: nir/nir_opcodes.py nir/nir_builder_opcodes_h.py
283 $(PYTHON_GEN) $(srcdir)/nir/nir_builder_opcodes_h.py > $@ || ($(RM) $@; false)
285 nir/nir_constant_expressions.c: nir/nir_opcodes.py nir/nir_constant_expressions.py
287 $(PYTHON_GEN) $(srcdir)/nir/nir_constant_expressions.py > $@ || ($(RM) $@; false)
289 nir/nir_opcodes.h: nir/nir_opcodes.py nir/nir_opcodes_h.py
291 $(PYTHON_GEN) $(srcdir)/nir/nir_opcodes_h.py > $@ || ($(RM) $@; false)
293 nir/nir_opcodes.c: nir/nir_opcodes.py nir/nir_opcodes_c.py
295 $(PYTHON_GEN) $(srcdir)/nir/nir_opcodes_c.py > $@ || ($(RM) $@; false)
297 nir/nir_opt_algebraic.c: nir/nir_opt_algebraic.py nir/nir_algebraic.py
299 $(PYTHON_GEN) $(srcdir)/nir/nir_opt_algebraic.py > $@ || ($(RM) $@; false)
302 check_PROGRAMS += nir/tests/control_flow_tests
304 nir_tests_control_flow_tests_CPPFLAGS = \
306 -I$(top_builddir)/src/compiler/nir \
307 -I$(top_srcdir)/src/compiler/nir
309 nir_tests_control_flow_tests_SOURCES = \
310 nir/tests/control_flow_tests.cpp
311 nir_tests_control_flow_tests_CFLAGS = \
313 nir_tests_control_flow_tests_LDADD = \
314 $(top_builddir)/src/gtest/libgtest.la \
316 $(top_builddir)/src/util/libmesautil.la \
320 TESTS += nir/tests/control_flow_tests
323 BUILT_SOURCES += $(NIR_GENERATED_FILES)
324 CLEANFILES += $(NIR_GENERATED_FILES)
327 nir/nir_algebraic.py \
328 nir/nir_builder_opcodes_h.py \
329 nir/nir_constant_expressions.py \
331 nir/nir_opcodes_c.py \
332 nir/nir_opcodes_h.py \
333 nir/nir_opt_algebraic.py \