nir/spirv: Add initial support for GLSL 4.50 builtins
[mesa.git] / src / glsl / Makefile.am
1 # Copyright © 2012 Jon TURNEY
2 #
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:
9 #
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
12 # Software.
13 #
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
20 # IN THE SOFTWARE.
21
22 AUTOMAKE_OPTIONS = subdir-objects
23
24 AM_CPPFLAGS = \
25 -I$(top_srcdir)/include \
26 -I$(top_srcdir)/src \
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 \
35 $(DEFINES)
36 AM_CFLAGS = \
37 $(VISIBILITY_CFLAGS) \
38 $(MSVC2013_COMPAT_CFLAGS)
39 AM_CXXFLAGS = \
40 $(VISIBILITY_CXXFLAGS) \
41 $(MSVC2013_COMPAT_CXXFLAGS)
42
43 EXTRA_DIST = tests glcpp/tests README TODO glcpp/README \
44 glsl_lexer.ll \
45 glsl_parser.yy \
46 glcpp/glcpp-lex.l \
47 glcpp/glcpp-parse.y \
48 nir/nir_algebraic.py \
49 nir/nir_builder_opcodes_h.py \
50 nir/nir_constant_expressions.py \
51 nir/nir_opcodes.py \
52 nir/nir_opcodes_c.py \
53 nir/nir_opcodes_h.py \
54 nir/nir_opt_algebraic.py \
55 SConscript
56
57 include Makefile.sources
58
59 TESTS = glcpp/tests/glcpp-test \
60 glcpp/tests/glcpp-test-cr-lf \
61 tests/blob-test \
62 tests/general-ir-test \
63 tests/optimization-test \
64 tests/sampler-types-test \
65 tests/uniform-initializer-test
66
67 TESTS_ENVIRONMENT= \
68 export PYTHON2=$(PYTHON2); \
69 export PYTHON_FLAGS=$(PYTHON_FLAGS);
70
71 noinst_LTLIBRARIES = libnir.la libglsl.la libglcpp.la
72 check_PROGRAMS = \
73 glcpp/glcpp \
74 glsl_test \
75 tests/blob-test \
76 tests/general-ir-test \
77 tests/sampler-types-test \
78 tests/uniform-initializer-test
79
80 noinst_PROGRAMS = glsl_compiler spirv2nir
81
82 tests_blob_test_SOURCES = \
83 tests/blob_test.c
84 tests_blob_test_LDADD = \
85 $(top_builddir)/src/glsl/libglsl.la
86
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/common.c
94 tests_general_ir_test_CFLAGS = \
95 $(PTHREAD_CFLAGS)
96 tests_general_ir_test_LDADD = \
97 $(top_builddir)/src/gtest/libgtest.la \
98 $(top_builddir)/src/glsl/libglsl.la \
99 $(top_builddir)/src/libglsl_util.la \
100 $(PTHREAD_LIBS)
101
102 tests_uniform_initializer_test_SOURCES = \
103 tests/copy_constant_to_storage_tests.cpp \
104 tests/set_uniform_initializer_tests.cpp \
105 tests/uniform_initializer_utils.cpp \
106 tests/uniform_initializer_utils.h \
107 tests/common.c
108 tests_uniform_initializer_test_CFLAGS = \
109 $(PTHREAD_CFLAGS)
110 tests_uniform_initializer_test_LDADD = \
111 $(top_builddir)/src/gtest/libgtest.la \
112 $(top_builddir)/src/glsl/libglsl.la \
113 $(top_builddir)/src/libglsl_util.la \
114 $(PTHREAD_LIBS)
115
116 tests_sampler_types_test_SOURCES = \
117 tests/sampler_types_test.cpp \
118 tests/common.c
119 tests_sampler_types_test_CFLAGS = \
120 $(PTHREAD_CFLAGS)
121 tests_sampler_types_test_LDADD = \
122 $(top_builddir)/src/gtest/libgtest.la \
123 $(top_builddir)/src/glsl/libglsl.la \
124 $(top_builddir)/src/libglsl_util.la \
125 $(PTHREAD_LIBS)
126
127 libglcpp_la_LIBADD = \
128 $(top_builddir)/src/util/libmesautil.la
129 libglcpp_la_SOURCES = \
130 glcpp/glcpp-lex.c \
131 glcpp/glcpp-parse.c \
132 glcpp/glcpp-parse.h \
133 $(LIBGLCPP_FILES)
134
135 glcpp_glcpp_SOURCES = \
136 glcpp/glcpp.c \
137 tests/common.c
138 glcpp_glcpp_LDADD = \
139 libglcpp.la \
140 $(top_builddir)/src/libglsl_util.la \
141 -lm
142
143 libglsl_la_LIBADD = libglcpp.la
144 libglsl_la_SOURCES = \
145 glsl_lexer.cpp \
146 glsl_parser.cpp \
147 glsl_parser.h \
148 $(LIBGLSL_FILES) \
149 $(NIR_FILES)
150
151 libnir_la_SOURCES = \
152 glsl_types.cpp \
153 builtin_types.cpp \
154 glsl_symbol_table.cpp \
155 $(NIR_FILES)
156
157 glsl_compiler_SOURCES = \
158 $(GLSL_COMPILER_CXX_FILES)
159
160 glsl_compiler_LDADD = \
161 libglsl.la \
162 $(top_builddir)/src/libglsl_util.la \
163 $(PTHREAD_LIBS)
164
165 spirv2nir_SOURCES = \
166 standalone_scaffolding.cpp \
167 standalone_scaffolding.h \
168 nir/spirv2nir.c
169
170 spirv2nir_LDADD = \
171 libglsl.la \
172 $(top_builddir)/src/libglsl_util.la \
173 $(PTHREAD_LIBS)
174
175 glsl_test_SOURCES = \
176 standalone_scaffolding.cpp \
177 tests/common.c \
178 test.cpp \
179 test_optpass.cpp \
180 test_optpass.h
181
182 glsl_test_LDADD = \
183 libglsl.la \
184 $(top_builddir)/src/libglsl_util.la \
185 $(PTHREAD_LIBS)
186
187 # We write our own rules for yacc and lex below. We'd rather use automake,
188 # but automake makes it especially difficult for a number of reasons:
189 #
190 # * < automake-1.12 generates .h files from .yy and .ypp files, but
191 # >=automake-1.12 generates .hh and .hpp files respectively. There's no
192 # good way of making a project that uses C++ yacc files compatible with
193 # both versions of automake. Strong work automake developers.
194 #
195 # * Since we're generating code from .l/.y files in a subdirectory (glcpp/)
196 # we'd like the resulting generated code to also go in glcpp/ for purposes
197 # of distribution. Automake gives no way to do this.
198 #
199 # * Since we're building multiple yacc parsers into one library (and via one
200 # Makefile) we have to use per-target YFLAGS. Using per-target YFLAGS causes
201 # automake to name the resulting generated code as <library-name>_filename.c.
202 # Frankly, that's ugly and we don't want a libglcpp_glcpp_parser.h file.
203
204 # In order to make build output print "LEX" and "YACC", we reproduce the
205 # automake variables below.
206
207 AM_V_LEX = $(am__v_LEX_$(V))
208 am__v_LEX_ = $(am__v_LEX_$(AM_DEFAULT_VERBOSITY))
209 am__v_LEX_0 = @echo " LEX " $@;
210 am__v_LEX_1 =
211
212 AM_V_YACC = $(am__v_YACC_$(V))
213 am__v_YACC_ = $(am__v_YACC_$(AM_DEFAULT_VERBOSITY))
214 am__v_YACC_0 = @echo " YACC " $@;
215 am__v_YACC_1 =
216
217 glsl_parser.cpp glsl_parser.h: glsl_parser.yy
218 $(AM_V_YACC) $(YACC) $(YFLAGS) -o $@ -p "_mesa_glsl_" --defines=$(builddir)/glsl_parser.h $<
219
220 glsl_lexer.cpp: glsl_lexer.ll
221 $(AM_V_LEX) $(LEX) $(LFLAGS) -o $@ $<
222
223 glcpp/glcpp-parse.c glcpp/glcpp-parse.h: glcpp/glcpp-parse.y
224 $(AM_V_at)$(MKDIR_P) glcpp
225 $(AM_V_YACC) $(YACC) $(YFLAGS) -o $@ -p "glcpp_parser_" --defines=$(builddir)/glcpp/glcpp-parse.h $<
226
227 glcpp/glcpp-lex.c: glcpp/glcpp-lex.l
228 $(AM_V_at)$(MKDIR_P) glcpp
229 $(AM_V_LEX) $(LEX) $(LFLAGS) -o $@ $<
230
231 # Only the parsers (specifically the header files generated at the same time)
232 # need to be in BUILT_SOURCES. Though if we list the parser headers YACC is
233 # called for the .c/.cpp file and the .h files. By listing the .c/.cpp files
234 # YACC is only executed once for each parser. The rest of the generated code
235 # will be created at the appropriate times according to standard automake
236 # dependency rules.
237 BUILT_SOURCES = \
238 glsl_parser.cpp \
239 glsl_lexer.cpp \
240 glcpp/glcpp-parse.c \
241 glcpp/glcpp-lex.c \
242 nir/nir_builder_opcodes.h \
243 nir/nir_constant_expressions.c \
244 nir/nir_opcodes.c \
245 nir/nir_opcodes.h \
246 nir/nir_opt_algebraic.c
247 CLEANFILES = \
248 glcpp/glcpp-parse.h \
249 glsl_parser.h \
250 $(BUILT_SOURCES)
251
252 clean-local:
253 $(RM) -r subtest-cr subtest-cr-lf subtest-lf subtest-lf-cr
254
255 dist-hook:
256 $(RM) glcpp/tests/*.out
257 $(RM) glcpp/tests/subtest*/*.out
258
259 nir/nir_builder_opcodes.h: nir/nir_opcodes.py nir/nir_builder_opcodes_h.py
260 $(MKDIR_P) nir; \
261 $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/nir/nir_builder_opcodes_h.py > $@
262
263 nir/nir_constant_expressions.c: nir/nir_opcodes.py nir/nir_constant_expressions.py nir/nir_constant_expressions.h
264 $(MKDIR_P) nir; \
265 $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/nir/nir_constant_expressions.py > $@
266
267 nir/nir_opcodes.h: nir/nir_opcodes.py nir/nir_opcodes_h.py
268 $(MKDIR_P) nir; \
269 $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/nir/nir_opcodes_h.py > $@
270
271 nir/nir_opcodes.c: nir/nir_opcodes.py nir/nir_opcodes_c.py
272 $(MKDIR_P) nir; \
273 $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/nir/nir_opcodes_c.py > $@
274
275 nir/nir_opt_algebraic.c: nir/nir_opt_algebraic.py nir/nir_algebraic.py
276 $(MKDIR_P) nir; \
277 $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/nir/nir_opt_algebraic.py > $@