2b5ba59e7fae23f4b3800cc17a8c65d9acc47c12
[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/glsl/glcpp \
28 -I$(top_srcdir)/src/gtest/include \
29 $(DEFINES)
30 AM_CFLAGS = $(VISIBILITY_CFLAGS)
31 AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
32
33 EXTRA_DIST = tests glcpp/tests README TODO \
34 glsl_lexer.ll \
35 glsl_parser.yy \
36 glcpp/glcpp-lex.l \
37 glcpp/glcpp-parse.y
38
39 include Makefile.sources
40
41 TESTS = glcpp/tests/glcpp-test \
42 glcpp/tests/glcpp-test-cr-lf \
43 tests/general-ir-test \
44 tests/optimization-test \
45 tests/sampler-types-test \
46 tests/uniform-initializer-test
47
48 TESTS_ENVIRONMENT= \
49 export PYTHON2=$(PYTHON2); \
50 export PYTHON_FLAGS=$(PYTHON_FLAGS);
51
52 noinst_LTLIBRARIES = libglsl.la libglcpp.la
53 check_PROGRAMS = \
54 glcpp/glcpp \
55 glsl_test \
56 tests/general-ir-test \
57 tests/sampler-types-test \
58 tests/uniform-initializer-test
59
60 noinst_PROGRAMS = glsl_compiler
61
62 tests_general_ir_test_SOURCES = \
63 $(top_srcdir)/src/mesa/main/imports.c \
64 $(top_srcdir)/src/mesa/program/prog_hash_table.c\
65 $(top_srcdir)/src/mesa/program/symbol_table.c \
66 $(GLSL_SRCDIR)/standalone_scaffolding.cpp \
67 tests/builtin_variable_test.cpp \
68 tests/invalidate_locations_test.cpp \
69 tests/general_ir_test.cpp \
70 tests/varyings_test.cpp \
71 tests/common.c
72 tests_general_ir_test_CFLAGS = \
73 $(PTHREAD_CFLAGS)
74 tests_general_ir_test_LDADD = \
75 $(top_builddir)/src/gtest/libgtest.la \
76 $(top_builddir)/src/glsl/libglsl.la \
77 $(PTHREAD_LIBS)
78
79 tests_uniform_initializer_test_SOURCES = \
80 $(top_srcdir)/src/mesa/main/imports.c \
81 $(top_srcdir)/src/mesa/program/prog_hash_table.c\
82 $(top_srcdir)/src/mesa/program/symbol_table.c \
83 tests/copy_constant_to_storage_tests.cpp \
84 tests/set_uniform_initializer_tests.cpp \
85 tests/uniform_initializer_utils.cpp \
86 tests/uniform_initializer_utils.h \
87 tests/common.c
88 tests_uniform_initializer_test_CFLAGS = \
89 $(PTHREAD_CFLAGS)
90 tests_uniform_initializer_test_LDADD = \
91 $(top_builddir)/src/gtest/libgtest.la \
92 $(top_builddir)/src/glsl/libglsl.la \
93 $(PTHREAD_LIBS)
94
95 tests_sampler_types_test_SOURCES = \
96 $(top_srcdir)/src/mesa/program/prog_hash_table.c\
97 $(top_srcdir)/src/mesa/program/symbol_table.c \
98 tests/sampler_types_test.cpp \
99 tests/common.c
100 tests_sampler_types_test_CFLAGS = \
101 $(PTHREAD_CFLAGS)
102 tests_sampler_types_test_LDADD = \
103 $(top_builddir)/src/gtest/libgtest.la \
104 $(top_builddir)/src/glsl/libglsl.la \
105 $(PTHREAD_LIBS)
106
107 libglcpp_la_LIBADD = \
108 $(top_builddir)/src/util/libmesautil.la
109 libglcpp_la_SOURCES = \
110 glcpp/glcpp-lex.c \
111 glcpp/glcpp-parse.c \
112 $(LIBGLCPP_FILES)
113
114 glcpp_glcpp_SOURCES = \
115 glcpp/glcpp.c \
116 tests/common.c \
117 $(top_srcdir)/src/mesa/program/prog_hash_table.c
118 glcpp_glcpp_LDADD = \
119 libglcpp.la \
120 -lm
121
122 libglsl_la_LIBADD = libglcpp.la
123 libglsl_la_SOURCES = \
124 glsl_lexer.cpp \
125 glsl_parser.cpp \
126 $(LIBGLSL_FILES)
127
128 glsl_compiler_SOURCES = \
129 $(top_srcdir)/src/mesa/main/imports.c \
130 $(top_srcdir)/src/mesa/program/prog_hash_table.c \
131 $(top_srcdir)/src/mesa/program/symbol_table.c \
132 $(GLSL_COMPILER_CXX_FILES)
133
134 glsl_compiler_LDADD = \
135 libglsl.la \
136 $(PTHREAD_LIBS)
137
138 glsl_test_SOURCES = \
139 $(top_srcdir)/src/mesa/main/imports.c \
140 $(top_srcdir)/src/mesa/program/prog_hash_table.c \
141 $(top_srcdir)/src/mesa/program/symbol_table.c \
142 $(GLSL_SRCDIR)/standalone_scaffolding.cpp \
143 tests/common.c \
144 test.cpp \
145 test_optpass.cpp \
146 test_optpass.h
147
148 glsl_test_LDADD = libglsl.la
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
170 AM_V_LEX = $(am__v_LEX_$(V))
171 am__v_LEX_ = $(am__v_LEX_$(AM_DEFAULT_VERBOSITY))
172 am__v_LEX_0 = @echo " LEX " $@;
173 am__v_LEX_1 =
174
175 AM_V_YACC = $(am__v_YACC_$(V))
176 am__v_YACC_ = $(am__v_YACC_$(AM_DEFAULT_VERBOSITY))
177 am__v_YACC_0 = @echo " YACC " $@;
178 am__v_YACC_1 =
179
180 glsl_parser.cpp glsl_parser.h: glsl_parser.yy
181 $(AM_V_YACC) $(YACC) $(YFLAGS) -o $@ -p "_mesa_glsl_" --defines=$(GLSL_BUILDDIR)/glsl_parser.h $<
182
183 glsl_lexer.cpp: glsl_lexer.ll
184 $(AM_V_LEX) $(LEX) $(LFLAGS) -o $@ $<
185
186 glcpp/glcpp-parse.c glcpp/glcpp-parse.h: glcpp/glcpp-parse.y
187 $(AM_V_at)$(MKDIR_P) glcpp
188 $(AM_V_YACC) $(YACC) $(YFLAGS) -o $@ -p "glcpp_parser_" --defines=$(GLSL_BUILDDIR)/glcpp/glcpp-parse.h $<
189
190 glcpp/glcpp-lex.c: glcpp/glcpp-lex.l
191 $(AM_V_at)$(MKDIR_P) glcpp
192 $(AM_V_LEX) $(LEX) $(LFLAGS) -o $@ $<
193
194 # Only the parsers (specifically the header files generated at the same time)
195 # need to be in BUILT_SOURCES. Though if we list the parser headers YACC is
196 # called for the .c/.cpp file and the .h files. By listing the .c/.cpp files
197 # YACC is only executed once for each parser. The rest of the generated code
198 # will be created at the appropriate times according to standard automake
199 # dependency rules.
200 BUILT_SOURCES = \
201 glsl_parser.cpp \
202 glsl_lexer.cpp \
203 glcpp/glcpp-parse.c \
204 glcpp/glcpp-lex.c
205 CLEANFILES = \
206 glcpp/glcpp-parse.h \
207 glsl_parser.h \
208 $(BUILT_SOURCES)