OSDN Git Service

mesa: Add notes/readme files to distribution.
[android-x86/external-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 glcpp/README \
34         glsl_lexer.ll                                   \
35         glsl_parser.yy                                  \
36         glcpp/glcpp-lex.l                               \
37         glcpp/glcpp-parse.y                             \
38         SConscript
39
40 include Makefile.sources
41
42 TESTS = glcpp/tests/glcpp-test                          \
43         glcpp/tests/glcpp-test-cr-lf                    \
44         tests/general-ir-test                           \
45         tests/optimization-test                         \
46         tests/sampler-types-test                        \
47         tests/uniform-initializer-test
48
49 TESTS_ENVIRONMENT= \
50         export PYTHON2=$(PYTHON2); \
51         export PYTHON_FLAGS=$(PYTHON_FLAGS);
52
53 noinst_LTLIBRARIES = libglsl.la libglcpp.la
54 check_PROGRAMS =                                        \
55         glcpp/glcpp                                     \
56         glsl_test                                       \
57         tests/general-ir-test                           \
58         tests/sampler-types-test                        \
59         tests/uniform-initializer-test
60
61 noinst_PROGRAMS = glsl_compiler
62
63 tests_general_ir_test_SOURCES =         \
64         $(top_srcdir)/src/mesa/main/imports.c           \
65         $(top_srcdir)/src/mesa/program/prog_hash_table.c\
66         $(top_srcdir)/src/mesa/program/symbol_table.c   \
67         $(GLSL_SRCDIR)/standalone_scaffolding.cpp \
68         tests/builtin_variable_test.cpp                 \
69         tests/invalidate_locations_test.cpp             \
70         tests/general_ir_test.cpp                       \
71         tests/varyings_test.cpp                         \
72         tests/common.c
73 tests_general_ir_test_CFLAGS =                          \
74         $(PTHREAD_CFLAGS)
75 tests_general_ir_test_LDADD =                           \
76         $(top_builddir)/src/gtest/libgtest.la           \
77         $(top_builddir)/src/glsl/libglsl.la             \
78         $(PTHREAD_LIBS)
79
80 tests_uniform_initializer_test_SOURCES =                \
81         $(top_srcdir)/src/mesa/main/imports.c           \
82         $(top_srcdir)/src/mesa/program/prog_hash_table.c\
83         $(top_srcdir)/src/mesa/program/symbol_table.c   \
84         tests/copy_constant_to_storage_tests.cpp        \
85         tests/set_uniform_initializer_tests.cpp         \
86         tests/uniform_initializer_utils.cpp             \
87         tests/uniform_initializer_utils.h               \
88         tests/common.c
89 tests_uniform_initializer_test_CFLAGS =                 \
90         $(PTHREAD_CFLAGS)
91 tests_uniform_initializer_test_LDADD =                  \
92         $(top_builddir)/src/gtest/libgtest.la           \
93         $(top_builddir)/src/glsl/libglsl.la             \
94         $(PTHREAD_LIBS)
95
96 tests_sampler_types_test_SOURCES =                      \
97         $(top_srcdir)/src/mesa/program/prog_hash_table.c\
98         $(top_srcdir)/src/mesa/program/symbol_table.c   \
99         tests/sampler_types_test.cpp                    \
100         tests/common.c
101 tests_sampler_types_test_CFLAGS =                       \
102         $(PTHREAD_CFLAGS)
103 tests_sampler_types_test_LDADD =                        \
104         $(top_builddir)/src/gtest/libgtest.la           \
105         $(top_builddir)/src/glsl/libglsl.la             \
106         $(PTHREAD_LIBS)
107
108 libglcpp_la_LIBADD =                                    \
109         $(top_builddir)/src/util/libmesautil.la
110 libglcpp_la_SOURCES =                                   \
111         glcpp/glcpp-lex.c                               \
112         glcpp/glcpp-parse.c                             \
113         glcpp/glcpp-parse.h                             \
114         $(LIBGLCPP_FILES)
115
116 glcpp_glcpp_SOURCES =                                   \
117         glcpp/glcpp.c                                   \
118         tests/common.c                                  \
119         $(top_srcdir)/src/mesa/program/prog_hash_table.c
120 glcpp_glcpp_LDADD =                                     \
121         libglcpp.la                                     \
122         -lm
123
124 libglsl_la_LIBADD = libglcpp.la
125 libglsl_la_SOURCES =                                    \
126         glsl_lexer.cpp                                  \
127         glsl_parser.cpp                                 \
128         glsl_parser.h                                   \
129         $(LIBGLSL_FILES)
130
131 glsl_compiler_SOURCES = \
132         $(top_srcdir)/src/mesa/main/imports.c \
133         $(top_srcdir)/src/mesa/program/prog_hash_table.c \
134         $(top_srcdir)/src/mesa/program/symbol_table.c \
135         $(GLSL_COMPILER_CXX_FILES)
136
137 glsl_compiler_LDADD =                                   \
138         libglsl.la                                      \
139         $(PTHREAD_LIBS)
140
141 glsl_test_SOURCES = \
142         $(top_srcdir)/src/mesa/main/imports.c \
143         $(top_srcdir)/src/mesa/program/prog_hash_table.c \
144         $(top_srcdir)/src/mesa/program/symbol_table.c \
145         $(GLSL_SRCDIR)/standalone_scaffolding.cpp \
146         tests/common.c \
147         test.cpp \
148         test_optpass.cpp \
149         test_optpass.h
150
151 glsl_test_LDADD = libglsl.la
152
153 # We write our own rules for yacc and lex below. We'd rather use automake,
154 # but automake makes it especially difficult for a number of reasons:
155 #
156 #  * < automake-1.12 generates .h files from .yy and .ypp files, but
157 #    >=automake-1.12 generates .hh and .hpp files respectively. There's no
158 #    good way of making a project that uses C++ yacc files compatible with
159 #    both versions of automake. Strong work automake developers.
160 #
161 #  * Since we're generating code from .l/.y files in a subdirectory (glcpp/)
162 #    we'd like the resulting generated code to also go in glcpp/ for purposes
163 #    of distribution. Automake gives no way to do this.
164 #
165 #  * Since we're building multiple yacc parsers into one library (and via one
166 #    Makefile) we have to use per-target YFLAGS. Using per-target YFLAGS causes
167 #    automake to name the resulting generated code as <library-name>_filename.c.
168 #    Frankly, that's ugly and we don't want a libglcpp_glcpp_parser.h file.
169
170 # In order to make build output print "LEX" and "YACC", we reproduce the
171 # automake variables below.
172
173 AM_V_LEX = $(am__v_LEX_$(V))
174 am__v_LEX_ = $(am__v_LEX_$(AM_DEFAULT_VERBOSITY))
175 am__v_LEX_0 = @echo "  LEX     " $@;
176 am__v_LEX_1 =
177
178 AM_V_YACC = $(am__v_YACC_$(V))
179 am__v_YACC_ = $(am__v_YACC_$(AM_DEFAULT_VERBOSITY))
180 am__v_YACC_0 = @echo "  YACC    " $@;
181 am__v_YACC_1 =
182
183 glsl_parser.cpp glsl_parser.h: glsl_parser.yy
184         $(AM_V_YACC) $(YACC) $(YFLAGS) -o $@ -p "_mesa_glsl_" --defines=$(GLSL_BUILDDIR)/glsl_parser.h $<
185
186 glsl_lexer.cpp: glsl_lexer.ll
187         $(AM_V_LEX) $(LEX) $(LFLAGS) -o $@ $<
188
189 glcpp/glcpp-parse.c glcpp/glcpp-parse.h: glcpp/glcpp-parse.y
190         $(AM_V_at)$(MKDIR_P) glcpp
191         $(AM_V_YACC) $(YACC) $(YFLAGS) -o $@ -p "glcpp_parser_" --defines=$(GLSL_BUILDDIR)/glcpp/glcpp-parse.h $<
192
193 glcpp/glcpp-lex.c: glcpp/glcpp-lex.l
194         $(AM_V_at)$(MKDIR_P) glcpp
195         $(AM_V_LEX) $(LEX) $(LFLAGS) -o $@ $<
196
197 # Only the parsers (specifically the header files generated at the same time)
198 # need to be in BUILT_SOURCES. Though if we list the parser headers YACC is
199 # called for the .c/.cpp file and the .h files. By listing the .c/.cpp files
200 # YACC is only executed once for each parser. The rest of the generated code
201 # will be created at the appropriate times according to standard automake
202 # dependency rules.
203 BUILT_SOURCES =                                         \
204         glsl_parser.cpp                                 \
205         glsl_lexer.cpp                                  \
206         glcpp/glcpp-parse.c                             \
207         glcpp/glcpp-lex.c
208 CLEANFILES =                                            \
209         glcpp/glcpp-parse.h                             \
210         glsl_parser.h                                   \
211         $(BUILT_SOURCES)
212
213 clean-local:
214         $(RM) -r subtest-cr subtest-cr-lf subtest-lf subtest-lf-cr