Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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