nir: Add a foreach_ssa_def function
[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 AM_CPPFLAGS = \
23 -I$(top_srcdir)/include \
24 -I$(top_srcdir)/src \
25 -I$(top_srcdir)/src/mapi \
26 -I$(top_srcdir)/src/mesa/ \
27 -I$(top_srcdir)/src/glsl/glcpp \
28 -I$(top_srcdir)/src/glsl/nir \
29 -I$(top_srcdir)/src/gtest/include \
30 $(DEFINES)
31 AM_CFLAGS = $(VISIBILITY_CFLAGS)
32 AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
33
34 EXTRA_DIST = tests glcpp/tests README TODO glcpp/README \
35 glsl_lexer.ll \
36 glsl_parser.yy \
37 glcpp/glcpp-lex.l \
38 glcpp/glcpp-parse.y \
39 SConscript
40
41 include Makefile.sources
42
43 TESTS = glcpp/tests/glcpp-test \
44 glcpp/tests/glcpp-test-cr-lf \
45 tests/general-ir-test \
46 tests/optimization-test \
47 tests/sampler-types-test \
48 tests/uniform-initializer-test
49
50 TESTS_ENVIRONMENT= \
51 export PYTHON2=$(PYTHON2); \
52 export PYTHON_FLAGS=$(PYTHON_FLAGS);
53
54 noinst_LTLIBRARIES = libglsl.la libglcpp.la
55 check_PROGRAMS = \
56 glcpp/glcpp \
57 glsl_test \
58 tests/general-ir-test \
59 tests/sampler-types-test \
60 tests/uniform-initializer-test
61
62 noinst_PROGRAMS = glsl_compiler
63
64 tests_general_ir_test_SOURCES = \
65 $(top_srcdir)/src/mesa/main/imports.c \
66 $(top_srcdir)/src/mesa/program/prog_hash_table.c\
67 $(top_srcdir)/src/mesa/program/symbol_table.c \
68 $(GLSL_SRCDIR)/standalone_scaffolding.cpp \
69 tests/builtin_variable_test.cpp \
70 tests/invalidate_locations_test.cpp \
71 tests/general_ir_test.cpp \
72 tests/varyings_test.cpp \
73 tests/common.c
74 tests_general_ir_test_CFLAGS = \
75 $(PTHREAD_CFLAGS)
76 tests_general_ir_test_LDADD = \
77 $(top_builddir)/src/gtest/libgtest.la \
78 $(top_builddir)/src/glsl/libglsl.la \
79 $(PTHREAD_LIBS)
80
81 tests_uniform_initializer_test_SOURCES = \
82 $(top_srcdir)/src/mesa/main/imports.c \
83 $(top_srcdir)/src/mesa/program/prog_hash_table.c\
84 $(top_srcdir)/src/mesa/program/symbol_table.c \
85 tests/copy_constant_to_storage_tests.cpp \
86 tests/set_uniform_initializer_tests.cpp \
87 tests/uniform_initializer_utils.cpp \
88 tests/uniform_initializer_utils.h \
89 tests/common.c
90 tests_uniform_initializer_test_CFLAGS = \
91 $(PTHREAD_CFLAGS)
92 tests_uniform_initializer_test_LDADD = \
93 $(top_builddir)/src/gtest/libgtest.la \
94 $(top_builddir)/src/glsl/libglsl.la \
95 $(PTHREAD_LIBS)
96
97 tests_sampler_types_test_SOURCES = \
98 $(top_srcdir)/src/mesa/program/prog_hash_table.c\
99 $(top_srcdir)/src/mesa/program/symbol_table.c \
100 tests/sampler_types_test.cpp \
101 tests/common.c
102 tests_sampler_types_test_CFLAGS = \
103 $(PTHREAD_CFLAGS)
104 tests_sampler_types_test_LDADD = \
105 $(top_builddir)/src/gtest/libgtest.la \
106 $(top_builddir)/src/glsl/libglsl.la \
107 $(PTHREAD_LIBS)
108
109 libglcpp_la_LIBADD = \
110 $(top_builddir)/src/util/libmesautil.la
111 libglcpp_la_SOURCES = \
112 glcpp/glcpp-lex.c \
113 glcpp/glcpp-parse.c \
114 glcpp/glcpp-parse.h \
115 $(LIBGLCPP_FILES)
116
117 glcpp_glcpp_SOURCES = \
118 glcpp/glcpp.c \
119 tests/common.c \
120 $(top_srcdir)/src/mesa/program/prog_hash_table.c
121 glcpp_glcpp_LDADD = \
122 libglcpp.la \
123 -lm
124
125 libglsl_la_LIBADD = libglcpp.la
126 libglsl_la_SOURCES = \
127 glsl_lexer.cpp \
128 glsl_parser.cpp \
129 glsl_parser.h \
130 $(LIBGLSL_FILES) \
131 $(NIR_FILES)
132
133 glsl_compiler_SOURCES = \
134 $(top_srcdir)/src/mesa/main/imports.c \
135 $(top_srcdir)/src/mesa/program/prog_hash_table.c \
136 $(top_srcdir)/src/mesa/program/symbol_table.c \
137 $(GLSL_COMPILER_CXX_FILES)
138
139 glsl_compiler_LDADD = \
140 libglsl.la \
141 $(PTHREAD_LIBS)
142
143 glsl_test_SOURCES = \
144 $(top_srcdir)/src/mesa/main/imports.c \
145 $(top_srcdir)/src/mesa/program/prog_hash_table.c \
146 $(top_srcdir)/src/mesa/program/symbol_table.c \
147 $(GLSL_SRCDIR)/standalone_scaffolding.cpp \
148 tests/common.c \
149 test.cpp \
150 test_optpass.cpp \
151 test_optpass.h
152
153 glsl_test_LDADD = libglsl.la
154
155 # We write our own rules for yacc and lex below. We'd rather use automake,
156 # but automake makes it especially difficult for a number of reasons:
157 #
158 # * < automake-1.12 generates .h files from .yy and .ypp files, but
159 # >=automake-1.12 generates .hh and .hpp files respectively. There's no
160 # good way of making a project that uses C++ yacc files compatible with
161 # both versions of automake. Strong work automake developers.
162 #
163 # * Since we're generating code from .l/.y files in a subdirectory (glcpp/)
164 # we'd like the resulting generated code to also go in glcpp/ for purposes
165 # of distribution. Automake gives no way to do this.
166 #
167 # * Since we're building multiple yacc parsers into one library (and via one
168 # Makefile) we have to use per-target YFLAGS. Using per-target YFLAGS causes
169 # automake to name the resulting generated code as <library-name>_filename.c.
170 # Frankly, that's ugly and we don't want a libglcpp_glcpp_parser.h file.
171
172 # In order to make build output print "LEX" and "YACC", we reproduce the
173 # automake variables below.
174
175 AM_V_LEX = $(am__v_LEX_$(V))
176 am__v_LEX_ = $(am__v_LEX_$(AM_DEFAULT_VERBOSITY))
177 am__v_LEX_0 = @echo " LEX " $@;
178 am__v_LEX_1 =
179
180 AM_V_YACC = $(am__v_YACC_$(V))
181 am__v_YACC_ = $(am__v_YACC_$(AM_DEFAULT_VERBOSITY))
182 am__v_YACC_0 = @echo " YACC " $@;
183 am__v_YACC_1 =
184
185 glsl_parser.cpp glsl_parser.h: glsl_parser.yy
186 $(AM_V_YACC) $(YACC) $(YFLAGS) -o $@ -p "_mesa_glsl_" --defines=$(GLSL_BUILDDIR)/glsl_parser.h $<
187
188 glsl_lexer.cpp: glsl_lexer.ll
189 $(AM_V_LEX) $(LEX) $(LFLAGS) -o $@ $<
190
191 glcpp/glcpp-parse.c glcpp/glcpp-parse.h: glcpp/glcpp-parse.y
192 $(AM_V_at)$(MKDIR_P) glcpp
193 $(AM_V_YACC) $(YACC) $(YFLAGS) -o $@ -p "glcpp_parser_" --defines=$(GLSL_BUILDDIR)/glcpp/glcpp-parse.h $<
194
195 glcpp/glcpp-lex.c: glcpp/glcpp-lex.l
196 $(AM_V_at)$(MKDIR_P) glcpp
197 $(AM_V_LEX) $(LEX) $(LFLAGS) -o $@ $<
198
199 # Only the parsers (specifically the header files generated at the same time)
200 # need to be in BUILT_SOURCES. Though if we list the parser headers YACC is
201 # called for the .c/.cpp file and the .h files. By listing the .c/.cpp files
202 # YACC is only executed once for each parser. The rest of the generated code
203 # will be created at the appropriate times according to standard automake
204 # dependency rules.
205 BUILT_SOURCES = \
206 glsl_parser.cpp \
207 glsl_lexer.cpp \
208 glcpp/glcpp-parse.c \
209 glcpp/glcpp-lex.c \
210 nir/nir_opt_algebraic.c
211 CLEANFILES = \
212 glcpp/glcpp-parse.h \
213 glsl_parser.h \
214 $(BUILT_SOURCES)
215
216 clean-local:
217 $(RM) -r subtest-cr subtest-cr-lf subtest-lf subtest-lf-cr
218
219 dist-hook:
220 $(RM) glcpp/tests/*.out
221 $(RM) glcpp/tests/subtest*/*.out
222
223 nir/nir_opt_algebraic.c: nir/nir_opt_algebraic.py nir/nir_algebraic.py
224 $(MKDIR_P) nir; \
225 $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/nir/nir_opt_algebraic.py > $@