• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
24EXTRA_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/ir_expression_operation.py			\
29	glsl/glcpp/glcpp-lex.l				\
30	glsl/glcpp/glcpp-parse.y			\
31	SConscript.glsl
32
33TESTS += glsl/glcpp/tests/glcpp-test.sh			\
34	glsl/glcpp/tests/glcpp-test-cr-lf.sh		\
35	glsl/tests/blob-test				\
36	glsl/tests/cache-test				\
37	glsl/tests/general-ir-test			\
38	glsl/tests/optimization-test.sh			\
39	glsl/tests/sampler-types-test			\
40	glsl/tests/uniform-initializer-test             \
41	glsl/tests/warnings-test.sh
42
43TESTS_ENVIRONMENT= \
44	export abs_builddir=$(abs_builddir); \
45	export PYTHON2=$(PYTHON2); \
46	export PYTHON_FLAGS=$(PYTHON_FLAGS);
47
48check_PROGRAMS +=					\
49	glsl/glcpp/glcpp				\
50	glsl/glsl_test					\
51	glsl/tests/blob-test				\
52	glsl/tests/cache-test				\
53	glsl/tests/general-ir-test			\
54	glsl/tests/sampler-types-test			\
55	glsl/tests/uniform-initializer-test
56
57noinst_PROGRAMS = glsl_compiler
58
59glsl_tests_blob_test_SOURCES =				\
60	glsl/tests/blob_test.c
61glsl_tests_blob_test_LDADD =				\
62	glsl/libglsl.la
63
64glsl_tests_cache_test_SOURCES =				\
65	glsl/tests/cache_test.c
66glsl_tests_cache_test_CFLAGS =				\
67	$(PTHREAD_CFLAGS)
68glsl_tests_cache_test_LDADD =				\
69	glsl/libglsl.la					\
70	$(PTHREAD_LIBS)					\
71	$(CLOCK_LIB)
72
73glsl_tests_general_ir_test_SOURCES =			\
74	glsl/tests/array_refcount_test.cpp 		\
75	glsl/tests/builtin_variable_test.cpp		\
76	glsl/tests/invalidate_locations_test.cpp	\
77	glsl/tests/general_ir_test.cpp			\
78	glsl/tests/lower_int64_test.cpp			\
79	glsl/tests/opt_add_neg_to_sub_test.cpp		\
80	glsl/tests/varyings_test.cpp
81glsl_tests_general_ir_test_CFLAGS =			\
82	$(PTHREAD_CFLAGS)
83glsl_tests_general_ir_test_LDADD =			\
84	$(top_builddir)/src/gtest/libgtest.la		\
85	glsl/libglsl.la		\
86	glsl/libstandalone.la				\
87	$(top_builddir)/src/libglsl_util.la		\
88	$(PTHREAD_LIBS)					\
89	$(CLOCK_LIB)
90
91glsl_tests_uniform_initializer_test_SOURCES =		\
92	glsl/tests/copy_constant_to_storage_tests.cpp	\
93	glsl/tests/set_uniform_initializer_tests.cpp	\
94	glsl/tests/uniform_initializer_utils.cpp	\
95	glsl/tests/uniform_initializer_utils.h
96glsl_tests_uniform_initializer_test_CFLAGS =		\
97	$(PTHREAD_CFLAGS)
98glsl_tests_uniform_initializer_test_LDADD =		\
99	$(top_builddir)/src/gtest/libgtest.la		\
100	glsl/libglsl.la		\
101	$(top_builddir)/src/libglsl_util.la		\
102	$(PTHREAD_LIBS)
103
104glsl_tests_sampler_types_test_SOURCES =			\
105	glsl/tests/sampler_types_test.cpp
106glsl_tests_sampler_types_test_CFLAGS =			\
107	$(PTHREAD_CFLAGS)
108glsl_tests_sampler_types_test_LDADD =			\
109	$(top_builddir)/src/gtest/libgtest.la		\
110	glsl/libglsl.la					\
111	$(top_builddir)/src/libglsl_util.la		\
112	$(PTHREAD_LIBS)
113
114noinst_LTLIBRARIES += glsl/libglsl.la glsl/libglcpp.la glsl/libstandalone.la
115
116glsl_libglcpp_la_LIBADD =				\
117	$(top_builddir)/src/util/libmesautil.la
118glsl_libglcpp_la_SOURCES =				\
119	glsl/glcpp/glcpp-lex.c				\
120	glsl/glcpp/glcpp-parse.c			\
121	glsl/glcpp/glcpp-parse.h			\
122	$(LIBGLCPP_FILES)
123
124glsl_glcpp_glcpp_SOURCES =				\
125	glsl/glcpp/glcpp.c
126glsl_glcpp_glcpp_LDADD =				\
127	glsl/libglcpp.la	\
128	$(top_builddir)/src/libglsl_util.la		\
129	-lm
130
131glsl_libglsl_la_LIBADD = \
132	nir/libnir.la \
133	glsl/libglcpp.la
134
135glsl_libglsl_la_SOURCES =				\
136	$(LIBGLSL_GENERATED_FILES)			\
137	$(LIBGLSL_FILES)				\
138	$(LIBGLSL_SHADER_CACHE_FILES)
139
140glsl_libstandalone_la_SOURCES = \
141	$(GLSL_COMPILER_CXX_FILES)
142
143glsl_libstandalone_la_LIBADD =				\
144	glsl/libglsl.la					\
145	$(top_builddir)/src/libglsl_util.la		\
146	$(top_builddir)/src/util/libmesautil.la		\
147	$(PTHREAD_LIBS)
148
149glsl_compiler_SOURCES = \
150	glsl/main.cpp
151
152glsl_compiler_LDADD = \
153	glsl/libstandalone.la \
154	$(CLOCK_LIB)
155
156glsl_glsl_test_SOURCES = \
157	glsl/test.cpp \
158	glsl/test_optpass.cpp \
159	glsl/test_optpass.h
160
161glsl_glsl_test_LDADD =					\
162	glsl/libglsl.la					\
163	glsl/libstandalone.la				\
164	$(top_builddir)/src/libglsl_util.la		\
165	$(PTHREAD_LIBS)					\
166	$(CLOCK_LIB)
167
168# We write our own rules for yacc and lex below. We'd rather use automake,
169# but automake makes it especially difficult for a number of reasons:
170#
171#  * < automake-1.12 generates .h files from .yy and .ypp files, but
172#    >=automake-1.12 generates .hh and .hpp files respectively. There's no
173#    good way of making a project that uses C++ yacc files compatible with
174#    both versions of automake. Strong work automake developers.
175#
176#  * Since we're generating code from .l/.y files in a subdirectory (glcpp/)
177#    we'd like the resulting generated code to also go in glcpp/ for purposes
178#    of distribution. Automake gives no way to do this.
179#
180#  * Since we're building multiple yacc parsers into one library (and via one
181#    Makefile) we have to use per-target YFLAGS. Using per-target YFLAGS causes
182#    automake to name the resulting generated code as <library-name>_filename.c.
183#    Frankly, that's ugly and we don't want a libglcpp_glcpp_parser.h file.
184
185# In order to make build output print "LEX" and "YACC", we reproduce the
186# automake variables below.
187
188AM_V_LEX = $(am__v_LEX_$(V))
189am__v_LEX_ = $(am__v_LEX_$(AM_DEFAULT_VERBOSITY))
190am__v_LEX_0 = @echo "  LEX     " $@;
191am__v_LEX_1 =
192
193AM_V_YACC = $(am__v_YACC_$(V))
194am__v_YACC_ = $(am__v_YACC_$(AM_DEFAULT_VERBOSITY))
195am__v_YACC_0 = @echo "  YACC    " $@;
196am__v_YACC_1 =
197
198YACC_GEN = $(AM_V_YACC)$(YACC) $(YFLAGS)
199LEX_GEN = $(AM_V_LEX)$(LEX) $(LFLAGS)
200
201glsl/glsl_parser.cpp glsl/glsl_parser.h: glsl/glsl_parser.yy
202	$(MKDIR_GEN)
203	$(YACC_GEN) -o $@ -p "_mesa_glsl_" --defines=$(builddir)/glsl/glsl_parser.h $(srcdir)/glsl/glsl_parser.yy
204
205glsl/glsl_lexer.cpp: glsl/glsl_lexer.ll
206	$(MKDIR_GEN)
207	$(LEX_GEN) -o $@ $(srcdir)/glsl/glsl_lexer.ll
208
209glsl/glcpp/glcpp-parse.c glsl/glcpp/glcpp-parse.h: glsl/glcpp/glcpp-parse.y
210	$(MKDIR_GEN)
211	$(YACC_GEN) -o $@ -p "glcpp_parser_" --defines=$(builddir)/glsl/glcpp/glcpp-parse.h $(srcdir)/glsl/glcpp/glcpp-parse.y
212
213glsl/glcpp/glcpp-lex.c: glsl/glcpp/glcpp-lex.l
214	$(MKDIR_GEN)
215	$(LEX_GEN) -o $@ $(srcdir)/glsl/glcpp/glcpp-lex.l
216
217glsl/ir_expression_operation.h: glsl/ir_expression_operation.py
218	$(MKDIR_GEN)
219	$(PYTHON_GEN) $(srcdir)/glsl/ir_expression_operation.py enum > $@ || ($(RM) $@; false)
220
221glsl/ir_expression_operation_constant.h: glsl/ir_expression_operation.py
222	$(MKDIR_GEN)
223	$(PYTHON_GEN) $(srcdir)/glsl/ir_expression_operation.py constant > $@ || ($(RM) $@; false)
224
225glsl/ir_expression_operation_strings.h: glsl/ir_expression_operation.py
226	$(MKDIR_GEN)
227	$(PYTHON_GEN) $(srcdir)/glsl/ir_expression_operation.py strings > $@ || ($(RM) $@; false)
228
229# Only the parsers (specifically the header files generated at the same time)
230# need to be in BUILT_SOURCES. Though if we list the parser headers YACC is
231# called for the .c/.cpp file and the .h files. By listing the .c/.cpp files
232# YACC is only executed once for each parser. The rest of the generated code
233# will be created at the appropriate times according to standard automake
234# dependency rules.
235BUILT_SOURCES +=					\
236	glsl/glsl_parser.cpp				\
237	glsl/glsl_lexer.cpp				\
238	glsl/ir_expression_operation.h			\
239	glsl/ir_expression_operation_constant.h		\
240	glsl/ir_expression_operation_strings.h		\
241	glsl/glcpp/glcpp-parse.c			\
242	glsl/glcpp/glcpp-lex.c
243CLEANFILES +=						\
244	glsl/glcpp/glcpp-parse.h			\
245	glsl/glsl_parser.h				\
246	glsl/glsl_parser.cpp				\
247	glsl/glsl_lexer.cpp				\
248	glsl/ir_expression_operation.h			\
249	glsl/ir_expression_operation_constant.h		\
250	glsl/ir_expression_operation_strings.h		\
251	glsl/glcpp/glcpp-parse.c			\
252	glsl/glcpp/glcpp-lex.c
253
254clean-local:
255	$(RM) glsl/tests/lower_jumps/*.opt_test
256	$(RM) glsl/tests/lower_jumps/*.expected
257	$(RM) glsl/tests/lower_jumps/*.out
258	$(RM) glsl/tests/warnings/*.out
259	$(RM) glsl/glcpp/tests/*.out
260	$(RM) -r glsl/glcpp/tests/subtest*/
261	$(RM) -r subtest-cr subtest-cr-lf subtest-lf subtest-lf-cr
262
263dist-hook:
264	$(RM) glsl/glcpp/tests/*.out
265	$(RM) glsl/glcpp/tests/subtest*/*.out
266