Merge commit mesa-public/master into vulkan
[mesa.git] / src / compiler / 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/gtest/include \
31 $(DEFINES)
32 AM_CFLAGS = \
33 $(VISIBILITY_CFLAGS) \
34 $(MSVC2013_COMPAT_CFLAGS)
35 AM_CXXFLAGS = \
36 $(VISIBILITY_CXXFLAGS) \
37 $(MSVC2013_COMPAT_CXXFLAGS)
38
39 EXTRA_DIST = tests glcpp/tests README TODO glcpp/README \
40 glsl_lexer.ll \
41 glsl_parser.yy \
42 glcpp/glcpp-lex.l \
43 glcpp/glcpp-parse.y \
44 SConscript
45
46 include Makefile.sources
47
48 TESTS = glcpp/tests/glcpp-test \
49 glcpp/tests/glcpp-test-cr-lf \
50 tests/blob-test \
51 tests/general-ir-test \
52 tests/optimization-test \
53 tests/sampler-types-test \
54 tests/uniform-initializer-test
55
56 TESTS_ENVIRONMENT= \
57 export PYTHON2=$(PYTHON2); \
58 export PYTHON_FLAGS=$(PYTHON_FLAGS);
59
60 noinst_LTLIBRARIES = libglsl.la libglcpp.la
61 check_PROGRAMS = \
62 glcpp/glcpp \
63 glsl_test \
64 tests/blob-test \
65 tests/general-ir-test \
66 tests/sampler-types-test \
67 tests/uniform-initializer-test
68
69 noinst_PROGRAMS = glsl_compiler spirv2nir
70
71 tests_blob_test_SOURCES = \
72 tests/blob_test.c
73 tests_blob_test_LDADD = \
74 $(top_builddir)/src/glsl/libglsl.la
75
76 tests_general_ir_test_SOURCES = \
77 standalone_scaffolding.cpp \
78 tests/builtin_variable_test.cpp \
79 tests/invalidate_locations_test.cpp \
80 tests/general_ir_test.cpp \
81 tests/varyings_test.cpp
82 tests_general_ir_test_CFLAGS = \
83 $(PTHREAD_CFLAGS)
84 tests_general_ir_test_LDADD = \
85 $(top_builddir)/src/gtest/libgtest.la \
86 $(top_builddir)/src/glsl/libglsl.la \
87 $(top_builddir)/src/libglsl_util.la \
88 $(PTHREAD_LIBS)
89
90 tests_uniform_initializer_test_SOURCES = \
91 tests/copy_constant_to_storage_tests.cpp \
92 tests/set_uniform_initializer_tests.cpp \
93 tests/uniform_initializer_utils.cpp \
94 tests/uniform_initializer_utils.h
95 tests_uniform_initializer_test_CFLAGS = \
96 $(PTHREAD_CFLAGS)
97 tests_uniform_initializer_test_LDADD = \
98 $(top_builddir)/src/gtest/libgtest.la \
99 $(top_builddir)/src/glsl/libglsl.la \
100 $(top_builddir)/src/libglsl_util.la \
101 $(PTHREAD_LIBS)
102
103 tests_sampler_types_test_SOURCES = \
104 tests/sampler_types_test.cpp
105 tests_sampler_types_test_CFLAGS = \
106 $(PTHREAD_CFLAGS)
107 tests_sampler_types_test_LDADD = \
108 $(top_builddir)/src/gtest/libgtest.la \
109 $(top_builddir)/src/glsl/libglsl.la \
110 $(top_builddir)/src/libglsl_util.la \
111 $(PTHREAD_LIBS)
112
113 libglcpp_la_LIBADD = \
114 $(top_builddir)/src/util/libmesautil.la
115 libglcpp_la_SOURCES = \
116 glcpp/glcpp-lex.c \
117 glcpp/glcpp-parse.c \
118 glcpp/glcpp-parse.h \
119 $(LIBGLCPP_FILES)
120
121 glcpp_glcpp_SOURCES = \
122 glcpp/glcpp.c
123 glcpp_glcpp_LDADD = \
124 libglcpp.la \
125 $(top_builddir)/src/libglsl_util.la \
126 -lm
127
128 libglsl_la_LIBADD = \
129 $(top_builddir)/src/compiler/nir/libnir.la \
130 libglcpp.la
131
132 libglsl_la_SOURCES = \
133 glsl_lexer.cpp \
134 glsl_parser.cpp \
135 glsl_parser.h \
136 $(LIBGLSL_FILES)
137
138 glsl_compiler_SOURCES = \
139 $(GLSL_COMPILER_CXX_FILES)
140
141 glsl_compiler_LDADD = \
142 libglsl.la \
143 $(top_builddir)/src/libglsl_util.la \
144 $(top_builddir)/src/util/libmesautil.la \
145 $(PTHREAD_LIBS)
146
147 spirv2nir_SOURCES = \
148 standalone_scaffolding.cpp \
149 standalone_scaffolding.h \
150 nir/spirv2nir.c
151
152 spirv2nir_LDADD = \
153 libglsl.la \
154 $(top_builddir)/src/libglsl_util.la \
155 $(PTHREAD_LIBS)
156
157 glsl_test_SOURCES = \
158 standalone_scaffolding.cpp \
159 test.cpp \
160 test_optpass.cpp \
161 test_optpass.h
162
163 glsl_test_LDADD = \
164 libglsl.la \
165 $(top_builddir)/src/libglsl_util.la \
166 $(PTHREAD_LIBS)
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
188 AM_V_LEX = $(am__v_LEX_$(V))
189 am__v_LEX_ = $(am__v_LEX_$(AM_DEFAULT_VERBOSITY))
190 am__v_LEX_0 = @echo " LEX " $@;
191 am__v_LEX_1 =
192
193 AM_V_YACC = $(am__v_YACC_$(V))
194 am__v_YACC_ = $(am__v_YACC_$(AM_DEFAULT_VERBOSITY))
195 am__v_YACC_0 = @echo " YACC " $@;
196 am__v_YACC_1 =
197
198 MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
199 YACC_GEN = $(AM_V_YACC)$(YACC) $(YFLAGS)
200 LEX_GEN = $(AM_V_LEX)$(LEX) $(LFLAGS)
201
202 glsl_parser.cpp glsl_parser.h: glsl_parser.yy
203 $(YACC_GEN) -o $@ -p "_mesa_glsl_" --defines=$(builddir)/glsl_parser.h $(srcdir)/glsl_parser.yy
204
205 glsl_lexer.cpp: glsl_lexer.ll
206 $(LEX_GEN) -o $@ $(srcdir)/glsl_lexer.ll
207
208 glcpp/glcpp-parse.c glcpp/glcpp-parse.h: glcpp/glcpp-parse.y
209 $(MKDIR_GEN)
210 $(YACC_GEN) -o $@ -p "glcpp_parser_" --defines=$(builddir)/glcpp/glcpp-parse.h $(srcdir)/glcpp/glcpp-parse.y
211
212 glcpp/glcpp-lex.c: glcpp/glcpp-lex.l
213 $(MKDIR_GEN)
214 $(LEX_GEN) -o $@ $(srcdir)/glcpp/glcpp-lex.l
215
216 # Only the parsers (specifically the header files generated at the same time)
217 # need to be in BUILT_SOURCES. Though if we list the parser headers YACC is
218 # called for the .c/.cpp file and the .h files. By listing the .c/.cpp files
219 # YACC is only executed once for each parser. The rest of the generated code
220 # will be created at the appropriate times according to standard automake
221 # dependency rules.
222 BUILT_SOURCES = \
223 glsl_parser.cpp \
224 glsl_lexer.cpp \
225 glcpp/glcpp-parse.c \
226 glcpp/glcpp-lex.c
227 CLEANFILES = \
228 glcpp/glcpp-parse.h \
229 glsl_parser.h \
230 $(BUILT_SOURCES)
231
232 clean-local:
233 $(RM) -r subtest-cr subtest-cr-lf subtest-lf subtest-lf-cr
234
235 dist-hook:
236 $(RM) glcpp/tests/*.out
237 $(RM) glcpp/tests/subtest*/*.out