1 # Copyright © 2012 Jon TURNEY
3 # Permission is hereby granted, free of charge, to any person obtaining a
4 # copy of this software and associated documentation files (the "Software"),
5 # to deal in the Software without restriction, including without limitation
6 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 # and/or sell copies of the Software, and to permit persons to whom the
8 # Software is furnished to do so, subject to the following conditions:
10 # The above copyright notice and this permission notice (including the next
11 # paragraph) shall be included in all copies or substantial portions of the
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 AUTOMAKE_OPTIONS = subdir-objects
25 -I$(top_srcdir)/include \
27 -I$(top_srcdir)/src/mapi \
28 -I$(top_srcdir)/src/mesa/ \
29 -I$(top_srcdir)/src/gallium/include \
30 -I$(top_srcdir)/src/gallium/auxiliary \
31 -I$(top_srcdir)/src/glsl/glcpp \
32 -I$(top_srcdir)/src/glsl/nir \
33 -I$(top_srcdir)/src/gtest/include \
34 -I$(top_builddir)/src/glsl/nir \
37 $(VISIBILITY_CFLAGS) \
38 $(MSVC2013_COMPAT_CFLAGS)
40 $(VISIBILITY_CXXFLAGS) \
41 $(MSVC2013_COMPAT_CXXFLAGS)
43 EXTRA_DIST = tests glcpp/tests README TODO glcpp/README \
48 nir/nir_algebraic.py \
49 nir/nir_builder_opcodes_h.py \
50 nir/nir_constant_expressions.py \
52 nir/nir_opcodes_c.py \
53 nir/nir_opcodes_h.py \
54 nir/nir_opt_algebraic.py \
57 include Makefile.sources
59 TESTS = glcpp/tests/glcpp-test \
60 glcpp/tests/glcpp-test-cr-lf \
62 tests/general-ir-test \
63 tests/optimization-test \
64 tests/sampler-types-test \
65 tests/uniform-initializer-test
68 export PYTHON2=$(PYTHON2); \
69 export PYTHON_FLAGS=$(PYTHON_FLAGS);
71 noinst_LTLIBRARIES = libnir.la libglsl.la libglcpp.la
76 tests/general-ir-test \
77 tests/sampler-types-test \
78 tests/uniform-initializer-test
80 noinst_PROGRAMS = glsl_compiler spirv2nir
82 tests_blob_test_SOURCES = \
84 tests_blob_test_LDADD = \
85 $(top_builddir)/src/glsl/libglsl.la
87 tests_general_ir_test_SOURCES = \
88 standalone_scaffolding.cpp \
89 tests/builtin_variable_test.cpp \
90 tests/invalidate_locations_test.cpp \
91 tests/general_ir_test.cpp \
92 tests/varyings_test.cpp
93 tests_general_ir_test_CFLAGS = \
95 tests_general_ir_test_LDADD = \
96 $(top_builddir)/src/gtest/libgtest.la \
97 $(top_builddir)/src/glsl/libglsl.la \
98 $(top_builddir)/src/libglsl_util.la \
101 tests_uniform_initializer_test_SOURCES = \
102 tests/copy_constant_to_storage_tests.cpp \
103 tests/set_uniform_initializer_tests.cpp \
104 tests/uniform_initializer_utils.cpp \
105 tests/uniform_initializer_utils.h
106 tests_uniform_initializer_test_CFLAGS = \
108 tests_uniform_initializer_test_LDADD = \
109 $(top_builddir)/src/gtest/libgtest.la \
110 $(top_builddir)/src/glsl/libglsl.la \
111 $(top_builddir)/src/libglsl_util.la \
114 tests_sampler_types_test_SOURCES = \
115 tests/sampler_types_test.cpp
116 tests_sampler_types_test_CFLAGS = \
118 tests_sampler_types_test_LDADD = \
119 $(top_builddir)/src/gtest/libgtest.la \
120 $(top_builddir)/src/glsl/libglsl.la \
121 $(top_builddir)/src/libglsl_util.la \
124 libglcpp_la_LIBADD = \
125 $(top_builddir)/src/util/libmesautil.la
126 libglcpp_la_SOURCES = \
128 glcpp/glcpp-parse.c \
129 glcpp/glcpp-parse.h \
132 glcpp_glcpp_SOURCES = \
134 glcpp_glcpp_LDADD = \
136 $(top_builddir)/src/libglsl_util.la \
139 libglsl_la_LIBADD = libglcpp.la
140 libglsl_la_SOURCES = \
147 libnir_la_SOURCES = \
150 glsl_symbol_table.cpp \
153 glsl_compiler_SOURCES = \
154 $(GLSL_COMPILER_CXX_FILES)
156 glsl_compiler_LDADD = \
158 $(top_builddir)/src/libglsl_util.la \
161 spirv2nir_SOURCES = \
162 standalone_scaffolding.cpp \
163 standalone_scaffolding.h \
168 $(top_builddir)/src/libglsl_util.la \
171 glsl_test_SOURCES = \
172 standalone_scaffolding.cpp \
179 $(top_builddir)/src/libglsl_util.la \
182 # We write our own rules for yacc and lex below. We'd rather use automake,
183 # but automake makes it especially difficult for a number of reasons:
185 # * < automake-1.12 generates .h files from .yy and .ypp files, but
186 # >=automake-1.12 generates .hh and .hpp files respectively. There's no
187 # good way of making a project that uses C++ yacc files compatible with
188 # both versions of automake. Strong work automake developers.
190 # * Since we're generating code from .l/.y files in a subdirectory (glcpp/)
191 # we'd like the resulting generated code to also go in glcpp/ for purposes
192 # of distribution. Automake gives no way to do this.
194 # * Since we're building multiple yacc parsers into one library (and via one
195 # Makefile) we have to use per-target YFLAGS. Using per-target YFLAGS causes
196 # automake to name the resulting generated code as <library-name>_filename.c.
197 # Frankly, that's ugly and we don't want a libglcpp_glcpp_parser.h file.
199 # In order to make build output print "LEX" and "YACC", we reproduce the
200 # automake variables below.
202 AM_V_LEX = $(am__v_LEX_$(V))
203 am__v_LEX_ = $(am__v_LEX_$(AM_DEFAULT_VERBOSITY))
204 am__v_LEX_0 = @echo " LEX " $@;
207 AM_V_YACC = $(am__v_YACC_$(V))
208 am__v_YACC_ = $(am__v_YACC_$(AM_DEFAULT_VERBOSITY))
209 am__v_YACC_0 = @echo " YACC " $@;
212 glsl_parser.cpp glsl_parser.h: glsl_parser.yy
213 $(AM_V_YACC) $(YACC) $(YFLAGS) -o $@ -p "_mesa_glsl_" --defines=$(builddir)/glsl_parser.h $<
215 glsl_lexer.cpp: glsl_lexer.ll
216 $(AM_V_LEX) $(LEX) $(LFLAGS) -o $@ $<
218 glcpp/glcpp-parse.c glcpp/glcpp-parse.h: glcpp/glcpp-parse.y
219 $(AM_V_at)$(MKDIR_P) glcpp
220 $(AM_V_YACC) $(YACC) $(YFLAGS) -o $@ -p "glcpp_parser_" --defines=$(builddir)/glcpp/glcpp-parse.h $<
222 glcpp/glcpp-lex.c: glcpp/glcpp-lex.l
223 $(AM_V_at)$(MKDIR_P) glcpp
224 $(AM_V_LEX) $(LEX) $(LFLAGS) -o $@ $<
226 # Only the parsers (specifically the header files generated at the same time)
227 # need to be in BUILT_SOURCES. Though if we list the parser headers YACC is
228 # called for the .c/.cpp file and the .h files. By listing the .c/.cpp files
229 # YACC is only executed once for each parser. The rest of the generated code
230 # will be created at the appropriate times according to standard automake
235 glcpp/glcpp-parse.c \
237 nir/nir_builder_opcodes.h \
238 nir/nir_constant_expressions.c \
241 nir/nir_opt_algebraic.c
243 glcpp/glcpp-parse.h \
248 $(RM) -r subtest-cr subtest-cr-lf subtest-lf subtest-lf-cr
251 $(RM) glcpp/tests/*.out
252 $(RM) glcpp/tests/subtest*/*.out
254 nir/nir_builder_opcodes.h: nir/nir_opcodes.py nir/nir_builder_opcodes_h.py
255 $(AM_V_at)$(MKDIR_P) nir
256 $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/nir/nir_builder_opcodes_h.py > $@
258 nir/nir_constant_expressions.c: nir/nir_opcodes.py nir/nir_constant_expressions.py nir/nir_constant_expressions.h
259 $(AM_V_at)$(MKDIR_P) nir
260 $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/nir/nir_constant_expressions.py > $@
262 nir/nir_opcodes.h: nir/nir_opcodes.py nir/nir_opcodes_h.py
263 $(AM_V_at)$(MKDIR_P) nir
264 $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/nir/nir_opcodes_h.py > $@
266 nir/nir_opcodes.c: nir/nir_opcodes.py nir/nir_opcodes_c.py
267 $(AM_V_at)$(MKDIR_P) nir
268 $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/nir/nir_opcodes_c.py > $@
270 nir/nir_opt_algebraic.c: nir/nir_opt_algebraic.py nir/nir_algebraic.py
271 $(AM_V_at)$(MKDIR_P) nir
272 $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/nir/nir_opt_algebraic.py > $@