glsl: Remove builtin_compiler from the build system.
[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/mapi \
25 -I$(top_srcdir)/src/mesa/ \
26 -I$(top_srcdir)/src/glsl/glcpp \
27 -I$(top_srcdir)/src/gtest/include \
28 $(DEFINES)
29 AM_CFLAGS = $(VISIBILITY_CFLAGS)
30 AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
31
32 include Makefile.sources
33
34 TESTS = glcpp/tests/glcpp-test \
35 tests/optimization-test \
36 tests/ralloc-test \
37 tests/uniform-initializer-test
38
39 TESTS_ENVIRONMENT= \
40 export PYTHON2=$(PYTHON2); \
41 export PYTHON_FLAGS=$(PYTHON_FLAGS);
42
43 noinst_LTLIBRARIES = libglsl.la libglcpp.la
44 check_PROGRAMS = \
45 glcpp/glcpp \
46 glsl_test \
47 tests/ralloc-test \
48 tests/uniform-initializer-test
49
50 tests_uniform_initializer_test_SOURCES = \
51 $(top_srcdir)/src/mesa/main/hash_table.c \
52 $(top_srcdir)/src/mesa/main/imports.c \
53 $(top_srcdir)/src/mesa/program/prog_hash_table.c\
54 $(top_srcdir)/src/mesa/program/symbol_table.c \
55 tests/copy_constant_to_storage_tests.cpp \
56 tests/set_uniform_initializer_tests.cpp \
57 tests/uniform_initializer_utils.cpp
58 tests_uniform_initializer_test_CFLAGS = \
59 $(PTHREAD_CFLAGS)
60 tests_uniform_initializer_test_LDADD = \
61 $(top_builddir)/src/gtest/libgtest.la \
62 $(top_builddir)/src/glsl/libglsl.la \
63 $(PTHREAD_LIBS)
64
65 tests_ralloc_test_SOURCES = \
66 tests/ralloc_test.cpp \
67 $(top_builddir)/src/glsl/ralloc.c
68 tests_ralloc_test_CFLAGS = $(PTHREAD_CFLAGS)
69 tests_ralloc_test_LDADD = \
70 $(top_builddir)/src/gtest/libgtest.la \
71 $(PTHREAD_LIBS)
72
73 libglcpp_la_SOURCES = \
74 glcpp/glcpp-lex.c \
75 glcpp/glcpp-parse.c \
76 $(LIBGLCPP_FILES)
77
78 glcpp_glcpp_SOURCES = \
79 glcpp/glcpp.c \
80 $(top_srcdir)/src/mesa/program/prog_hash_table.c
81 glcpp_glcpp_LDADD = libglcpp.la
82
83 libglsl_la_LIBADD = libglcpp.la
84 libglsl_la_SOURCES = \
85 glsl_lexer.cpp \
86 glsl_parser.cpp \
87 $(LIBGLSL_FILES)
88
89 glsl_test_SOURCES = \
90 $(top_srcdir)/src/mesa/main/hash_table.c \
91 $(top_srcdir)/src/mesa/main/imports.c \
92 $(top_srcdir)/src/mesa/program/prog_hash_table.c \
93 $(top_srcdir)/src/mesa/program/symbol_table.c \
94 $(GLSL_SRCDIR)/standalone_scaffolding.cpp \
95 test.cpp \
96 test_optpass.cpp
97
98 glsl_test_LDADD = libglsl.la
99
100 # We write our own rules for yacc and lex below. We'd rather use automake,
101 # but automake makes it especially difficult for a number of reasons:
102 #
103 # * < automake-1.12 generates .h files from .yy and .ypp files, but
104 # >=automake-1.12 generates .hh and .hpp files respectively. There's no
105 # good way of making a project that uses C++ yacc files compatible with
106 # both versions of automake. Strong work automake developers.
107 #
108 # * Since we're generating code from .l/.y files in a subdirectory (glcpp/)
109 # we'd like the resulting generated code to also go in glcpp/ for purposes
110 # of distribution. Automake gives no way to do this.
111 #
112 # * Since we're building multiple yacc parsers into one library (and via one
113 # Makefile) we have to use per-target YFLAGS. Using per-target YFLAGS causes
114 # automake to name the resulting generated code as <library-name>_filename.c.
115 # Frankly, that's ugly and we don't want a libglcpp_glcpp_parser.h file.
116
117 # In order to make build output print "LEX" and "YACC", we reproduce the
118 # automake variables below.
119
120 AM_V_LEX = $(am__v_LEX_$(V))
121 am__v_LEX_ = $(am__v_LEX_$(AM_DEFAULT_VERBOSITY))
122 am__v_LEX_0 = @echo " LEX " $@;
123 am__v_LEX_1 =
124
125 AM_V_YACC = $(am__v_YACC_$(V))
126 am__v_YACC_ = $(am__v_YACC_$(AM_DEFAULT_VERBOSITY))
127 am__v_YACC_0 = @echo " YACC " $@;
128 am__v_YACC_1 =
129
130 glsl_parser.cpp glsl_parser.h: glsl_parser.yy
131 $(AM_V_YACC) $(YACC) $(YFLAGS) -o $@ -p "_mesa_glsl_" --defines=$(GLSL_BUILDDIR)/glsl_parser.h $<
132
133 glsl_lexer.cpp: glsl_lexer.ll
134 $(AM_V_LEX) $(LEX) $(LFLAGS) -o $@ $<
135
136 glcpp/glcpp-parse.c glcpp/glcpp-parse.h: glcpp/glcpp-parse.y
137 $(MKDIR_P) $(GLSL_BUILDDIR)/glcpp
138 $(AM_V_YACC) $(YACC) $(YFLAGS) -o $@ -p "glcpp_parser_" --defines=$(GLSL_BUILDDIR)/glcpp/glcpp-parse.h $<
139
140 glcpp/glcpp-lex.c: glcpp/glcpp-lex.l
141 $(MKDIR_P) $(GLSL_BUILDDIR)/glcpp
142 $(AM_V_LEX) $(LEX) $(LFLAGS) -o $@ $<
143
144 # Only the parsers (specifically the header files generated at the same time)
145 # need to be in BUILT_SOURCES. Though if we list the parser headers YACC is
146 # called for the .c/.cpp file and the .h files. By listing the .c/.cpp files
147 # YACC is only executed once for each parser. The rest of the generated code
148 # will be created at the appropriate times according to standard automake
149 # dependency rules.
150 BUILT_SOURCES = \
151 glsl_parser.cpp \
152 glsl_lexer.cpp \
153 glcpp/glcpp-parse.c \
154 glcpp/glcpp-lex.c
155 CLEANFILES = \
156 glcpp/glcpp-parse.h \
157 glsl_parser.h \
158 $(BUILT_SOURCES)