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