OSDN Git Service

Merge ../mesa into vulkan
[android-x86/external-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         nir/tests                                       \
54         SConscript
55
56 include Makefile.sources
57
58 TESTS = glcpp/tests/glcpp-test                          \
59         glcpp/tests/glcpp-test-cr-lf                    \
60         nir/tests/control_flow_tests                    \
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         nir/tests/control_flow_tests                    \
76         tests/blob-test                                 \
77         tests/general-ir-test                           \
78         tests/sampler-types-test                        \
79         tests/uniform-initializer-test
80
81 noinst_PROGRAMS = glsl_compiler spirv2nir
82
83 tests_blob_test_SOURCES =                               \
84         tests/blob_test.c
85 tests_blob_test_LDADD =                                 \
86         $(top_builddir)/src/glsl/libglsl.la
87
88 tests_general_ir_test_SOURCES =         \
89         standalone_scaffolding.cpp                      \
90         tests/builtin_variable_test.cpp                 \
91         tests/invalidate_locations_test.cpp             \
92         tests/general_ir_test.cpp                       \
93         tests/varyings_test.cpp
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_uniform_initializer_test_CFLAGS =                 \
108         $(PTHREAD_CFLAGS)
109 tests_uniform_initializer_test_LDADD =                  \
110         $(top_builddir)/src/gtest/libgtest.la           \
111         $(top_builddir)/src/glsl/libglsl.la             \
112         $(top_builddir)/src/libglsl_util.la             \
113         $(PTHREAD_LIBS)
114
115 tests_sampler_types_test_SOURCES =                      \
116         tests/sampler_types_test.cpp
117 tests_sampler_types_test_CFLAGS =                       \
118         $(PTHREAD_CFLAGS)
119 tests_sampler_types_test_LDADD =                        \
120         $(top_builddir)/src/gtest/libgtest.la           \
121         $(top_builddir)/src/glsl/libglsl.la             \
122         $(top_builddir)/src/libglsl_util.la             \
123         $(PTHREAD_LIBS)
124
125 libglcpp_la_LIBADD =                                    \
126         $(top_builddir)/src/util/libmesautil.la
127 libglcpp_la_SOURCES =                                   \
128         glcpp/glcpp-lex.c                               \
129         glcpp/glcpp-parse.c                             \
130         glcpp/glcpp-parse.h                             \
131         $(LIBGLCPP_FILES)
132
133 glcpp_glcpp_SOURCES =                                   \
134         glcpp/glcpp.c
135 glcpp_glcpp_LDADD =                                     \
136         libglcpp.la                                     \
137         $(top_builddir)/src/libglsl_util.la             \
138         -lm
139
140 libglsl_la_LIBADD = libglcpp.la
141 libglsl_la_SOURCES =                                    \
142         glsl_lexer.cpp                                  \
143         glsl_parser.cpp                                 \
144         glsl_parser.h                                   \
145         $(LIBGLSL_FILES)                                \
146         $(NIR_FILES)                                    \
147         $(SPIRV_FILES)                                  \
148         $(NIR_GENERATED_FILES)                          \
149         $(GLSL_TO_NIR_FILES)
150
151 libnir_la_SOURCES =                                     \
152         $(NIR_FILES)                                    \
153         $(SPIRV_FILES)                                  \
154         $(NIR_GENERATED_FILES)
155
156 glsl_compiler_SOURCES = \
157         $(GLSL_COMPILER_CXX_FILES)
158
159 glsl_compiler_LDADD =                                   \
160         libglsl.la                                      \
161         $(top_builddir)/src/libglsl_util.la             \
162         $(top_builddir)/src/util/libmesautil.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         test.cpp \
178         test_optpass.cpp \
179         test_optpass.h
180
181 glsl_test_LDADD =                                       \
182         libglsl.la                                      \
183         $(top_builddir)/src/libglsl_util.la             \
184         $(PTHREAD_LIBS)
185
186 # We write our own rules for yacc and lex below. We'd rather use automake,
187 # but automake makes it especially difficult for a number of reasons:
188 #
189 #  * < automake-1.12 generates .h files from .yy and .ypp files, but
190 #    >=automake-1.12 generates .hh and .hpp files respectively. There's no
191 #    good way of making a project that uses C++ yacc files compatible with
192 #    both versions of automake. Strong work automake developers.
193 #
194 #  * Since we're generating code from .l/.y files in a subdirectory (glcpp/)
195 #    we'd like the resulting generated code to also go in glcpp/ for purposes
196 #    of distribution. Automake gives no way to do this.
197 #
198 #  * Since we're building multiple yacc parsers into one library (and via one
199 #    Makefile) we have to use per-target YFLAGS. Using per-target YFLAGS causes
200 #    automake to name the resulting generated code as <library-name>_filename.c.
201 #    Frankly, that's ugly and we don't want a libglcpp_glcpp_parser.h file.
202
203 # In order to make build output print "LEX" and "YACC", we reproduce the
204 # automake variables below.
205
206 AM_V_LEX = $(am__v_LEX_$(V))
207 am__v_LEX_ = $(am__v_LEX_$(AM_DEFAULT_VERBOSITY))
208 am__v_LEX_0 = @echo "  LEX     " $@;
209 am__v_LEX_1 =
210
211 AM_V_YACC = $(am__v_YACC_$(V))
212 am__v_YACC_ = $(am__v_YACC_$(AM_DEFAULT_VERBOSITY))
213 am__v_YACC_0 = @echo "  YACC    " $@;
214 am__v_YACC_1 =
215
216 MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
217 YACC_GEN = $(AM_V_YACC)$(YACC) $(YFLAGS)
218 LEX_GEN = $(AM_V_LEX)$(LEX) $(LFLAGS)
219
220 glsl_parser.cpp glsl_parser.h: glsl_parser.yy
221         $(YACC_GEN) -o $@ -p "_mesa_glsl_" --defines=$(builddir)/glsl_parser.h $(srcdir)/glsl_parser.yy
222
223 glsl_lexer.cpp: glsl_lexer.ll
224         $(LEX_GEN) -o $@ $(srcdir)/glsl_lexer.ll
225
226 glcpp/glcpp-parse.c glcpp/glcpp-parse.h: glcpp/glcpp-parse.y
227         $(MKDIR_GEN)
228         $(YACC_GEN) -o $@ -p "glcpp_parser_" --defines=$(builddir)/glcpp/glcpp-parse.h $(srcdir)/glcpp/glcpp-parse.y
229
230 glcpp/glcpp-lex.c: glcpp/glcpp-lex.l
231         $(MKDIR_GEN)
232         $(LEX_GEN) -o $@ $(srcdir)/glcpp/glcpp-lex.l
233
234 # Only the parsers (specifically the header files generated at the same time)
235 # need to be in BUILT_SOURCES. Though if we list the parser headers YACC is
236 # called for the .c/.cpp file and the .h files. By listing the .c/.cpp files
237 # YACC is only executed once for each parser. The rest of the generated code
238 # will be created at the appropriate times according to standard automake
239 # dependency rules.
240 BUILT_SOURCES =                                         \
241         glsl_parser.cpp                                 \
242         glsl_lexer.cpp                                  \
243         glcpp/glcpp-parse.c                             \
244         glcpp/glcpp-lex.c                               \
245         $(NIR_GENERATED_FILES)
246 CLEANFILES =                                            \
247         glcpp/glcpp-parse.h                             \
248         glsl_parser.h                                   \
249         $(BUILT_SOURCES)
250
251 clean-local:
252         $(RM) -r subtest-cr subtest-cr-lf subtest-lf subtest-lf-cr
253
254 dist-hook:
255         $(RM) glcpp/tests/*.out
256         $(RM) glcpp/tests/subtest*/*.out
257
258 PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
259
260 nir/nir_builder_opcodes.h: nir/nir_opcodes.py nir/nir_builder_opcodes_h.py
261         $(MKDIR_GEN)
262         $(PYTHON_GEN) $(srcdir)/nir/nir_builder_opcodes_h.py > $@
263
264 nir/nir_constant_expressions.c: nir/nir_opcodes.py nir/nir_constant_expressions.py
265         $(MKDIR_GEN)
266         $(PYTHON_GEN) $(srcdir)/nir/nir_constant_expressions.py > $@
267
268 nir/nir_opcodes.h: nir/nir_opcodes.py nir/nir_opcodes_h.py
269         $(MKDIR_GEN)
270         $(PYTHON_GEN) $(srcdir)/nir/nir_opcodes_h.py > $@
271
272 nir/nir_opcodes.c: nir/nir_opcodes.py nir/nir_opcodes_c.py
273         $(MKDIR_GEN)
274         $(PYTHON_GEN) $(srcdir)/nir/nir_opcodes_c.py > $@
275
276 nir/nir_opt_algebraic.c: nir/nir_opt_algebraic.py nir/nir_algebraic.py
277         $(MKDIR_GEN)
278         $(PYTHON_GEN) $(srcdir)/nir/nir_opt_algebraic.py > $@
279
280 nir_tests_control_flow_tests_SOURCES =                  \
281         nir/tests/control_flow_tests.cpp
282 nir_tests_control_flow_tests_CFLAGS =                   \
283         $(PTHREAD_CFLAGS)
284 nir_tests_control_flow_tests_LDADD =                    \
285         $(top_builddir)/src/gtest/libgtest.la           \
286         $(top_builddir)/src/glsl/libnir.la              \
287         $(top_builddir)/src/util/libmesautil.la         \
288         $(PTHREAD_LIBS)