1 # Copyright © 2012 Jon TURNEY
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:
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
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
23 -I$(top_srcdir)/include \
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 \
30 AM_CFLAGS = $(VISIBILITY_CFLAGS)
31 AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
33 include Makefile.sources
35 TESTS = glcpp/tests/glcpp-test \
36 tests/general-ir-test \
37 tests/optimization-test \
38 tests/sampler-types-test \
39 tests/uniform-initializer-test
42 export PYTHON2=$(PYTHON2); \
43 export PYTHON_FLAGS=$(PYTHON_FLAGS);
45 noinst_LTLIBRARIES = libglsl.la libglcpp.la
49 tests/general-ir-test \
50 tests/sampler-types-test \
51 tests/uniform-initializer-test
53 noinst_PROGRAMS = glsl_compiler
55 tests_general_ir_test_SOURCES = \
56 $(top_srcdir)/src/mesa/main/hash_table.c \
57 $(top_srcdir)/src/mesa/main/imports.c \
58 $(top_srcdir)/src/mesa/program/prog_hash_table.c\
59 $(top_srcdir)/src/mesa/program/symbol_table.c \
60 $(GLSL_SRCDIR)/standalone_scaffolding.cpp \
61 tests/builtin_variable_test.cpp \
62 tests/invalidate_locations_test.cpp \
63 tests/general_ir_test.cpp \
64 tests/varyings_test.cpp \
66 tests_general_ir_test_CFLAGS = \
68 tests_general_ir_test_LDADD = \
69 $(top_builddir)/src/gtest/libgtest.la \
70 $(top_builddir)/src/glsl/libglsl.la \
73 tests_uniform_initializer_test_SOURCES = \
74 $(top_srcdir)/src/mesa/main/hash_table.c \
75 $(top_srcdir)/src/mesa/main/imports.c \
76 $(top_srcdir)/src/mesa/program/prog_hash_table.c\
77 $(top_srcdir)/src/mesa/program/symbol_table.c \
78 tests/copy_constant_to_storage_tests.cpp \
79 tests/set_uniform_initializer_tests.cpp \
80 tests/uniform_initializer_utils.cpp \
82 tests_uniform_initializer_test_CFLAGS = \
84 tests_uniform_initializer_test_LDADD = \
85 $(top_builddir)/src/gtest/libgtest.la \
86 $(top_builddir)/src/glsl/libglsl.la \
89 tests_sampler_types_test_SOURCES = \
90 $(top_srcdir)/src/mesa/program/prog_hash_table.c\
91 $(top_srcdir)/src/mesa/program/symbol_table.c \
92 tests/sampler_types_test.cpp \
94 tests_sampler_types_test_CFLAGS = \
96 tests_sampler_types_test_LDADD = \
97 $(top_builddir)/src/gtest/libgtest.la \
98 $(top_builddir)/src/glsl/libglsl.la \
101 libglcpp_la_LIBADD = \
102 $(top_builddir)/src/util/libmesautil.la
103 libglcpp_la_SOURCES = \
105 glcpp/glcpp-parse.c \
108 glcpp_glcpp_SOURCES = \
111 $(top_srcdir)/src/mesa/program/prog_hash_table.c
112 glcpp_glcpp_LDADD = \
116 libglsl_la_LIBADD = libglcpp.la
117 libglsl_la_SOURCES = \
122 glsl_compiler_SOURCES = \
123 $(top_srcdir)/src/mesa/main/hash_table.c \
124 $(top_srcdir)/src/mesa/main/imports.c \
125 $(top_srcdir)/src/mesa/program/prog_hash_table.c \
126 $(top_srcdir)/src/mesa/program/symbol_table.c \
127 $(GLSL_COMPILER_CXX_FILES)
129 glsl_compiler_LDADD = \
133 glsl_test_SOURCES = \
134 $(top_srcdir)/src/mesa/main/hash_table.c \
135 $(top_srcdir)/src/mesa/main/imports.c \
136 $(top_srcdir)/src/mesa/program/prog_hash_table.c \
137 $(top_srcdir)/src/mesa/program/symbol_table.c \
138 $(GLSL_SRCDIR)/standalone_scaffolding.cpp \
143 glsl_test_LDADD = libglsl.la
145 # We write our own rules for yacc and lex below. We'd rather use automake,
146 # but automake makes it especially difficult for a number of reasons:
148 # * < automake-1.12 generates .h files from .yy and .ypp files, but
149 # >=automake-1.12 generates .hh and .hpp files respectively. There's no
150 # good way of making a project that uses C++ yacc files compatible with
151 # both versions of automake. Strong work automake developers.
153 # * Since we're generating code from .l/.y files in a subdirectory (glcpp/)
154 # we'd like the resulting generated code to also go in glcpp/ for purposes
155 # of distribution. Automake gives no way to do this.
157 # * Since we're building multiple yacc parsers into one library (and via one
158 # Makefile) we have to use per-target YFLAGS. Using per-target YFLAGS causes
159 # automake to name the resulting generated code as <library-name>_filename.c.
160 # Frankly, that's ugly and we don't want a libglcpp_glcpp_parser.h file.
162 # In order to make build output print "LEX" and "YACC", we reproduce the
163 # automake variables below.
165 AM_V_LEX = $(am__v_LEX_$(V))
166 am__v_LEX_ = $(am__v_LEX_$(AM_DEFAULT_VERBOSITY))
167 am__v_LEX_0 = @echo " LEX " $@;
170 AM_V_YACC = $(am__v_YACC_$(V))
171 am__v_YACC_ = $(am__v_YACC_$(AM_DEFAULT_VERBOSITY))
172 am__v_YACC_0 = @echo " YACC " $@;
175 glsl_parser.cpp glsl_parser.h: glsl_parser.yy
176 $(AM_V_YACC) $(YACC) $(YFLAGS) -o $@ -p "_mesa_glsl_" --defines=$(GLSL_BUILDDIR)/glsl_parser.h $<
178 glsl_lexer.cpp: glsl_lexer.ll
179 $(AM_V_LEX) $(LEX) $(LFLAGS) -o $@ $<
181 glcpp/glcpp-parse.c glcpp/glcpp-parse.h: glcpp/glcpp-parse.y
182 $(AM_V_at)$(MKDIR_P) glcpp
183 $(AM_V_YACC) $(YACC) $(YFLAGS) -o $@ -p "glcpp_parser_" --defines=$(GLSL_BUILDDIR)/glcpp/glcpp-parse.h $<
185 glcpp/glcpp-lex.c: glcpp/glcpp-lex.l
186 $(AM_V_at)$(MKDIR_P) glcpp
187 $(AM_V_LEX) $(LEX) $(LFLAGS) -o $@ $<
189 # Only the parsers (specifically the header files generated at the same time)
190 # need to be in BUILT_SOURCES. Though if we list the parser headers YACC is
191 # called for the .c/.cpp file and the .h files. By listing the .c/.cpp files
192 # YACC is only executed once for each parser. The rest of the generated code
193 # will be created at the appropriate times according to standard automake
198 glcpp/glcpp-parse.c \
201 glcpp/glcpp-parse.h \