OSDN Git Service

Merge remote-tracking branch 'public/master' into vulkan
[android-x86/external-mesa.git] / src / compiler / Makefile.glsl.am
1 #
2 # Copyright © 2012 Jon TURNEY
3 # Copyright (C) 2015 Intel Corporation
4 #
5 # Permission is hereby granted, free of charge, to any person obtaining a
6 # copy of this software and associated documentation files (the "Software"),
7 # to deal in the Software without restriction, including without limitation
8 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 # and/or sell copies of the Software, and to permit persons to whom the
10 # Software is furnished to do so, subject to the following conditions:
11 #
12 # The above copyright notice and this permission notice (including the next
13 # paragraph) shall be included in all copies or substantial portions of the
14 # Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 # IN THE SOFTWARE.
23
24 EXTRA_DIST += glsl/tests glsl/glcpp/tests glsl/README   \
25         glsl/TODO glsl/glcpp/README                     \
26         glsl/glsl_lexer.ll                              \
27         glsl/glsl_parser.yy                             \
28         glsl/glcpp/glcpp-lex.l                          \
29         glsl/glcpp/glcpp-parse.y                        \
30         SConscript.glsl
31
32 TESTS += glsl/glcpp/tests/glcpp-test                    \
33         glsl/glcpp/tests/glcpp-test-cr-lf               \
34         glsl/tests/blob-test                            \
35         glsl/tests/general-ir-test                      \
36         glsl/tests/optimization-test                    \
37         glsl/tests/sampler-types-test                   \
38         glsl/tests/uniform-initializer-test
39
40 TESTS_ENVIRONMENT= \
41         export PYTHON2=$(PYTHON2); \
42         export PYTHON_FLAGS=$(PYTHON_FLAGS);
43
44 check_PROGRAMS +=                                       \
45         glsl/glcpp/glcpp                                \
46         glsl/glsl_test                                  \
47         glsl/tests/blob-test                            \
48         glsl/tests/general-ir-test                      \
49         glsl/tests/sampler-types-test                   \
50         glsl/tests/uniform-initializer-test
51
52 noinst_PROGRAMS = glsl_compiler
53
54 glsl_tests_blob_test_SOURCES =                          \
55         glsl/tests/blob_test.c
56 glsl_tests_blob_test_LDADD =                            \
57         glsl/libglsl.la
58
59 glsl_tests_general_ir_test_SOURCES =                    \
60         glsl/standalone_scaffolding.cpp                 \
61         glsl/tests/builtin_variable_test.cpp            \
62         glsl/tests/invalidate_locations_test.cpp        \
63         glsl/tests/general_ir_test.cpp                  \
64         glsl/tests/varyings_test.cpp
65 glsl_tests_general_ir_test_CFLAGS =                     \
66         $(PTHREAD_CFLAGS)
67 glsl_tests_general_ir_test_LDADD =                      \
68         $(top_builddir)/src/gtest/libgtest.la           \
69         glsl/libglsl.la         \
70         $(top_builddir)/src/libglsl_util.la             \
71         $(PTHREAD_LIBS)
72
73 glsl_tests_uniform_initializer_test_SOURCES =           \
74         glsl/tests/copy_constant_to_storage_tests.cpp   \
75         glsl/tests/set_uniform_initializer_tests.cpp    \
76         glsl/tests/uniform_initializer_utils.cpp        \
77         glsl/tests/uniform_initializer_utils.h
78 glsl_tests_uniform_initializer_test_CFLAGS =            \
79         $(PTHREAD_CFLAGS)
80 glsl_tests_uniform_initializer_test_LDADD =             \
81         $(top_builddir)/src/gtest/libgtest.la           \
82         glsl/libglsl.la         \
83         $(top_builddir)/src/libglsl_util.la             \
84         $(PTHREAD_LIBS)
85
86 glsl_tests_sampler_types_test_SOURCES =                 \
87         glsl/tests/sampler_types_test.cpp
88 glsl_tests_sampler_types_test_CFLAGS =                  \
89         $(PTHREAD_CFLAGS)
90 glsl_tests_sampler_types_test_LDADD =                   \
91         $(top_builddir)/src/gtest/libgtest.la           \
92         glsl/libglsl.la                                 \
93         $(top_builddir)/src/libglsl_util.la             \
94         $(PTHREAD_LIBS)
95
96 noinst_LTLIBRARIES += glsl/libglsl.la glsl/libglcpp.la
97
98 glsl_libglcpp_la_LIBADD =                               \
99         $(top_builddir)/src/util/libmesautil.la
100 glsl_libglcpp_la_SOURCES =                              \
101         glsl/glcpp/glcpp-lex.c                          \
102         glsl/glcpp/glcpp-parse.c                        \
103         glsl/glcpp/glcpp-parse.h                        \
104         $(LIBGLCPP_FILES)
105
106 glsl_glcpp_glcpp_SOURCES =                              \
107         glsl/glcpp/glcpp.c
108 glsl_glcpp_glcpp_LDADD =                                \
109         glsl/libglcpp.la        \
110         $(top_builddir)/src/libglsl_util.la             \
111         -lm
112
113 glsl_libglsl_la_LIBADD = \
114         nir/libnir.la \
115         glsl/libglcpp.la
116
117 glsl_libglsl_la_SOURCES =                               \
118         glsl/glsl_lexer.cpp                             \
119         glsl/glsl_parser.cpp                            \
120         glsl/glsl_parser.h                              \
121         $(LIBGLSL_FILES)
122
123
124 glsl_compiler_SOURCES = \
125         $(GLSL_COMPILER_CXX_FILES)
126
127 glsl_compiler_LDADD =                                   \
128         glsl/libglsl.la                                 \
129         $(top_builddir)/src/libglsl_util.la             \
130         $(top_builddir)/src/util/libmesautil.la         \
131         $(PTHREAD_LIBS)
132
133 glsl_glsl_test_SOURCES = \
134         glsl/standalone_scaffolding.cpp \
135         glsl/test.cpp \
136         glsl/test_optpass.cpp \
137         glsl/test_optpass.h
138
139 glsl_glsl_test_LDADD =                                  \
140         glsl/libglsl.la                                 \
141         $(top_builddir)/src/libglsl_util.la             \
142         $(PTHREAD_LIBS)
143
144 # We write our own rules for yacc and lex below. We'd rather use automake,
145 # but automake makes it especially difficult for a number of reasons:
146 #
147 #  * < automake-1.12 generates .h files from .yy and .ypp files, but
148 #    >=automake-1.12 generates .hh and .hpp files respectively. There's no
149 #    good way of making a project that uses C++ yacc files compatible with
150 #    both versions of automake. Strong work automake developers.
151 #
152 #  * Since we're generating code from .l/.y files in a subdirectory (glcpp/)
153 #    we'd like the resulting generated code to also go in glcpp/ for purposes
154 #    of distribution. Automake gives no way to do this.
155 #
156 #  * Since we're building multiple yacc parsers into one library (and via one
157 #    Makefile) we have to use per-target YFLAGS. Using per-target YFLAGS causes
158 #    automake to name the resulting generated code as <library-name>_filename.c.
159 #    Frankly, that's ugly and we don't want a libglcpp_glcpp_parser.h file.
160
161 # In order to make build output print "LEX" and "YACC", we reproduce the
162 # automake variables below.
163
164 AM_V_LEX = $(am__v_LEX_$(V))
165 am__v_LEX_ = $(am__v_LEX_$(AM_DEFAULT_VERBOSITY))
166 am__v_LEX_0 = @echo "  LEX     " $@;
167 am__v_LEX_1 =
168
169 AM_V_YACC = $(am__v_YACC_$(V))
170 am__v_YACC_ = $(am__v_YACC_$(AM_DEFAULT_VERBOSITY))
171 am__v_YACC_0 = @echo "  YACC    " $@;
172 am__v_YACC_1 =
173
174 YACC_GEN = $(AM_V_YACC)$(YACC) $(YFLAGS)
175 LEX_GEN = $(AM_V_LEX)$(LEX) $(LFLAGS)
176
177 glsl/glsl_parser.cpp glsl/glsl_parser.h: glsl/glsl_parser.yy
178         $(MKDIR_GEN)
179         $(YACC_GEN) -o $@ -p "_mesa_glsl_" --defines=$(builddir)/glsl/glsl_parser.h $(srcdir)/glsl/glsl_parser.yy
180
181 glsl/glsl_lexer.cpp: glsl/glsl_lexer.ll
182         $(MKDIR_GEN)
183         $(LEX_GEN) -o $@ $(srcdir)/glsl/glsl_lexer.ll
184
185 glsl/glcpp/glcpp-parse.c glsl/glcpp/glcpp-parse.h: glsl/glcpp/glcpp-parse.y
186         $(MKDIR_GEN)
187         $(YACC_GEN) -o $@ -p "glcpp_parser_" --defines=$(builddir)/glsl/glcpp/glcpp-parse.h $(srcdir)/glsl/glcpp/glcpp-parse.y
188
189 glsl/glcpp/glcpp-lex.c: glsl/glcpp/glcpp-lex.l
190         $(MKDIR_GEN)
191         $(LEX_GEN) -o $@ $(srcdir)/glsl/glcpp/glcpp-lex.l
192
193 # Only the parsers (specifically the header files generated at the same time)
194 # need to be in BUILT_SOURCES. Though if we list the parser headers YACC is
195 # called for the .c/.cpp file and the .h files. By listing the .c/.cpp files
196 # YACC is only executed once for each parser. The rest of the generated code
197 # will be created at the appropriate times according to standard automake
198 # dependency rules.
199 BUILT_SOURCES +=                                        \
200         glsl/glsl_parser.cpp                            \
201         glsl/glsl_lexer.cpp                             \
202         glsl/glcpp/glcpp-parse.c                        \
203         glsl/glcpp/glcpp-lex.c
204 CLEANFILES +=                                           \
205         glsl/glcpp/glcpp-parse.h                        \
206         glsl/glsl_parser.h                              \
207         glsl/glsl_parser.cpp                            \
208         glsl/glsl_lexer.cpp                             \
209         glsl/glcpp/glcpp-parse.c                        \
210         glsl/glcpp/glcpp-lex.c
211
212 clean-local:
213         $(RM) -r subtest-cr subtest-cr-lf subtest-lf subtest-lf-cr
214
215 dist-hook:
216         $(RM) glsl/glcpp/tests/*.out
217         $(RM) glsl/glcpp/tests/subtest*/*.out