blob: b8225cbe206947d83b21ee3b0e02dc52ae6f4763 [file] [log] [blame]
Emil Velikov9324afc2016-04-05 14:40:42 +01001#
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 \
Ian Romanick7d6af9e2015-04-15 16:59:43 -070028 glsl/ir_expression_operation.py \
Emil Velikov9324afc2016-04-05 14:40:42 +010029 glsl/glcpp/glcpp-lex.l \
30 glsl/glcpp/glcpp-parse.y \
31 SConscript.glsl
32
33TESTS += glsl/glcpp/tests/glcpp-test \
34 glsl/glcpp/tests/glcpp-test-cr-lf \
35 glsl/tests/blob-test \
36 glsl/tests/general-ir-test \
37 glsl/tests/optimization-test \
38 glsl/tests/sampler-types-test \
Alejandro Piñeiroeee00272016-04-19 21:03:07 +020039 glsl/tests/uniform-initializer-test \
40 glsl/tests/warnings-test
Emil Velikov9324afc2016-04-05 14:40:42 +010041
42TESTS_ENVIRONMENT= \
43 export PYTHON2=$(PYTHON2); \
44 export PYTHON_FLAGS=$(PYTHON_FLAGS);
45
46check_PROGRAMS += \
47 glsl/glcpp/glcpp \
48 glsl/glsl_test \
49 glsl/tests/blob-test \
50 glsl/tests/general-ir-test \
51 glsl/tests/sampler-types-test \
52 glsl/tests/uniform-initializer-test
53
54noinst_PROGRAMS = glsl_compiler
55
56glsl_tests_blob_test_SOURCES = \
57 glsl/tests/blob_test.c
58glsl_tests_blob_test_LDADD = \
59 glsl/libglsl.la
60
61glsl_tests_general_ir_test_SOURCES = \
Emil Velikov9324afc2016-04-05 14:40:42 +010062 glsl/tests/builtin_variable_test.cpp \
63 glsl/tests/invalidate_locations_test.cpp \
64 glsl/tests/general_ir_test.cpp \
65 glsl/tests/varyings_test.cpp
66glsl_tests_general_ir_test_CFLAGS = \
67 $(PTHREAD_CFLAGS)
68glsl_tests_general_ir_test_LDADD = \
69 $(top_builddir)/src/gtest/libgtest.la \
70 glsl/libglsl.la \
Rob Clark0f982bb2016-05-14 11:59:26 -040071 glsl/libstandalone.la \
Emil Velikov9324afc2016-04-05 14:40:42 +010072 $(top_builddir)/src/libglsl_util.la \
73 $(PTHREAD_LIBS)
74
75glsl_tests_uniform_initializer_test_SOURCES = \
76 glsl/tests/copy_constant_to_storage_tests.cpp \
77 glsl/tests/set_uniform_initializer_tests.cpp \
78 glsl/tests/uniform_initializer_utils.cpp \
79 glsl/tests/uniform_initializer_utils.h
80glsl_tests_uniform_initializer_test_CFLAGS = \
81 $(PTHREAD_CFLAGS)
82glsl_tests_uniform_initializer_test_LDADD = \
83 $(top_builddir)/src/gtest/libgtest.la \
84 glsl/libglsl.la \
85 $(top_builddir)/src/libglsl_util.la \
86 $(PTHREAD_LIBS)
87
88glsl_tests_sampler_types_test_SOURCES = \
89 glsl/tests/sampler_types_test.cpp
90glsl_tests_sampler_types_test_CFLAGS = \
91 $(PTHREAD_CFLAGS)
92glsl_tests_sampler_types_test_LDADD = \
93 $(top_builddir)/src/gtest/libgtest.la \
94 glsl/libglsl.la \
95 $(top_builddir)/src/libglsl_util.la \
96 $(PTHREAD_LIBS)
97
Rob Clark0f982bb2016-05-14 11:59:26 -040098noinst_LTLIBRARIES += glsl/libglsl.la glsl/libglcpp.la glsl/libstandalone.la
Emil Velikov9324afc2016-04-05 14:40:42 +010099
100glsl_libglcpp_la_LIBADD = \
101 $(top_builddir)/src/util/libmesautil.la
102glsl_libglcpp_la_SOURCES = \
103 glsl/glcpp/glcpp-lex.c \
104 glsl/glcpp/glcpp-parse.c \
105 glsl/glcpp/glcpp-parse.h \
106 $(LIBGLCPP_FILES)
107
108glsl_glcpp_glcpp_SOURCES = \
109 glsl/glcpp/glcpp.c
110glsl_glcpp_glcpp_LDADD = \
111 glsl/libglcpp.la \
112 $(top_builddir)/src/libglsl_util.la \
113 -lm
114
115glsl_libglsl_la_LIBADD = \
116 nir/libnir.la \
117 glsl/libglcpp.la
118
119glsl_libglsl_la_SOURCES = \
Ian Romanickde71bc92016-07-13 18:02:10 -0700120 $(LIBGLSL_GENERATED_FILES) \
Emil Velikov9324afc2016-04-05 14:40:42 +0100121 $(LIBGLSL_FILES)
122
123
Rob Clark0f982bb2016-05-14 11:59:26 -0400124glsl_libstandalone_la_SOURCES = \
Emil Velikov9324afc2016-04-05 14:40:42 +0100125 $(GLSL_COMPILER_CXX_FILES)
126
Rob Clark0f982bb2016-05-14 11:59:26 -0400127glsl_libstandalone_la_LIBADD = \
Emil Velikov9324afc2016-04-05 14:40:42 +0100128 glsl/libglsl.la \
129 $(top_builddir)/src/libglsl_util.la \
130 $(top_builddir)/src/util/libmesautil.la \
131 $(PTHREAD_LIBS)
132
Rob Clark0f982bb2016-05-14 11:59:26 -0400133glsl_compiler_SOURCES = \
134 glsl/main.cpp
135
136glsl_compiler_LDADD = \
137 glsl/libstandalone.la
138
Emil Velikov9324afc2016-04-05 14:40:42 +0100139glsl_glsl_test_SOURCES = \
Emil Velikov9324afc2016-04-05 14:40:42 +0100140 glsl/test.cpp \
141 glsl/test_optpass.cpp \
142 glsl/test_optpass.h
143
144glsl_glsl_test_LDADD = \
145 glsl/libglsl.la \
Rob Clark0f982bb2016-05-14 11:59:26 -0400146 glsl/libstandalone.la \
Emil Velikov9324afc2016-04-05 14:40:42 +0100147 $(top_builddir)/src/libglsl_util.la \
148 $(PTHREAD_LIBS)
149
150# We write our own rules for yacc and lex below. We'd rather use automake,
151# but automake makes it especially difficult for a number of reasons:
152#
153# * < automake-1.12 generates .h files from .yy and .ypp files, but
154# >=automake-1.12 generates .hh and .hpp files respectively. There's no
155# good way of making a project that uses C++ yacc files compatible with
156# both versions of automake. Strong work automake developers.
157#
158# * Since we're generating code from .l/.y files in a subdirectory (glcpp/)
159# we'd like the resulting generated code to also go in glcpp/ for purposes
160# of distribution. Automake gives no way to do this.
161#
162# * Since we're building multiple yacc parsers into one library (and via one
163# Makefile) we have to use per-target YFLAGS. Using per-target YFLAGS causes
164# automake to name the resulting generated code as <library-name>_filename.c.
165# Frankly, that's ugly and we don't want a libglcpp_glcpp_parser.h file.
166
167# In order to make build output print "LEX" and "YACC", we reproduce the
168# automake variables below.
169
170AM_V_LEX = $(am__v_LEX_$(V))
171am__v_LEX_ = $(am__v_LEX_$(AM_DEFAULT_VERBOSITY))
172am__v_LEX_0 = @echo " LEX " $@;
173am__v_LEX_1 =
174
175AM_V_YACC = $(am__v_YACC_$(V))
176am__v_YACC_ = $(am__v_YACC_$(AM_DEFAULT_VERBOSITY))
177am__v_YACC_0 = @echo " YACC " $@;
178am__v_YACC_1 =
179
180YACC_GEN = $(AM_V_YACC)$(YACC) $(YFLAGS)
181LEX_GEN = $(AM_V_LEX)$(LEX) $(LFLAGS)
Ian Romanick7d6af9e2015-04-15 16:59:43 -0700182PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
Emil Velikov9324afc2016-04-05 14:40:42 +0100183
184glsl/glsl_parser.cpp glsl/glsl_parser.h: glsl/glsl_parser.yy
185 $(MKDIR_GEN)
186 $(YACC_GEN) -o $@ -p "_mesa_glsl_" --defines=$(builddir)/glsl/glsl_parser.h $(srcdir)/glsl/glsl_parser.yy
187
188glsl/glsl_lexer.cpp: glsl/glsl_lexer.ll
189 $(MKDIR_GEN)
190 $(LEX_GEN) -o $@ $(srcdir)/glsl/glsl_lexer.ll
191
192glsl/glcpp/glcpp-parse.c glsl/glcpp/glcpp-parse.h: glsl/glcpp/glcpp-parse.y
193 $(MKDIR_GEN)
194 $(YACC_GEN) -o $@ -p "glcpp_parser_" --defines=$(builddir)/glsl/glcpp/glcpp-parse.h $(srcdir)/glsl/glcpp/glcpp-parse.y
195
196glsl/glcpp/glcpp-lex.c: glsl/glcpp/glcpp-lex.l
197 $(MKDIR_GEN)
198 $(LEX_GEN) -o $@ $(srcdir)/glsl/glcpp/glcpp-lex.l
199
Ian Romanick7d6af9e2015-04-15 16:59:43 -0700200glsl/ir_expression_operation.h: glsl/ir_expression_operation.py
201 $(MKDIR_GEN)
Ian Romanickfb44f692015-04-15 17:50:57 -0700202 $(PYTHON_GEN) $(srcdir)/glsl/ir_expression_operation.py enum > $@ || ($(RM) $@; false)
203
Ian Romanickee3cdac2016-07-12 16:42:36 -0700204glsl/ir_expression_operation_constant.h: glsl/ir_expression_operation.py
205 $(MKDIR_GEN)
206 $(PYTHON_GEN) $(srcdir)/glsl/ir_expression_operation.py constant > $@ || ($(RM) $@; false)
207
Ian Romanickfb44f692015-04-15 17:50:57 -0700208glsl/ir_expression_operation_strings.h: glsl/ir_expression_operation.py
209 $(MKDIR_GEN)
210 $(PYTHON_GEN) $(srcdir)/glsl/ir_expression_operation.py strings > $@ || ($(RM) $@; false)
Ian Romanick7d6af9e2015-04-15 16:59:43 -0700211
Emil Velikov9324afc2016-04-05 14:40:42 +0100212# Only the parsers (specifically the header files generated at the same time)
213# need to be in BUILT_SOURCES. Though if we list the parser headers YACC is
214# called for the .c/.cpp file and the .h files. By listing the .c/.cpp files
215# YACC is only executed once for each parser. The rest of the generated code
216# will be created at the appropriate times according to standard automake
217# dependency rules.
218BUILT_SOURCES += \
219 glsl/glsl_parser.cpp \
220 glsl/glsl_lexer.cpp \
Ian Romanick7d6af9e2015-04-15 16:59:43 -0700221 glsl/ir_expression_operation.h \
Ian Romanickee3cdac2016-07-12 16:42:36 -0700222 glsl/ir_expression_operation_constant.h \
Ian Romanickfb44f692015-04-15 17:50:57 -0700223 glsl/ir_expression_operation_strings.h \
Emil Velikov9324afc2016-04-05 14:40:42 +0100224 glsl/glcpp/glcpp-parse.c \
225 glsl/glcpp/glcpp-lex.c
226CLEANFILES += \
227 glsl/glcpp/glcpp-parse.h \
228 glsl/glsl_parser.h \
229 glsl/glsl_parser.cpp \
230 glsl/glsl_lexer.cpp \
Ian Romanick7d6af9e2015-04-15 16:59:43 -0700231 glsl/ir_expression_operation.h \
Ian Romanickee3cdac2016-07-12 16:42:36 -0700232 glsl/ir_expression_operation_constant.h \
Ian Romanickfb44f692015-04-15 17:50:57 -0700233 glsl/ir_expression_operation_strings.h \
Emil Velikov9324afc2016-04-05 14:40:42 +0100234 glsl/glcpp/glcpp-parse.c \
235 glsl/glcpp/glcpp-lex.c
236
237clean-local:
238 $(RM) -r subtest-cr subtest-cr-lf subtest-lf subtest-lf-cr
239
240dist-hook:
241 $(RM) glsl/glcpp/tests/*.out
242 $(RM) glsl/glcpp/tests/subtest*/*.out